OSGI component support in Service Creation
This wiki is aiming to discuss how to support users to develop OSGI based service component in STP.
Johnson Ma, Dec 27, 2007
- 1 Introduction
- 2 Existing OSGI tooling
- 3 Requirements for OSGI tooling from Service Creation point for view
- 4 How to create a OSGI service component
- 5 How to deploy OSGI component to runtime
- 6 How to test and debug
- 7 OSGI Console in eclipse
- 8 User Scenarios
- 9 Spring metadata editor
- 10 Tasks List
As more and more Middleware servers becomes OSGI based. We need to support users to create service component in the format of OSGI bundle following the Service Oriented Approach.
Existing OSGI tooling
PDE OSGI tooling support
"Eclipse PDE UI also provides comprehensive OSGi tooling, which makes it an ideal environment for component programming, not just Eclipse plug-in development."
Apache Felix integration with Eclipse
Felix integration with eclipse from felix site, is a solution to integrate Felix with Eclipse IDE by
*Check out felix projects into Eclipse workspace *Add the felix.jar to java project's classpath *Create java launch config to run org.apache.felix.main
Spring OSGI Eclipse integration
Requirements for OSGI tooling from Service Creation point for view
*Replaceable OSGI runtime:Should define extension point to locate osgi runtime *Easy dependency configuration::Help user to setup dependencies to existing bundle/service loaded in the runtime *Manifest Editor: user friendly manifest editor following OSGI spec. Try to reuse the Manifest editor from PDE here. *Run and Debug support:: *OSGI Console support: should show the osgi console in eclipse
How to create a OSGI service component
Setup an extension point for users to assign osgi runtime to a osgi bundle project.
OSGI Bundle project wizard
In the current Eclipse env, users can create Elipse plugin or osgi bundle project from one PDE project wizard. IMHO, it will be better if we provide dedicated project wizard, such as project wizard to create "ServiceMix OSGI bundle".
Helping users to configure:
*bundle dependencies *classpath exporting *osgi properties in manifest file
We will reuse the Manifest editor from PDE here with some customization.
When users click the 'Add...' button, the default behavior for PDE will list all plugins under eclipse/plugins dir.
We need to change to show all the bundles installed in the selected OSGI runtime.
How to deploy OSGI component to runtime
There maybe two ways for the deployment:
- Extending the WTP server framework for osgi runtime
- or extending the PDE osgi.frameworks
I prefer the WTP based solution. since it can be better integrated with SOAS in stp.
Deploy to WTP server
*Define a WTP server extension for OSGI runtime (ServiceMix for example) *Users can start/stop the runtime from WTP server view *Deploy user created osgi bundle to the server
Deploy using PDE?
Create a new osgi framework extension. The following example will create a new Apache Felix OSGI framework in eclipse
<plugin> <extension point="org.eclipse.pde.ui.osgiFrameworks"> <framework id="org.eclipse.stp.sc.osgi.FelixFramework" initializer="org.eclipse.stp.sc.internal.osgi.launcher.FelixInitializer" launcherDelegate="org.eclipse.stp.sc.osgi.felix.FelixLaunchConfiguration" name="Felix OSGI Framework"> </framework> </extension> </plugin>
Preference for OSGI Framework
Windows->Preference->Plugin Development->OSGI Framworks will list all supported runtime. You can see the Apache Felix OSGI implementation we just added
OSGI Framework launch configuration
Create launch configuration under Run>OSGI framework.
How to test and debug
Users can follow steps below to debug the osgi component:
*Setup breakpoint from java source editor *Deploy to osgi server as mentioned above *Start the osgi server in debug mode as below.
OSGI Console in eclipse
Since we are starting ServiceMix using WTP server framework. The OSGI console should show in Eclipse console view. Then users can send commands, such as ss, start, stop, shutdown...etc.
Below is the console view for Eclipse Equinox, Apache Felix console should show in the similar way.
Spring metadata editor
The ServiceMix runtime is based on the Spring framework. We should looking into how to help users to create spring configuration --- a Spring metadata editor. (reuse editor from SpringIDE?)
In the end, let's summarize the tasks suggested by this wiki: (Since the ServiceMix 4.0 is not released yet. we can build the OSGI tooling base on the Spring runtime for now. It shouldn't take much effort to support ServiceMix runtime later on.)
|1||WTP Server extension for ServiceMix 4.0||to support start/stop osgi runtime within eclipse|
|2||Project Wizard to create "ServiceMix OSGI Bundle"||or just create any osgi bundle?|
|3||OSGI Runtime Extension Point|| *Unless the current runtime extension, we need to get bundles installed instead of jars for classpath:
|4||PDE Manifest Editor customization||Let users to setup dependency according to the selected osgi runtime|
|5||OSGI Facet?||Do we need to define OSGI Facet?|
|6||Spring Metadata Editor||To editor Spring configuration files. Reuse the editor from SpringIDE?|