felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Enrique Rodriguez <enriqu...@gmail.com>
Subject Re: Using ServiceTracker
Date Tue, 15 Nov 2005 10:45:42 GMT
John E. Conlon wrote:
> On Fri, 2005-11-11 at 02:18, Enrique Rodriguez wrote:
...
>>In the same way that you are importing 'log' you also need to import 
>>'tracker' and since you are using an Activator you'll need 'framework', too.
> 
> Up to this point I have not imported org.osgi.framework and finding the
> BundleActivator worked okay (When I did not use the tracker that is, -
> when I just 'manually managed my services.)
> Explicitly importing the org.osgi.framework and org.osgi.util.* classes
> seems counter-intuitive, (of course I'm a beginner still coming up to
> speed.) But one would think all the framework classes should be
> accessible on the parent classloader. Or at least I did with framework.

Did BJ's explanation make sense?  This is core OSGi philosophy.  By 
requiring the bundle to import what it needs, it can even use a 
different framework version from the framework it is running on.

> I made the change you recommended and now I get:
> [  12] [Installed  ] [    1] My OSGi Felix Experiment 1 (1.0-SNAPSHOT)
> -> start 12
> org.osgi.framework.BundleException: Unresolved package in bundle 12:
> org.osgi.util.tracker

Perfect.  Now we're at Long Answer #2, where we need to get bundlized 
and Mavenized OSGi jars out there.  In other words, your import is now 
working but there's no corresponding export.

>>Long Answer:
...
> Is the ant right? Or should the org.osgi.util.tracker package be
> included in the osgi.jar? If it was I would expect to find the
> ServiceTracker as it's in the latest src tree and it jar up very easily
> with a <include name="org/osgi/util/**"/> added to the jar command.
...
>>2)  The jars coming from OSGi Alliance aren't bundlized, so even if you 
>>were importing the right packages, and you had the OSGi jars 
>>installed/started, they wouldn't be exporting what you need.  I think 
>>what we should do is create a wrapper project here at Felix to re-wrap 
>>the OSGi jars as bundles and to work with Maven 2.
> 
> What is the difference between the org.osgi.util.tracker.ServiceTracker
> in the <felix home>/lib/osgi.jar and the one that is in 
>   <artifactId>org.osgi.compendium</artifactId>
>           <version>4.0</version>
> Why two different jars?

The presence of the OSGi classes in the Felix framework is largely a 
leftover from when Felix R4 started development.  Up until mid-October 
(when R4 was released) we had to obtain the draft R4 EPL'd sources and 
check them into our SVN.  The R4 jars are now released from the OSGi 
Alliance.  This is an example of "make it work" and now we need to "make 
it work right."  The correct way to import the OSGi packages will be 
from the bundlized OSGi jars and we'll work soon to clean up the 
framework in SVN.  So, no, we won't start include'ing more service or 
util packages, we'll work to remove packages in SVN that shouldn't be there.

Enrique

Mime
View raw message