Extending the Extraction-Service Using Plug-ins

Beginning with yuuvis® RAD 9.0, the extraction-service can be extended by plug-ins.

Including an Existing Plug-in in the Extraction-Service

The deployment of an existing plug-in is explained by setting up an example plug-in for processing PGN files.

Configuring the Extraction-Service

By default, the use of plug-ins is disabled. In the extraction-prod.yml file, these settings can be adjusted:

plugins: enabled: true directory: '../../data/plugins'

The jar file of the plug-in must then be stored in the specified directory:

The extraction-service must be restarted to enable the plug-in.
Any number of plug-in files can be stored in this directory.

Checking the Logging of the Plug-in

As soons as the extraction-service has been restarted, available plug-ins are detected. Information on these plug-ins can be found in the log.

If the plugins.enabled switch is not set to true, the following will be protocolled in the log:

... c.o.s.e.routing.PluginProcessor : plugins not enabled

If the plug-ins are enabled, but not stored in the directory, the log will look as follows:

... c.o.s.e.routing.PluginProcessor : plugins enabled: ../../data/plugins ... c.o.s.e.routing.PluginProcessor : plugins found: 0

If plug-ins are found, they will be listed with their names and namespaces:

If plug-ins are active for a specific file, the number of each extracted plug-in will be in the log:

Result of the Extraction

The result of the extraction from this PGN file will look like this:

Creating a Plug-in

This section describes how to set up and configure a new plug-in including its deployment and check.

The plug-in capability of the extraction-service is based on the PF4J framework.
The extraction-service loads plug-ins via PF4J-Spring.

The plug-in must comply with the interface defined by PF4J-Spring. In particular, this is a constructor with a PluginWrapper as a parameter:

Including the Library for the Definition of the Plug-in Interface

OPTIMAL SYSTEMS provides a library for the defintion of the plug-in interface. The extractionservice-plugin-interface.jar file is available for download below and must be added to the project. It defines the interface for the extraction-service and also brings the plug-in capability of PF4J.

It is important that the dependency of the plug-in to the interface library is defined as provided (in gradle compileOnly):

Implementing the Plug-in

As an example of a plug-in, the extractionservice-plugin-demo.jar file is also avaible for download:

The following example operates on PGN files.

Plug-in example code:

Building the jar File

If the plug-in is packaged in a jar file, there are important points to note:
The following attributes must be specified in the MANIFEST.MF file (in the example plug-in):

for these values to be automatically inserted into the jar file, the maven-assembly-plugin can be configured accordingly:

The jar file must contain all required libraries (except extractionservice-plugin-interface and thus also pf4j).
The MANIFEST.MF file must have the appropriate entries.
The extensions.idx file must be included. It is automatically generated by PF4J during build.

This generated jar file can now be placed in the appropriately configured directory of the extraction-service.

Checking the Plug-in

To check the new plugin, the extraction-service must be configured as described in Including an existing plugin in the extractionservice.