org.apache.felix.framework
Class ServiceRegistry
Object
org.apache.felix.framework.ServiceRegistry
public class ServiceRegistry
- extends Object
Method Summary |
List |
getEventHooks()
|
Logger |
getLogger()
|
org.osgi.framework.ServiceReference[] |
getRegisteredServices(org.osgi.framework.Bundle bundle)
|
Object |
getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
|
List |
getServiceReferences(String className,
org.osgi.framework.Filter filter)
|
org.osgi.framework.ServiceReference[] |
getServicesInUse(org.osgi.framework.Bundle bundle)
|
org.osgi.framework.Bundle[] |
getUsingBundles(org.osgi.framework.ServiceReference ref)
|
void |
invokeHook(org.osgi.framework.ServiceReference ref,
org.osgi.framework.launch.Framework framework,
InvokeHookCallback callback)
Invokes a Service Registry Hook |
org.osgi.framework.ServiceRegistration |
registerService(org.osgi.framework.Bundle bundle,
String[] classNames,
Object svcObj,
Dictionary dict)
|
boolean |
ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
|
void |
ungetServices(org.osgi.framework.Bundle bundle)
This is a utility method to release all services being
used by the specified bundle. |
void |
unregisterService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration reg)
|
void |
unregisterServices(org.osgi.framework.Bundle bundle)
This method retrieves all services registrations for the specified
bundle and invokes ServiceRegistration.unregister() on each
one. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServiceRegistry
public ServiceRegistry(Logger logger,
ServiceRegistry.ServiceRegistryCallbacks callbacks)
getRegisteredServices
public org.osgi.framework.ServiceReference[] getRegisteredServices(org.osgi.framework.Bundle bundle)
registerService
public org.osgi.framework.ServiceRegistration registerService(org.osgi.framework.Bundle bundle,
String[] classNames,
Object svcObj,
Dictionary dict)
unregisterService
public void unregisterService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration reg)
unregisterServices
public void unregisterServices(org.osgi.framework.Bundle bundle)
- This method retrieves all services registrations for the specified
bundle and invokes ServiceRegistration.unregister() on each
one. This method is only called be the framework to clean up after
a stopped bundle.
- Parameters:
bundle
- the bundle whose services should be unregistered.
getServiceReferences
public List getServiceReferences(String className,
org.osgi.framework.Filter filter)
getServicesInUse
public org.osgi.framework.ServiceReference[] getServicesInUse(org.osgi.framework.Bundle bundle)
getService
public Object getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
ungetService
public boolean ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceReference ref)
ungetServices
public void ungetServices(org.osgi.framework.Bundle bundle)
- This is a utility method to release all services being
used by the specified bundle.
- Parameters:
bundle
- the bundle whose services are to be released.
getUsingBundles
public org.osgi.framework.Bundle[] getUsingBundles(org.osgi.framework.ServiceReference ref)
getLogger
public Logger getLogger()
getEventHooks
public List getEventHooks()
invokeHook
public void invokeHook(org.osgi.framework.ServiceReference ref,
org.osgi.framework.launch.Framework framework,
InvokeHookCallback callback)
- Invokes a Service Registry Hook
- Parameters:
ref
- The ServiceReference associated with the hook to be invoked, the hook
service object will be obtained through this object.framework
- The framework that is invoking the hook, typically the Felix object.callback
- This is a callback object that is invoked with the actual hook object to
be used, either the plain hook, or one obtained from the ServiceFactory.