Creating and Using a Java Plug-in

The process of creating and using a Java Plug-in should be as easy as possible.

To create a plug-in:

Write the classes necessary to perform your plug-in's action. Designate a specific class to be the "plug-in class" which should implement some application specific interface for plug-ins. If you need information about your plug-in or need resource loading write the appropriate methods to indicate your desire to do so. Then Jar up your classes along with a plug-in information file which can be written and validated with any standard set of XML tools. Finally rename your plug-in to conform to the application's plug-in naming conventions. Your plug-in should now work assuming it is placed in a location the application searches for plug-ins.

To use plug-ins:

Use the plug-in API to specify where to search for plug-ins and how they can be distinguished from other file types. The plug-in API will then return you a vector of Plug-in Descriptor objects. You should use the plug-in information to determine which ones you want to load and how they will be loaded into your application. For instance whether something is an importer or an exporter. For those plug-ins you wish to load, call the load method on the plug-in descriptor and store the resulting object as the expected type in some useful place. Now interact with that object as if it were a normal object from within your application.



jwalker@cs.oberlin.edu