Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 107489 - Need an option to create a simple OSGi project
Summary: Need an option to create a simple OSGi project
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.2 M2   Edit
Assignee: Janek Lasocki-Biczysko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 106188
  Show dependency tree
 
Reported: 2005-08-19 18:51 EDT by Thomas Watson CLA
Modified: 2005-08-28 00:33 EDT (History)
4 users (show)

See Also:


Attachments
goodbye hello fix (1.20 KB, patch)
2005-08-25 17:59 EDT, Janek Lasocki-Biczysko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2005-08-19 18:51:17 EDT
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
Comment 1 Wassim Melhem CLA 2005-08-21 22:24:25 EDT
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.
Comment 2 Thomas Watson CLA 2005-08-22 09:43:27 EDT
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.
Comment 3 Wassim Melhem CLA 2005-08-23 11:27:01 EDT
Janek, please take care of the UI side of things and I will do the codegen 
portion.
Comment 4 Jeff McAffer CLA 2005-08-24 11:20:03 EDT
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.
Comment 5 Wassim Melhem CLA 2005-08-25 08:48:15 EDT
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.
Comment 6 Janek Lasocki-Biczysko CLA 2005-08-25 16:34:58 EDT
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
Comment 7 Thomas Watson CLA 2005-08-25 17:08:42 EDT
CC'ing Pierre to see if he is has any simple OSGi sample bundles that he would 
like to contribute as a template.
Comment 8 Thomas Watson CLA 2005-08-25 17:44:14 EDT
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 :)
Comment 9 Janek Lasocki-Biczysko CLA 2005-08-25 17:59:13 EDT
Created attachment 26493 [details]
goodbye  hello fix

Wassim, if you could please correct my blunder by committing this patch.
Comment 10 Wassim Melhem CLA 2005-08-25 22:37:30 EDT
patch applied.  thanks Janek.

Now we really need an OSGi app launcher.  Stay tuned for bug 106395.