Using Common Services APIs in Stand Alone Mode
It is possible to run the common service APIs in stand alone mode. One should first note that the common service runtime is based on a plug-in development paradigm. These plug-ins are managed by several OSGI services implemented in the Equinox project. Therefore, before calling any of the common service APIs in stand alone mode the OSGI services should be started. For convenience a helper class called org.eclipse.tptp.platform.common.provisional.OSGIStarter is provided to start up the OSGI services. One would use this helper class as follows:
-
Create an instance of the OSGIStarter.
-
Start the OSGI services.
-
Call the common service APIs.
-
Shutdown the OSGI services.
The following code snippet illustrates this workflow.
1
|
OSGIStarter osgiLauncher = new OSGIStarter( ); |
2
|
osgiLauncher.startup( "C:\driver\eclipse", null ); |
3
|
.... |
4
|
osgiLauncher.shutdown() |
1. Create an instance of the OSGIStarter
org.eclipse.tptp.platform.common.provisional.OSGIStarter is a helper class that provides methods to start and shutdown the OSGI services.
2. Start up the OSGI services
The startup method takes in a directory location containing the plug-ins directory and configuration directory. The plug-ins directory contains the list of plug-ins The configuration directory contains the config.ini file. The config.ini file contains a list of plug-ins that will be loaded when the OSGI services start. To run in stand alone mode the content of the config.ini file should be as follows:
#Product Runtime Configuration File
eclipse.product=org.eclipse.tptp.platform.lta.la.core.ServicesSDK
osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.jobs@2:start,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.registry@2:start,org.eclipse.equinox.preferences@2:start,org.eclipse.core.contenttype,org.eclipse.core.runtime@2:start,org.eclipse.update.configurator@3:start,com.ibm.icu,org.eclipse.tptp.platform.lta.la.core@2:start
osgi.bundles.defaultStartLevel=4
Note one can configure how the plug-ins are loaded by modifying this file. Refer to the
Equinox home page for information how to configure this file.
3. Call the common service APIs
After starting the OSGI services the common service APIs can be called to import, export log files, symptom catalogs, correlate, analyze log files, etc.
4. Shutdown OSGI services
Once done the OSGI services should be shutdown.