Developing IGB bundles
----------------------
IGB bundles are OSGi compatible, so they must have
an Activator, a class that extends org.osgi.framework.BundleActivator,
and they must have a manifest.mf file that is found in the META-INF directory.
These are compiled and jarred with all required classes, jars, and resources.
The resulting jar is the bundle. This can then be uploaded to the bundle repository.
At that point, any one can use the bundle with IGB.
IGB uses the Apache Felix OSGi implementation, but this could change, so no Felix specific
code should be used.
In the Activator class, there is a start() and stop() method that are called when the
bundle is activated / deactivated (not installed / uninstalled). This is where you
want to put all the code to start and stop the bundle.
In the manifest.mf file, there are several headers that need to be specified - fill in parenthesis below:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: (name of bundle)
Bundle-SymbolicName: (name of bundle)
Bundle-Version: (bundle version, you can use 1.0.0 to start)
Bundle-Activator: (activator class name, including package)
Bundle-ActivationPolicy: lazy
Import-Package: (list all external packages required by the bundle)
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: (put the class path within the bundle itself, e.g.: ., resources/, lib/xyz.jar)
Bundle-Description: (description of bundle)
Require-Bundle: (list all bundles required by this bundle)
Import-Package and Require-Bundle don't need to overlap, you can specify a requirement
in one or the other. To have a multi line header, start the continuation line after a blank in column 1.
Put a blank line at the end of the manifest.me file - due to a bug in felix.
The genometry and genoviz projects can by accessed as bundles (Require-Bundle), but the
IGB project is accessed through an interface, IGBService, itself a bundle.
If a class/method is needed from genometry/genoviz, it must be public, and the package
must be exported in the manifest.mf Export-Package list.
For access to IGB, this is done through the IGBService. If IGBService does not have a method
for what you need, it may need to be added to IGBService and IGBServiceImpl.
If you want to add a tab window as a bundle, there is a helper abstract class,
com.affymetrix.igb.window.service.WindowActivator, that you can extend.
If you need access to other bundles (like IGBService), you will not be sure when the
bundle is available. For Services, like IGBService and WindowService, you can use a
ServiceTracker to be notified when the required bundle is available - see WindowActivator
for an example.
To test the bundle, you can specify it as an optional bundle for IGB, by adding the jar
name to the pluginsOptionalList= entry in igb.properties.
Note - eclipse makes it a lot easier to develop bundles. You can create a new project
as a plug in project, and it will give you wizards, etc. for development. see: http://www.vogella.de/articles/OSGi/article.html
Developing IGB bundles
----------------------
IGB bundles are OSGi compatible, so they must have
an Activator, a class that extends org.osgi.framework.BundleActivator,
and they must have a manifest.mf file that is found in the META-INF directory.
These are compiled and jarred with all required classes, jars, and resources.
The resulting jar is the bundle. This can then be uploaded to the bundle repository.
At that point, any one can use the bundle with IGB.
IGB uses the Apache Felix OSGi implementation, but this could change, so no Felix specific
code should be used.
In the Activator class, there is a start() and stop() method that are called when the
bundle is activated / deactivated (not installed / uninstalled). This is where you
want to put all the code to start and stop the bundle.
In the manifest.mf file, there are several headers that need to be specified - fill in parenthesis below:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: (name of bundle)
Bundle-SymbolicName: (name of bundle)
Bundle-Version: (bundle version, you can use 1.0.0 to start)
Bundle-Activator: (activator class name, including package)
Bundle-ActivationPolicy: lazy
Import-Package: (list all external packages required by the bundle)
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: (put the class path within the bundle itself, e.g.: ., resources/, lib/xyz.jar)
Bundle-Description: (description of bundle)
Require-Bundle: (list all bundles required by this bundle)
Import-Package and Require-Bundle don't need to overlap, you can specify a requirement
in one or the other. To have a multi line header, start the continuation line after a blank in column 1.
Put a blank line at the end of the manifest.me file - due to a bug in felix.
The genometry and genoviz projects can by accessed as bundles (Require-Bundle), but the
IGB project is accessed through an interface, IGBService, itself a bundle.
If a class/method is needed from genometry/genoviz, it must be public, and the package
must be exported in the manifest.mf Export-Package list.
For access to IGB, this is done through the IGBService. If IGBService does not have a method
for what you need, it may need to be added to IGBService and IGBServiceImpl.
If you want to add a tab window as a bundle, there is a helper abstract class,
com.affymetrix.igb.window.service.WindowActivator, that you can extend.
If you need access to other bundles (like IGBService), you will not be sure when the
bundle is available. For Services, like IGBService and WindowService, you can use a
ServiceTracker to be notified when the required bundle is available - see WindowActivator
for an example.
To test the bundle, you can specify it as an optional bundle for IGB, by adding the jar
name to the pluginsOptionalList= entry in igb.properties.
Note - eclipse makes it a lot easier to develop bundles. You can create a new project
as a plug in project, and it will give you wizards, etc. for development. see:
http://www.vogella.de/articles/OSGi/article.html
To create plug-ins using eclipse,
...