...
Strategy | Options | Pros | Cons | Note |
---|---|---|---|---|
Build-time conversion | Using tools (such as maven-bundle-plugin) to convert plain jars into OSGi bundles |
|
| Maven Bundle Plugin: http://felix.apache.org/site/maven-bundle-plugin-bnd.html\\\\\\\\\\\\\\\\\\\\\\\\ Felix Commons: http://felix.apache.org/site/apache-felix-commons.html |
| Use already-converted 3rd party bundles from Spring DM, Felix Common or Eclipse Orbit |
| Not all 3rd party jars are available in OSGi bundles |
|
Runtime converstion | Before the jar is installed (BundleContext.installBundle()) |
|
|
|
| Add a hook to the OSGi runtime to wrap the jar (such as |
|
| Equinox Hooks: |
Hybrid conversion | Build-time will generate the META-INF/MANIFEST.MF as a side file |
|
|
|
...
3) It creates a single in-memory bundle for these regular JARs, in an Equinox BundleFileFactoryHook:
- export and import all their packages
- import * with a DynamicImport
- reference the JARs outside of the bundle in Bundle-classpath
That step is fast as it just writes a Manifest to a byte\[\] in memory, with no need to copy the JARs and re-package them, as the manifest
Wiki Markup
simply references their actual locations.
4) Bundle tuscany-extensibility-equinox contains a DynamicImport *, enabling ServiceDiscovery to access the 3rd party packages.
...
The above seems to work well in the following environments:
- an installed distro, JARs and bundles are loaded from the distro
- Maven surefire, classes are loaded from the Maven repos
- an Eclipse project, classes are loaded from the project's classpath
Build a distribution with the OSGi bundle layout
tuscany-sca
...modules
......tuscany-module.jar
...lib
......3rd-party-non-osgi
.........META-INF/MANIFEST.MF
.........3rd-party-non-osgi.jar
......3rd-party-osgi.jar
Tuscany OSGi Integration
Enable Tuscany runtime with OSGi (Use OSGi under the cover for Tuscany runtime or work with existing OSGi environment such as Eclipse RCP)
...