Description:
This feature allows developers to add any third-party external jar file as an extension.
Instructions:
Creating an external jar file (yourExtension.jar):
1. Let us assume the working directory to be $WORKDING_DIRECTORY.
This is the directory-level at which you will create your jar file.
2. Create a config directory:
mkdir $WORKING_DIRECTORY/config
3. Create a configuration file (configuration.xml):
${WORKINGDIRECTORY}/config/configuration.xml
4. The configuration.xml has the following XML format:
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<runlevel>1</runlevel>
<class>Helloworld</class>
<function>Prints out String pointed to by Helloworld_Argument.class</function>
<arguments>
<argument>
Helloworld_Argument
</argument>
</arguments>
</extension>
</extensions>
5. In the XML:
<class>: Denotes the class inside yourExtension.jar that will serve
as an entry point. The class specified here needs to exist
inside the Jar file and also define the 'main' method
<Functionality>: Holds the comment which will be displayed against
this user extension
<Argument>: Holds the class name that serves as an argument to the
Main class pointed to by <class>. Multiple arguments
can be specified inside the <arguments> tab
6. Constructing your jar file:
<$WORKING_DIRECTORY>: jar cvf yourExtension.jar *
This creates an external jar file preserving the directory structure. In essence,
the Pipeline expects the configuration file to be present in:
yourExtension.jar!/config/configuration.xml
Loading a Jar file inside LONI Pipeline:
1. Run the pipeline
2. Click on Application --> Options
3. Click on Extensions Tab
4. Click on Add Extension
If the extension has been appropriately created you should see a line added which describes the
extension you just added.
5. Click save and exit
Example
1. Use helloworld.jar as the extension
2. helloworld.jar contains the following files (apart from the class files and config dir):
Helloworld.java
Helloworld_Argument.java
StringToPrint?.txt
3. Helloworld takes in an argument of type Helloworld_Argument. Helloworld_Argument reads the first
line of
StringToPrint?.txt and passes it to Helloworld, which then prints it out to System.out.
4. To change what gets printed, when helloworld.jar gets loaded, you can unzip the jar, change the
line inside
StringToPrint?.txt. Create the jar again and load it through the Pipeline, and the modified
string will be printed.
--
JagadeeswaranRajendiran - 16 Sep 2005