Create a plug-in¶
A plug-in is governed by the RPL. In reporting context RPL is a just another layout type. A user will install this RPL to a specific report and in the runtime, when a report is ordered with this layout, the fetched data for this report will be sent to this plug-in and get processed and the output will be returned back to the framework as decided by the RPL. RPL is the place which contain the identity of a plug-in.
An Extended report formatter plug-in is a java class. Once developed this java class will reside inside the extended server at
ifs.application.printagentservice.impl.extendedformatter.userPlugins.This java class will be added to the extended server as a normal middle tier patch.
In runtime this java class will be identified by the <plugin-class>...</plugin-class> in the RPL. The tag must contain the fully qualified class name so that the class can be instantiated in runtime using java reflection. Example of a fully quaified plug-inname can be:
ifs.application.printagentservice.impl.extendedformatter.userPlugins.yourPluginName. Once instantiated within the framewor, it will be cast in to a generic plug-intype.
Interfaces that should be implemented to become an Extended report formatter compatible class.¶
A plug-in class must be either extending the abstract class
ifs.application.printagentservice.impl.extendedformatter.BasePlugin or implementing the
Methods to be implemented and parameters sent by the frame work, and what the framework expects back.¶
public boolean Initialize(InputStream rpl) throws PluginException;
InputStream rpl: This stream will be sent back to the plug-in and can be used to retrieve the plug-in specific details back from the rpl. This method can be used by a plug-in developer to read the needed plugin specific information from the rpl and store them in the object.
public boolean doProcess(InputStream xml, InputStream xsd, OutputStream outStream) throws PluginException;
This is where the main execution is implemented and the result is returned in the OutputStream.
InputStream xml:The fetched data of the report. This data will be either flat or hierarchical, depending on the setting in the rpl. (a developer can get this xml for analysis by using the pre developed XML-plug-in )
InputStream xsd:The original Report schema will be sent to the plug-in. As this is the schema a developer can find all the semantics of data sent in by reading this.
OutputStream outStream:The generated result of the plug-in. this can be any data stream which can be handled by the available plug-in output types.(<BINARY> a byte stream, if multiple byte streams to be returned by single execution, byte stream should be separated by SEPARATOR = '\u001f'. which is defined as a public constant in the BasePlugin as BasePlugin.SEPARATOR ), Output extension is not applicable.
<FILE>. A file will be created in a pre defined or default location.
<E-MAIL> The output will be attached in an email, if the output data is compatible. Multiple output types can be set in a single RPL. Eg <output-method>FILE;E-MAIL</output-method>).
The abstract class
BasePlugin may be extended by any plug-in, it parses the report layout file (.rpl) and stores the layout properties, plug-in properties, plug-in variables and plug-in data as hash maps and a byte array.
|Method name||Input parameter||Output type||Description|
|Initialize||InputStream rpl||Boolean||Initializes the plugin with data from the.rpl file.|
|getLayoutProperties||None||Hashmap||The layout properties fetched from the.rpl file during Initialize()|
|getPluginProperties||None||Hashmap||The plugin properties fetched from the.rpl file during Initialize()|
|getPluginVariables||None||Hashmap||The plugin variables fetched from the.rpl file during Initialize()|
|getPluginData||None||byte||The plugin data fetched from the.rpl file during Initialize()|
The interface that all developed plug-ins are required to implement.
|Method name||Input parameter||Output parameter||Description|
|Initialize||InputStream rpl||Boolean||Initializes the plug-in with data from the.rpl file.|
|doProcess||InputStream xml, InputStream xsd, OutputStream out||Boolean||Performs the desired process on the xml InputStream, perhaps using data from the xsd schema, and writes the result to the OuputStream.|