dev@glassfish.java.net

Re: [v3] exporting all Metro packages for OSGi

From: Craig L Russell <Craig.Russell_at_Sun.COM>
Date: Thu, 21 Aug 2008 13:45:23 -0700

On Aug 21, 2008, at 1:21 PM, Bill Shannon wrote:

> Craig L Russell wrote:
>> Apropos of:
>>> We already had to export a lot of supposedly private packages that
>>> contained classes that were looked up through META-INF/services.
>> I'm interested in the answer to this question:
>> If an OSGi-enabled jar file has an entry in META-INF/services/foo
>> and the contents of the file foo is com.sun.fooservice.Foofactory,
>> does com.sun.fooservice have to be exported?
>
> I'm curious too. I assume the answer is "yes".
>
> Or at least it's a "should", if not a "must".

Ok, I'm of the opinion that if the service is self-contained in the
jar file, and all of its dependencies are listed as imports, then the
implementation class should not (best practice) be exported. This
preserves encapsulation since only the ServiceLoader needs to know
anything about the package.

By the way is there any interaction between ServiceLoader and OSGi? (I
know, RTFM ;-)

Here's what Richard Hall has to offer, which I agree with:
> It depends on how you want to use it, but I would say no. It only
> has to be on the Bundle-ClassPath, so you should be able to load it
> from the bundle's class loader, which is the main requirement.
>
> -> richard
>

Craig
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>

Craig L Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!