# Equinox
Equinox (opens new window) is considered to be a reference implementation of the OSGi Core Release 8 (opens new window). It is an open source project (opens new window), part of the Eclipse project (opens new window). It provides a set of bundles, that implement various optional OSGi services.
The openHAB bundles are deployed on an Equinox runtime. Knowledge about how to start the runtime and execute basic commands will help you to speedup the development process.
# Start Equinox Runtime from Eclipse
Go to "Run" -> "Run Configurations".
From the list in the left panel choose "OSGi Framework". Right click on it and choose "New".
After you've been created a new configuration, select the bundles that you need from the workspace.
Then make sure that the following bundles from the target platform are selected, otherwise the OSGi console will not be available:
org.apache.felix.gogo.runtime org.apache.felix.gogo.shell org.apache.felix.gogo.command org.eclipse.equinox.console
Click on "Add Required Bundles". Eclipse will resolve all dependencies of the bundles listed above and include new bundles to the configuration.
Click on "Validate Bundles" and make sure that "No problems were detected" is displayed.
You can start Equinox with the "Run" button.
# Run Equinox from the command line
The org.eclipse.osgi bundle is the framework implementation of the Core Framework specification in a standalone package.
If you have compiled openHAB once either via command line (mvn install
) or the Eclipse IDE, Maven will have downloaded Equinox for you already.
Find it in your Maven cache directory (Linux ~/.m2/repository/org/eclipse/platform/org.eclipse.osgi/3.15.0/org.eclipse.osgi-3.15.0.jar
and Windows C:\Users\your.name\.m2\..
).
- Create
configuration
folder in that directory. - Inside the
configuration
folder create a fileconfig.ini
. - Save the following content in the
config.ini
file:
osgi.bundles=\
org.eclipse.core.runtime,\
org.eclipse.equinox.common,\
org.eclipse.core.jobs,\
org.eclipse.equinox.registry,\
org.eclipse.equinox.preferences,\
org.eclipse.core.contenttype,\
org.eclipse.equinox.app,\
org.eclipse.equinox.console,\
org.apache.felix.gogo.runtime,\
org.apache.felix.gogo.shell,\
org.apache.felix.gogo.command
eclipse.ignoreApp=true
eclipse.consoleLog=true
- Use the following command line to run Equinox:
java -jar org.eclipse.osgi-3.x.x.jar -console -configuration configuration
# Commands
Once you have Equinox running, you will see a prompt. Some of the basic OSGi commands are:
Command | Description |
---|---|
help | Basic command that will list all available commands |
install [bundle URL] | Installs the bundle from the given URL |
start [bundle # or bundle name] | Starts the bundle with the given numeric or symbolic id |
stop [bundle # or bundle name] | Stops the bundle with the given numeric or symbolic id |
ss | Reports a summary status of all installed bundles |
diag [bundle # or bundle name] | Reports any resolution problems for the bundle with the given numeric or symbolic id |
services [filter] | Lists all available services or only services matching to LDAP-style filter (opens new window) (e.g. services (objectClass="*virtage*") - will print only services having virtage in their class name) |
Table 1. Equinox commands (Source: https://www.eclipse.org/equinox/documents/quickstart-framework.php (opens new window))
# Equinox Bundles
Another part of the Equinox project is Equinox Bundles (opens new window). It consists of bundles that implement all add-on services from the OSGi specification and additional services defined in various OSGi expert groups.
Some of the core bundles are listed in the table below. Some or all of these bundles must be included in your runtime configuration, if you want to use the services that they provide.
Name | Bundle Symbolic Name | Description |
---|---|---|
Declarative Services | org.eclipse.equinox.ds | An implementation of the OSGi Declarative Services specification |
Event Admin Service | org.eclipse.equinox.event | OSGi Compendium Release 8 Event Admin (opens new window) Service provides an inter-bundle communication mechanism based on an event publish and subscribe model |
Equinox Utilities | org.eclipse.equinox.util | A library of utility classes that are frequently used from the Equinox OSGi Service implementation bundles |
OSGi Services API | org.eclipse.osgi.service | This bundle contains the set of OSGi specified service APIs |
Table 2. OSGi Bundles (Full list can be found at: https://www.eclipse.org/equinox/bundles/ (opens new window))
# Further Reading
- https://www.eclipse.org/equinox/ (opens new window)
- https://www.eclipse.org/equinox/bundles/ (opens new window)
- https://www.eclipse.org/equinox/documents/quickstart-framework.php (opens new window)
- https://www.eclipse.org/equinox/framework/ (opens new window)
- https://www.eclipse.org/equinox/incubator/ (opens new window)
- OSGiEquinoxExplained (opens new window)
- http://blog.idzona.com/2016/01/different-ways-to-start-the-eclipse-equinox-osgi-console.html (opens new window)
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=371101 (opens new window)
- https://www.eclipse.org/equinox/p2/ (opens new window)
- https://wiki.eclipse.org/Equinox_P2_Resolution (opens new window)
- https://wiki.eclipse.org/Equinox/p2/FAQ (opens new window)
- https://wiki.eclipse.org/Installable_Units (opens new window)
- Products and features (opens new window)
- Dependency Management for the Eclipse Ecosystem, Eclipse p2, metadata and resolution, Daniel Le Berre, Pascal Rapicault,2009 (opens new window)
- RT meets p2 (opens new window)