public class EquinoxLauncher extends Object
Given a directory containing osgi jars, this class verifies that the core bundles are available, and provides an API for instantiating the OSGi runtime and accessing its BundleContext
.
See setProps(Map)
for precise details on the default framework properties.
Modifier and Type | Class and Description |
---|---|
class |
EquinoxLauncher.Running
Represents a running instance of the equinox OSGi container.
|
Constructor and Description |
---|
EquinoxLauncher(File installationRoot)
Wraps a directory of jars in the launcher API, and ensures the the directory contains the plugins required to run a barebones equinox instance.
|
Modifier and Type | Method and Description |
---|---|
EquinoxLauncher.Running |
open()
Opens the eclipse runtime, and returns an instance of
EquinoxLauncher.Running which allows access to the underlying BundleContext . |
void |
run()
Runs the equinox launcher (calls
open() and immediately closes it). |
EquinoxLauncher |
setArgs(List<String> args)
Sets the application arguments which will be passed to the runtime.
|
EquinoxLauncher |
setProps(Map<String,String> props)
Sets the system properties which will be set on the runtime.
|
public EquinoxLauncher(File installationRoot)
Wraps a directory of jars in the launcher API, and ensures the the directory contains the plugins required to run a barebones equinox instance.
public EquinoxLauncher setArgs(List<String> args)
Sets the application arguments which will be passed to the runtime.
public EquinoxLauncher setProps(Map<String,String> props)
Sets the system properties which will be set on the runtime.
Available options here.
This should usually not need to be set. Below are the default properties. To unset one of the defaults, set its value to the empty string and it will be cleared.
map.put("osgi.framework.useSystemProperties", "false");
map.put("osgi.install.area", <installation root>);
map.put("osgi.noShutdown", "false");
// enable
map.put("equinox.use.ds", "true");
map.put("osgi.bundles", Joiner.on(", ").join(
// automatic bundle discovery and installation
"org.eclipse.equinox.common@2:start",
"org.eclipse.update.configurator@3:start",
// support eclipse's -application argument
"org.eclipse.core.runtime@4:start",
// declarative services
"org.eclipse.equinox.ds@5:start"));
map.put(EclipseStarter.PROP_FRAMEWORK, <path to plugin "org.eclipse.osgi">);
public EquinoxLauncher.Running open() throws Exception
Opens the eclipse runtime, and returns an instance of EquinoxLauncher.Running
which allows access to the underlying BundleContext
.
Exception