> 
> That is only about creating the actual service object and of course 
> it must implement the exact service type. 
> 
> But while the framework cares about that, it also cares about the 
> bundle whose context was used to register the service. Does that 
> bundle have visibility to the exact service type of the service? The
> framework will make that check before it bothers to call the service
> factory object. 
> 
> What bundle registered the service which the client wants to obtain? 
> 
> The RemoteServiceAdmin.importService implementation (in our 
> org.eclipse.ecf.osgi.services.remoteserviceadmin bundle) registers 
> the ServiceFactory as part of the importService implementation.  The
> RemoteServiceAdmin itself is created via a service factory (i.e. by 
> a topology manager), and so the Bundle that has the TopologyManager 
> (and creates/gets the RemoteServiceAdmin service) is the one who's 
> context is used to register the ServiceFactory for the remote 
> service proxy creation.
> 
> For our 'BasicTopologyManager' it is in bundle 
> org.eclipse.ecf.osgi.services.distribution.
> 
> How do we assure that this bundle has visibility to any dynamically 
> discovered remote service interface type?  via Dynamic-ImportPackage
> or some such?

You could use dynamic import package but that has some drawbacks. First 
you would need to actually load the type(s) to force  the framework to 
establish the wires before you register the service. Second, you could 
only support one version of the package could be a big limitation. 

This is why I previously suggested dynamically creating, installing and 
starting a bundle which has the proper import package statement. This 
bundle does not need any classes in it. You just need an "anchor" to use 
for its class loader to access the types and for its context to register 
the service. The actual work can be done by your bundle. Make sure to 
properly uninstall this bundle when no longer necessary. There can be many 
of these bundles for different service types.

-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargr...@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to