org.apache.felix.framework
Class ServiceRegistry

java.lang.Object
  extended by org.apache.felix.framework.ServiceRegistry

public class ServiceRegistry
extends java.lang.Object


Nested Class Summary
static interface ServiceRegistry.ServiceRegistryCallbacks
           
 
Constructor Summary
ServiceRegistry(Logger logger, ServiceRegistry.ServiceRegistryCallbacks callbacks)
           
 
Method Summary
 java.util.List getEventHooks()
           
 Logger getLogger()
           
 org.osgi.framework.ServiceReference[] getRegisteredServices(org.osgi.framework.Bundle bundle)
           
 java.lang.Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceReference ref)
           
 java.util.List getServiceReferences(java.lang.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, java.lang.String[] classNames, java.lang.Object svcObj, java.util.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceRegistry

public ServiceRegistry(Logger logger,
                       ServiceRegistry.ServiceRegistryCallbacks callbacks)
Method Detail

getRegisteredServices

public org.osgi.framework.ServiceReference[] getRegisteredServices(org.osgi.framework.Bundle bundle)

registerService

public org.osgi.framework.ServiceRegistration registerService(org.osgi.framework.Bundle bundle,
                                                              java.lang.String[] classNames,
                                                              java.lang.Object svcObj,
                                                              java.util.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 java.util.List getServiceReferences(java.lang.String className,
                                           org.osgi.framework.Filter filter)

getServicesInUse

public org.osgi.framework.ServiceReference[] getServicesInUse(org.osgi.framework.Bundle bundle)

getService

public java.lang.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 java.util.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.


Copyright © 2011. All Rights Reserved.