...
- The java standard for Plugins is OSGi (http://www.osgi.org), this is what IGB (written in java) uses.
- The OSGi term for a Plugin is Bundle, they mean the same thing.
- An OSGi bundle is a jar file. It must have a MANIFEST.MF file with the OSGi headers (see below).
- An OSGi bundle can (usually will) have a special java class called an Activator. This class must extend
org.osgi.framework.BundleActivator
, and implement thestart()
andstop()
methods. The activator class is specified in the Bundle-Activator MANIFEST.MF header (see below). These methods are called when the bundle is started and stopped. - When a program is running with OSGi, the OSGi framework dynamically handles installing / uninstalling,
activating (starting), deactivating (stopping), and upgrading bundles. - OSGi caches bundles, saving them to a directory on the local hard disk, so that they don't need to be downloaded every time. So you can work offline after you have loaded IGB. If, for some reason, you need to clean out the bundle cache, you can run
ant cbc
(clear bundle cache). - There are several implementations of OSGi, including:
- Apache Felix (http://felix.apache.org/)
- Eclipse Equinox (http://www.eclipse.org/equinox/)
- Knoplerfish (http://www.knopflerfish.org/)
- the The implementations are (for the most part) interchangeable and are free.
- the The implementations allow the user to run OSGi from a command line tool or to start it within a program.
- IGB starts the felix implementation from within the com.affymetrix.igb.main.OSGiHandler class, but IGB can
be run using the Felix command line tool by runningant gogo.
- there are several tutorials for OSGi, including:
- How to get Started with OSGi (http://www.osgi.org/About/HowOSGi)
- Apache Felix OSGi Tutorial (http://felix.apache.org/site/apache-felix-osgi-tutorial.html)
- OSGi for Beginners (http://www.theserverside.com/news/1363825/OSGi-for-Beginners)
- OSGi with Eclipse Equinox - Tutorial (http://www.vogella.de/articles/OSGi/article.html)
- IGB uses OBR (http://felix.apache.org/site/apache-felix-osgi-bundle-repository.html) to find and load bundles from web servers (repositories). The web servers need to use OBR to create the repository.xml file listing all the available bundles.
- Users can add / remove bundle repositories by choosing File>Preferences page, Plugin Repositories tab.
- IGB uses OSGi Services to allow bundles to add new implementations of existing IGB elements. The new implementations will show up as soon as the bundle is started. Examples include IGB tabs and graph manipulation functions.
...
- In the Project Explorer - blank area, right-click
- New > Project ... > Plug-in Project > "Next >" button
- Project name: "HelloWorld"
- On "Target Platform" select "an OSGi framework".Select "standard" on the drop down box beside "an OSGi framework" radio button.
- "Next >" button
- Version: "1.0.0"
- check "Generate an activator ..."
- Activator
helloworld.Activator
- "Next >" button
- Uncheck "Create a plug-in using one of the templates"
- "Finish" button
- New > Project ... > Plug-in Project > "Next >" button
- Under the new HelloWorld project, find the META-INF directory, and open the MANIFEST.MF file by double-clicking on it.
- Click on the "Dependencies" tab,
- On "Imported Packages" box, click the "Add..." button, in the "Package Selection" popup in the text box, enter
com.affymetrix.genoviz.util
and click the "OK" button.
- On "Imported Packages" box, click the "Add..." button, in the "Package Selection" popup in the text box, enter
- Right click on the blank area at the top, next to "Dependencies" and
- a context menu comes up, click "Save".
- a context menu comes up, click "Save".
- Open the Activator.java file under src/helloworld
- add the import statement
import com.affymetrix.genoviz.util.ErrorHandler;
- at the top, and add the line
ErrorHandler.errorPanel("Hello World");
- at the end of the start() method, and
ErrorHandler.errorPanel("Goodbye World");
- at the end of the stop method
- Save the file
- In the Project Explorer
- Right click the HelloWorld project
- > "Export ..."
- "Deployable plug-ins and fragments"
- "Next >" button
- Under "Available Plug-ins and Fragments:", check only Hello World
- "Directory:" use any directory you like
- click the "Finish" button.
- The HelloWorld_1.0.0.jar file will be in the plugins directory under the directory the you specified. This is your bundle
- In the IGB_HOME directory, from the command line run
run_igb -install_bundle
file:/
<bundle_directory>/plugins/HelloWorld_1.0.0.jar
(Windows)./run_igb.sh -install_bundle
file:/
<bundle_directory>/plugins/HelloWorld_1.0.0.jar
(Mac and Linux)- where IGB_HOME is your IGB directory, and <bundle_directory> is the directory that you specified
in the export
- You should now see your Hello World plugin.
- If you install the plugin you will see an Error popup "Hello World"
- When you uninstall the plugin, you will see an Error popup "Goodbye World"
- Congratulations!
To
...
create plug-ins using NetBeans
...
See the Quick-Start Guide
...
Is this possible? Easy? .