Edit online

How to Write A Custom Protocol Plugin

To create a custom protocol plugin, follow these steps:

  1. Write the handler class for your protocol that implements the java.net.URLStreamHandler interface.
    Be careful to provide ways to encode and decode the URLs of your files.
  2. Write the plugin class by extending ro.sync.exml.plugin.Plugin.
  3. Write the plugin extension class that implements the ro.sync.exml.plugin.urlstreamhandler.URLStreamHandlerPluginExtension interface.

    It is necessary that the plugin extension for the custom protocol implements the URLStreamHandlerPluginExtension interface. Without it, you cannot use your plugin, because Oxygen XML Editor is not able to find the protocol handler.

    You can choose also to implement the URLChooserPluginExtension interface. It allows you to write and display your own customized dialog box for selecting resources that are loaded with the custom protocol.

    An implementation of the extension URLHandlerReadOnlyCheckerExtension allows you to:

    • Mark a resource as read-only when it is opened.
    • Switch between marking the resource as read-only and read-write while it is edited.

    It is useful when opening and editing CMS resources.

  4. Write the plugin.xml descriptor file.
    Remember to set the name of the plugin class to the one from the second step and the plugin extension class name with the one you have chosen at step 3.
  5. Create a JAR archive with all these files.
  6. Create a custom plugin folder inside the plugins folder (for example, [OXYGEN_INSTALL_DIR]/plugins/myPlugin) that contains your new plugin.