Menu

Plugin Development

kainzp
Attachments
new-java-project-1.png (85604 bytes)
new-java-project-2.png (87910 bytes)

Plugin Development

Prerequisites

  1. Download the latest IQM API (optionally with full dependency list) from the download section to your download folder (e.g. ~/Downloads).
  2. Download any required libraries for your operator to be developed (e.g. log4j).

Export pre-configured plugin skeleton from repository

Use the command line

Create a new folder for the skeleton at a custom location and enter the following commands on the command line:
$ cd ~/plugin-skeleton/: change to your directory
$ svn export --force https://svn.code.sf.net/p/iqm/code-0/trunk/iqm/plugins/skeleton/simple-plugin-template .
Subversion will export all files to your directory where the file pom.xml and the directory src are located.

Use the TortoiseSVN tool

See wiki page on [Tortoise Checkout].

Build the eclipse project

Using Eclipse

Create a new Java project using the eclipse project wizard.
Create new java project

Remove the existing folder src from the build path and create 4 new source folders:

  • src/main/java
  • src/main/resources
  • src/test/java
  • src/test/resources
    and hit "Finish"

Create new source folders

Get the the entire content from ~/plugin-skeleton and copy it to the project, overwrite all.

Resolve dependend libraries and modules

  1. iqm-api: add the previously downloaded iqm-api-*.jar to your build path. Hint: If you use the version with dependencies included, you will also get the required JAI classes.
  2. add optional libraries according to your requirements

Using Maven

Optional: Copy the skeleton to a new location, if you don't want to overwrite the template.

  1. Change to the directory e.g. $ cd ~/plugin-project
  2. Install the file manually to your maven repository using
    $ mvn install:install-file -DgroupId=at.mug.iqm -DartifactId=iqm-api -Dversion=3.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file, where /path/to/file refers to the file in your download folder, here it is ~/Downloads/iqm-app-3.0-SNAPSHOT-with-dependencies.jar.
  3. Build your project with maven using mvn eclipse:clean eclipse:eclipse.
  4. Import your project into eclipse using File --> Import... (import wizard).

Configure the plugin

Create a unique package e.g. my.plugins.myOperator in the src/main/java and src/main/resources directories.
We will refer to my.plugins.myOperator as <unique-path> within this guide.
This is where all your source files and resources go, since we need a unique class path for each operator and plugin at runtime.

Alter the information in %PLUGIN_RES% = src/main/resources/<unique-path>/iqm-plugin.xml according to your specifications/requirements. This file is required to be located within this directory.
Similarly, create a java file Plugin.java in src/main/java/<unique-path> which extends at.mug.iqm.api.plugin.AbstractPlugin or implements at.mug.iqm.api.plugin.IPlugin. This file represents the information in the XML and is used for initialization of the plugin.

Custom Menu Icons

Any resources for menu item icons belonging to a specific plugin must be stored in %PLUGIN_RES%. Then, the class loader will be able to locate the resources.

  • The menu icon for the enabled menu item must be dropped in %PLUGIN_RES%/icons/ and must be named menu-item-enabled.png.
  • The menu icon for the disabled menu item must be dropped in %PLUGIN_RES%/icons/ and must be named menu-item-disabled.png

You may specify custom names of these images and overload the methods in your Plugin.java. If one of these files do not exist, or both are missing, the application substitutes them using default icons from the API.
Moreover, the use of a 16x16 px PNG image is encouraged.

Implement the IQM operator classes

See the wiki page on [Operator Development].

Test and Debug the Plugin

See the wiki page on [Debugging].

Build the plugin

Eclipse (straightforward)

In order to export the plugin simply select File --> Export... on your project.
Choose Java --> JAR File as the export type and hit next.

choose Java --> JAR File as export type

Select the entire project, choose a custom export destination and hit finish.

Maven (for multiple plugins)

Run
$ mvn clean package
and create the java archive file in the target folder.

Deploy the plugin in IQM

Take the generated jar file and drop in the /plugins/image or /plugins/plot directory in your IQM installation path.
Just relaunch IQM and the plugin will show up in the plugin menu.


Related

Wiki: Operator Development
Wiki: Tortoise Checkout

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB