Community
Participate
Working Groups
Today PDE makes the assumption that plugin == bundle. While this is true there are some aspects of the plugin project creation wizard which are specific to the Eclipse runtime. It is relatively easy to workaround some of these Eclipse specific things, but ... It would be nice to have an option to create an "OSGi" project for developing bundles which can run on the Eclipse implementation of the OSGi Framework without core.runtime or on other implementations of the OSGi Framework. What I propose is adding an option to the plugin creation wizard to specify that you want to create a "plain" OSGi bundle. One possiblity is to add some options under the "Plug-in Format". Right now there is a checkbox "Create OSGi bundle manifest". Maybe this could be expanded into three radio options - No OSGi bundle manifest This is equal to unselecting the old "Create OSGi bundle manifest". - Create an OSGi bundle manifest for the Eclipse runtime This is equal to selecting the old "Create OSGi bundle manifest". - Create an OSGi bundle manifest This would create a "plain" OSGi bundle project I'm not sure what the correct wording would be for the different options. The "Create an OSGi bundle manifest for the Eclipse runtime" option would be selected by default. If "Create an OSGi bundle manifest" is selected then the "Plug-in Class" section in the next panel would have "Generate the Java class that controls the plug-in's life cycle" option selected. But the option "This plug-in will make contributions to the UI" would be unselected AND greyed out or not present for selection at all. There would be no Next panel for templates unless we start shipping some "plain" OSGi bundle templates. The generated plug-in life cycle class would implement the interface org.osgi.framework.BundleActivator and would not extend any class. The generated bundle manifest file should also have the following Import-Package statement: Import-Package: org.osgi.framework
questions/comments: 1. Generating the bundle activator class is currently optional. If the new "plain" OSGi bundle manifest is selected, will the bundle activator class be required? 2. When we create the manifest.mf during the plug-in project creation process, PDE creates a plugin.xml and passes it through the runtime converter. This results in a file that contains the Eclipse-AutoStart header. I presume PDE would now manually remove that header. Also, PDE would now have to insert the Import-Package header since the converter does not do that.
Answers to comment 1: 1. The Activator class is always optional, even with "plain" bundles. Currently the default for plug-in projects is to create an Activator. This should also be the case for "plain" bundle projects. 2. Yes, "plain" bundle projects should NOT have Eclipse-AutoStart header. For the Import-Package header, I assume this would be handled the same way you automatically add Require-Bundle headers for UI plug-ins. I guess this is a bit different since you probably added ui dependencies to the plugin.xml before the conversion.
Janek, please take care of the UI side of things and I will do the codegen portion.
There are a number of things too look at in making PDE more pure wrt OSGi. For example, if the user says that this bundle/project is just OSGi, then the wizards should perhaps offer no or different templates. The Extensions/Extension point tabs should be hidden etc. I'm all for this.
Janek, the UI and codegen for the first two pages of the wizard are released to HEAD. Please go ahead with a Hello World template for pure bundles. You could make a template out of the bundle provided by Tom in bug 106395 comment 1.
New Features added: - The plug-in project creation wizard now has the option of creating plain OSGi bundles. - A simple hello world OSGi template is included. Thomas, if you have any working pure bundles that would be suitable for templates please provide the sample code and we will turn them into templates. Thanks
CC'ing Pierre to see if he is has any simple OSGi sample bundles that he would like to contribute as a template.
When I use the Hello World template the Start and Stop messages seem to get swapped in the start/stop methods of the generated bundle activator. You said Goodbye before you even said Hello. (sounds like a bad country song :)
Created attachment 26493 [details] goodbye hello fix Wassim, if you could please correct my blunder by committing this patch.
patch applied. thanks Janek. Now we really need an OSGi app launcher. Stay tuned for bug 106395.