> > In the case of RSA's registration of a ServiceFactory (for creating > proxies of a remote service), the service type (Class) is not even > loaded. It's only actually loaded when the > ServiceFactory.getService(Bundle...) is called later. So in this > case, how can the framework compare the types (since no Classes have > actually been loaded at this point)?
The framework does not need to compare the actual types. It just needs to know that both bundles refer to the same package containing the type. For example, one imports the package from the other or both import the package from the same exporter. If this is true, then for all types in the package, both bundles will see the same types. > Right. But given that a ServiceFactory is registered (by the > distribution system on RSA.importService), and the service types > haven't been loaded, how could/should it pass? As mentioned above, it could pass because both bundle are wired to the same package containing the type. > But in this case (RSA.importService) I think that assumption is > violated...because the bundle that implements the service factory > (RSA impl) is not the same bundle that registered the service (i.e. > the topology manager impl...i.e. org.eclipse.ecf.osgi.services.distribution). Then you need to make sure that the client bundles and the bundle registering service are both wired to the same type. The bundle implementing service factory must also have visibility to the same type. In your case, with dynamic proxy generate, you can supply an appropriate class loader. > Right...but I guess I don't understand who any/either bundle can be > wired to the service type...since with a ServiceFactory the service > type classes haven't even been necessarily loaded. I understand in > the typical (local) case the service classes have at least been > loaded prior to the ServiceFactory registration, but in this case/ > RSA they haven't been. But you need to make it so (as Captain Picard would say). > > I suppose that prior to the proxy ServiceFactory registration, I > could load the service type classes by the topology manager > bundle...would that allow the necessary checks to succeed? The bundle requesting the service (client) and the bundle registering the service must be wired to the same type. Furthermore, if the service factory is implemented by a 3rd bundle, that bundle must also have visibility to the same type. -- BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance [email protected] office: +1 386 848 1781 mobile: +1 386 848 3788
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
