[Go to Previous] [Go to Next]

Plugin Jar Files
Note: This page is intended for someone who wants to create a McIDAS-V plugin. A description of installing and managing plugins is here.

McIDAS-V supports a plugin architecture that allows for the easy extension and addition of functionality. A plugin is most commonly a Java Jar file that contains a set of resource files (e.g., color tables) and/or Java class files. The plugins are stored on a local directory or could be loaded form a web site. McIDAS-V processes the plugin Jar file at run time loading in the contained resources and code.

Basic Plugin
Lets suppose you have created a set of color tables and some Jython code that you want to make a plugin with. As described in the Site Configuration docs McIDAS-V stores these user created files in <user home>/.metappps/DefaultIdv as colortables.xml and default.py.

To make these into a plugin, e.g., myplugin.jar, simply jar the the files (you need to get a Java SDK for this):

jar -cvf myplugin.jar colortables.xml default.py

Now this plugin can be distributed to others and loaded into their McIDAS-V environment.

So, you might ask how does McIDAS-V recognize these files in the plugin and treat them appropriately? McIDAS-V loads in a set of resources (e.g., color tables, Python libraries). Each resource type is identified by a regular expression as shown in the resource list. In our example above the file name colortables.xml matches the pattern for color table xml resources.

Now, what happens if you have some file whose name does not match a pattern? Say, you have a color table xml file called myspecialtables.xml that you want to include in a bundle. In that case you can add a .rbi file, as described here, that defines this file as a resource:

<?xml version="1.0" encoding="ISO-8859-1"?>
  <resources name="idv.resource.colortables">
    <resource location="/myspecialtables.xml"/>
This acts as a table of contents for the plugin. Make sure that the location is not relative. Note: Jar files can contain directory trees. e.g., /tables/myspecialtables.xml. In this case just have the location point to:
    <resource location="/tables/myspecialtables.xml"/>
Including Code
You can also include code that implements certain functionality by just including the Java .class files in the Jar. When you do this you need to include them like a normal class containing Jar file, i.e., the package structure of your code (e.g., edu.ucar.app.Test) needs to be reflected in the directory structure of the Plugin Jar file:

For a single class file this is not necessarily required but if there are multiple class files that have interdependency among themselves then you will get into trouble if you don't follow this structure.

Now, what this code does can be anything and is best left up to the developer's guide.

[Go to Previous] [Go to Next]