« Return to Thread: More flexibility in the OSGi manifest headers

Re: More flexibility in the OSGi manifest headers

by James Lemieux :: Rate this Message:

Reply to Author | View in Thread

Hey Barend,

   OSGi support was done by me working in conjunction with Bruce Alspaugh I believe. I believe he was using it in an Eclipse RCP app, and so the way we worked was:

1) I modified our build system
2) Bruce tested it in his environment
3) repeat 1) and 2) until it seemed to do everything we needed

I'm not even close to an OSGi expert. And I've never used Eclipse (always IDEA).

I have no problems making the changes you require as long as they are compatible for use in the Eclipse RCP environment. (Since OSGi is actually a standalone spec, I'll assume that this is an easy assumption).

Bruce, if you're still lurking out there, would you be willing to retest the GL jar within an Eclipse RCP once again after we've made these changes?

Barend, please file a bug  in the GL issue tracker so this work isn't lost for any reason.

James

On Wed, Sep 10, 2008 at 12:48 PM, W.B. Garvelink <barend.garvelink@...> wrote:
Hi,



The CVS HEAD version of GlazedLists_java15, when built, contains these OSGi
headers:

> Require-Bundle: org.eclipse.swt,org.eclipse.jface
> Export-Package: (all packages; "impl" packages with an "x-internal:=true"
> directive.)

While these headers are probably the quickest way to make Glazed Lists work in
an Eclipse environment, they actually prohibit its use in any other OSGi
environment. My requirements at work are to use GlazedLists/Swing inside the
Apache Felix container. I simply use a modified manifest file there, but I'd
like to suggest a more comprehensive OSGi manifest here, which should give the
necessary flexibility to run Glazed Lists in any OSGi environment with either
GUI toolkit.

There are three ingredients to making this work:

 1) Use of "Import-Package:" instead of "Require-Bundle", which wires against
   the Java packages instead of the Bundle-SymbolicName of their provider.
   (please see [1] for background info)
 2) Use of "Import-Package: <package>;resolution:=optional", for specifying
   dependencies that get resolved during bundle resolution ("deployment", to
       oversimplify), but which won't cause resolution to fail if they're absent.
 3) Use of "DynamicImport-Package", for specifying packages that aren't
   resolved until the first time any of its classes is loaded.

The tricky bit is that I'm fairly new to OSGi myself and I have no experience
developing for the Eclipse platform. I've tried out the manifest I'm proposing
in Apache Felix and Java Swing, but I'd appreciate it if someone could test it
in an Eclipse Equinox and SWT container.

I've used the bnd tool (see [2]) to get the dependencies, then manually added
"resolution:=optional" directives where appropriate. It's possible to include
bnd into the build script instead of using a hand-kept manifest, but I haven't
taken it that far. One of the things bnd can does that I haven't is to specify
transitive dependencies on the imports ("uses" directive).

I'd appreciate it if you would consider using this more comprehensive OSGi
manifest instead of the one you have now. I think it may be worthwhile to
split the distribution into glazedlists-swt and glazedlists-swing, both would
be simpler and the two GUI toolkits are unlikely to be used in conjunction.

My proposed manifest file (actually just the import and export statements) is
at the end of this email. If you want me to, I can create a ticket in the
issue tracker and attach it there.

Thanks,
Barend

[1] http://www.osgi.org/blog/2008/06/jsr-277-and-import-package.html
[2] http://www.aqute.biz/Code/Bnd


==============================================================================
Export-Package: ca.odell.glazedlists;version=1.7.0,
 ca.odell.glazedlists.calculation;version=1.7.0,
 ca.odell.glazedlists.event;version=1.7.0,
 ca.odell.glazedlists.gui;version=1.7.0,
 ca.odell.glazedlists.hibernate;version=1.7.0,
 ca.odell.glazedlists.io;version=1.7.0,
 ca.odell.glazedlists.jfreechart;version=1.7.0,
 ca.odell.glazedlists.matchers;version=1.7.0,
 ca.odell.glazedlists.nachocalendar;version=1.7.0,
 ca.odell.glazedlists.swing;version=1.7.0,
 ca.odell.glazedlists.swt;version=1.7.0,
 ca.odell.glazedlists.util.concurrent;version=1.7.0,
 ca.odell.glazedlists.util.reflect;version=1.7.0,
 resources.aqua;version=1.7.0,
 resources.metal;version=1.7.0,
 resources.ocean;version=1.7.0,
 resources.windows;version=1.7.0,
 resources.windowsxp;version=1.7.0
Private-Package: ca.odell.glazedlists.impl,
 ca.odell.glazedlists.impl.adt,
 ca.odell.glazedlists.impl.adt.barcode2,
 ca.odell.glazedlists.impl.adt.gnutrove,
 ca.odell.glazedlists.impl.beans,
 ca.odell.glazedlists.impl.ctp,
 ca.odell.glazedlists.impl.event,
 ca.odell.glazedlists.impl.filter,
 ca.odell.glazedlists.impl.functions,
 ca.odell.glazedlists.impl.gui,
 ca.odell.glazedlists.impl.io,
 ca.odell.glazedlists.impl.matchers,
 ca.odell.glazedlists.impl.nio,
 ca.odell.glazedlists.impl.pmap,
 ca.odell.glazedlists.impl.rbp,
 ca.odell.glazedlists.impl.sort,
 ca.odell.glazedlists.impl.swing,
 ca.odell.glazedlists.impl.swt,
 ca.odell.glazedlists.impl.text
Import-Package: ca.odell.glazedlists,
 ca.odell.glazedlists.calculation,
 ca.odell.glazedlists.event,
 ca.odell.glazedlists.gui,
 ca.odell.glazedlists.io,
 ca.odell.glazedlists.jfreechart,
 ca.odell.glazedlists.matchers,
 ca.odell.glazedlists.swing,
 ca.odell.glazedlists.swt,
 ca.odell.glazedlists.util.concurrent,
 ca.odell.glazedlists.util.reflect,
 javax.accessibility;resolution:=optional,
 javax.swing;resolution:=optional,
 javax.swing.border;resolution:=optional,
 javax.swing.event;resolution:=optional,
 javax.swing.plaf;resolution:=optional,
 javax.swing.plaf.basic;resolution:=optional,
 javax.swing.plaf.metal;resolution:=optional,
 javax.swing.table;resolution:=optional,
 javax.swing.text;resolution:=optional,
 javax.swing.tree;resolution:=optional,
 javax.swing.undo;resolution:=optional,
 org.eclipse.jface.viewers;resolution:=optional,
 org.eclipse.swt.events;resolution:=optional,
 org.eclipse.swt.graphics;resolution:=optional,
 org.eclipse.swt.layout;resolution:=optional,
 org.eclipse.swt.widgets;resolution:=optional,
 com.ibm.icu.text;resolution:=optional,
 com.jgoodies.forms.layout;resolution:=optional,
 com.publicobject.issuesbrowser;resolution:=optional,
 com.publicobject.misc;resolution:=optional,
 de.kupzog.ktable;resolution:=optional,
 net.sf.nachocalendar;resolution:=optional,
 net.sf.nachocalendar.components;resolution:=optional,
 org.hibernate;resolution:=optional,
 org.hibernate.collection;resolution:=optional,
 org.hibernate.engine;resolution:=optional,
 org.hibernate.persister.collection;resolution:=optional,
 org.hibernate.usertype;resolution:=optional,
 org.jdesktop.swingx;resolution:=optional,
 org.jdesktop.swingx.decorator;resolution:=optional,
 org.jdesktop.swingx.table;resolution:=optional,
 org.jfree.data;resolution:=optional,
 org.jfree.data.category;resolution:=optional,
 org.jfree.data.general;resolution:=optional

==============================================================================
(Don't forget that blank line at the end of manifest.mf)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


 « Return to Thread: More flexibility in the OSGi manifest headers