Skip to content
Snippets Groups Projects
jython-based-reporting-and-processing-plugins.md 25.27 KiB

Jython-based Reporting and Processing Plugins

Overview

It is possible to implement logic of reporting and processing plugins as Jython scripts instead of providing new classes implementing IReportingPluginTask and IProcessingPluginTask Java interfaces.

The scripts require only a single method to be implemented and have access to a few services that simplify tasks such as data retrieval, creation of tables or sending emails:

  • access to files of a data set is done via IHierarchicalContent interface (through IDataSet.getContent())

  • access to openBIS AS via ISearchService (through searchService and searchServiceUnfiltered variables),

  • access to data sources specified in DSS via IDataSourceQueryService (through queryService variable),

  • creation of tables in reporting script via ISimpleTableModelBuilderAdaptor (provided as a function argument),

  • sending emails via IMailService (through mailServicevariable)

    • it is easy to send a file or a text as an attachment to the user (subject and text body can be provided optionally)
    • it is also possible to use a reporting script as a processing plugin sending the report as an attachment to the user
  • checking user access privileges via the IAuthorizationService

     (available from the authorizationService variable).

All jython plugins use Jython version configured by the service.properties property jython-version which can be either 2.5 or 2.7.

Configuration

Jython-based plugins are configured in exactly the same way as other reporting and processing plugins. Apart from standard mandatory plugin properties one needs to specify a path to the script - script-path.

Additional third-party JAR files have to be added to the core plugin in a sub-folder lib/.

Here are some configuration examples for core plugins of the type reporting-plugins and processing-plugins, respectively:

Jython-based Reporting Plugin

plugin.properties

label = Jython Reporting
dataset-types = HCS_IMAGE
class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.jython.JythonBasedReportingPlugin
script-path = data-set-reporting.py
Jython Aggregation Service 

plugin.properties

label = Jython Aggregation Reporting
class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.jython.JythonAggregationService
script-path = aggregating.py
Jython Ingestion Service

plugin.properties

label = Jython Aggregation Reporting
class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.jython.JythonIngestionService
script-path = processing.py

Note, that property dataset-types is not needed and will be ignored.