On May 12, 2008, at 12:06 , Saminda Abeyruwan wrote:
Assume service "SA" has being registered in bundle A. There exist
another
bundle B, which would attempt to unregister the service "SA".
Bundle A
should be the only place where service "SA" being registered or
unregistered. Would it be possible to apply a policy in bundle A to
say
that. Any help will be utmost appreciated.
To unregister a service, you need a reference to the service
registration you got back when registering it. So, unless you
explicitly pass that on from bundle A to B, you cannot do what you
describe.
When saying stuff like "bundle A should be the only place where..."
you're going into the security layer of OSGi. Yes, you can typically
do things like that when you run with OSGi security enabled. Look at
the ConditionalPermissionAdmin service for ideas on how to do that.
Greetings, Marcel