How to Write A Custom Protocol Plugin
To create a custom protocol plugin, follow these steps:
- Write the handler class for your protocol that implements the
java.net.URLStreamHandlerinterface.Be careful to provide ways to encode and decode the URLs of your files. - Write the plugin class by extending
ro.sync.exml.plugin.Plugin. - Write the plugin extension class that implements the
ro.sync.exml.plugin.urlstreamhandler.URLStreamHandlerPluginExtensioninterface.It is necessary that the plugin extension for the custom protocol implements the
URLStreamHandlerPluginExtensioninterface. Without it, you cannot use your plugin, because Oxygen XML Developer plugin is not able to find the protocol handler.You can choose also to implement the
URLChooserPluginExtensioninterface. 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
URLHandlerReadOnlyCheckerExtensionallows 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.
- Write the
plugin.xmldescriptor.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. - Create a .jar archive with all these files.
- Install your new plugin in the
pluginssubfolder of the Oxygen XML Developer plugin install folder.