For installing the content handler in Docmenta, a plug-in package has to be created as described in Chapter 4.2, Creating a plug-in package
. The plug-in package has to place the compiled content handler class in the classpath. Furthermore, for the content handler to be automatically loaded a new folder has to be placed in the "apps
" folder within the Docmenta web-application directory. This folder is the content handler installation directory. The name of this folder is used as identifier of the installed content handler. This folder has to contain two property files named apphandler.properties
. This folder may also contain additional content handler specific files. In our example this folder also contains the view.jsp
file. This leads to the following plug-in structure:
Figure 4.4.1. Viewer plug-in package (example)
Instead of placing the class file in the web/WEB-INF/classes folder, the file could also be included in a jar-file and placed in the lib or web/WEB-INF/lib folder.
Be aware that the name of the content handler directory (here: my_text_viewer_v1-0) must consist of letters, digits, underscore and dash only. This is because the directory name is used as content handler identifier and therefore has to follow the naming rules of an identifier.
Following an example of the plugin.properties file:
required_app_version = 1.9
config_dialog = false
load_type = next_startup
Listing 4.4.5. plugin.properties (viewer example)
The plugin_class property is empty, because we do not provide any implementation for the plug-in lifecycle methods. This is not required, because content handlers that are located in the apps folder are automatically loaded on server start-up.
The plug-in's locale.properties file just contains the localized plug-in description:
my_text_viewer_v1_0.description = Viewer plug-in example
Listing 4.4.6. locale.properties (viewer example)
In this example the help_url property is left empty, because we do not provide any online-help for the plug-in.
There is a second locale.properties file in the content handler directory, which defines the localized display name of the content handler:
my_text_viewer_v1-0.application_name = My Text Viewer
Listing 4.4.7. locale.properties (located in apps/my_text_viewer_v1-0)
The locale.properties in the content handler directory is not necessarily required, because all localized text could be defined in the plug-in's global locale.properties file. However, for reasons of modularity it is recommended to place localized text that is only used by the content handler in the locale.properties file within the content handler directory.
Each installed content handler needs a file named apphandler.properties, which has to be located in the content handler directory. This file must contain at least one property with name handler_class that defines the content handler implementation to be used. Therefore, in our example the apphandler.properties file has to contain following line:
handler_class = myexample.MyTextViewer
Listing 4.4.8. apphandler.properties (viewer example)