Equinox OSGi
Eclipse shipped with the Equinox runtime in its IDE package. To use the OSGi console, simply type in command line:
java -jar plugins/org.eclipse.equinox.launcher_1.0.0.v20070208a.jar
The minimum requirement for the OSGi runtime is the org.eclipse.osgi bundle. To run Equinox in the self plug-in discovery mode (like the one for Eclipse IDE where plug-ins are automatically discovered under /plugins directory), we will need the following setups:
- Includes org.eclipse.equinox.common, org.eclipse.update.configurator, org.eclipse.core.runtime and their dependencies in the plugins sub-directory
- Includes the config.ini file in the configuration sub-directory
- Use the eclipse or eclipsec executable as the launcher
Dependencies
- org.eclipse.osgi
- org.eclipse.osgi.services
- org.eclipse.osgi.util (optional)
- org.eclipse.update.configurator (plug-in discovery)
- org.eclipse.equinox.launcher (OS specific runtime, assume the present of org.eclipse.core.runtime)
- org.eclipse.equinox.launcher.win32.win32.x86 (OS specific)
- org.eclipse.equinox.common
- org.eclipse.equinox.registry
- org.eclipse.equinox.preferences
- org.eclipse.core.job
- org.eclipse.core.contenttype
- org.eclipse.equinox.app
- javax.servlet
- org.eclipse.core.runtime
- org.eclipse.core.runtime.compatibility.auth
config.ini file
Put the following code in config.ini
osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.core.runtime@start osgi.bundles.defaultStartLevel=4
Launcher
Copy eclipse or eclipsec executable and eclipse.ini into the current directory. Add "-console" to eclipse.ini. Also add -Declipse.ignoreApp=true and -Dosgi.noShutdown=true as vmargs in eclipse.ini.
Adding HTTP server support
To add HTTP server support in Equinox, two plugins (and their dependencies) are required:
- org.eclipse.equinox.http.registry (extension)
- org.eclipse.equinox.http.jetty (server)
Since we are aiming to mix Spring-DM with Equniox, some treatments have been done on the bundle dependencies for logging (due to class loading problem in commons logging with Spring-DM). Basically, we swap org.apache.commons.logging to the implementation from jcl104.over.slf4j. Spring DM provides SLF4J bundles, but it causes problem like cyclic dependency (slf4j + slf4j-log4j12, see: http://dev.eclipse.org/newslists/news.eclipse.technology.equinox/msg03928.html) and incompatibility issue with commons logging. To fix this, we use the latest binary from slf4j website. The rest of dependencies for HTTP server support are:
- org.mortbay.jetty
- org.eclipse.equinox.http.servlet
- jcl104-over-slf4j-1.5.0 (replacement for org.apache.commons.logging)
- slf4j-api-1.5.0 (SLF4J)
- slf4j-log4j12-1.5.0 (SLF4J)
- org.springframework.osgi.log4j.osgi (Spring)
To enable HTTP server and Equinox's HTTP registry, append org.eclipse.equinox.http.registry@start,org.eclipse.equinox.http.jetty@start to osgi.bundles in config.ini
Adding Spring Support
The following bundles are required:
- org.springframework.bundle.osgi.extender (xml context file scanner)
- org.springframework.bundle.spring.core
- org.springframework.bundle.spring.beans
- org.springframework.bundle.spring.context
- org.springframework.bundle.spring.aop
- org.springframework.osgi.aopalliance.osgi
- org.springframework.osgi.backport-util-concurrent.osgi
- org.springframework.bundle.osgi.core
- org.springframework.bundle.osgi.io
Also add org.springframework.bundle.osgi.extender@3:start (start before org.eclipse.core.runtime) and org.springframework.bundle.spring.core@start to config.ini. For Equinox to resolve the bundle symbolic name, the the spring-osgi-extender-<version>.jar needs to be renamed to org.springframework.bundle.osgi.extender_<version>.jar. Otherwise use the fullname instead of symbolic name in config.ini
References
Starting Eclipse Commandline With Equinox Launcher: http://wiki.eclipse.org/Starting_Eclipse_Commandline_With_Equinox_Launcher
Equinox Launcher: http://wiki.eclipse.org/Equinox_Launcher
Equinox Launcher Plan: http://wiki.eclipse.org/Equinox_Launcher_Plan
Spring OSGi bundle requirements: http://static.springframework.org/osgi/docs/1.0.2/reference/html/app-deploy.html (section 4.2)
