org.eclipse.osgi.framework.adaptor
Interface ServiceRegistry


public interface ServiceRegistry

The ServiceRegistry interface is used by the framework to store and lookup currently registered services.

Clients may implement this interface.

Since:
3.1

Method Summary
 ServiceReference[] lookupServiceReferences(BundleContext context)
          Performs a lookup for ServiceReferences that are bound to this ServiceRegistry using the specified BundleContext.
 ServiceReference[] lookupServiceReferences(java.lang.String clazz, Filter filter)
          Performs a lookup for ServiceReferences that are bound to this ServiceRegistry.
 void publishService(BundleContext context, ServiceRegistration serviceReg)
          Publishes a service to this ServiceRegistry.
 void unpublishService(BundleContext context, ServiceRegistration serviceReg)
          Unpublishes a service from this ServiceRegistry
 void unpublishServices(BundleContext context)
          Unpublishes all services from this ServiceRegistry that the specified BundleContext registered.
 

Method Detail

publishService

void publishService(BundleContext context,
                    ServiceRegistration serviceReg)
Publishes a service to this ServiceRegistry.

Parameters:
context - the BundleContext that registered the service.
serviceReg - the ServiceRegistration to register.

unpublishService

void unpublishService(BundleContext context,
                      ServiceRegistration serviceReg)
Unpublishes a service from this ServiceRegistry

Parameters:
context - the BundleContext that registered the service.
serviceReg - the ServiceRegistration to unpublish.

unpublishServices

void unpublishServices(BundleContext context)
Unpublishes all services from this ServiceRegistry that the specified BundleContext registered.

Parameters:
context - the BundleContext to unpublish all services for.

lookupServiceReferences

ServiceReference[] lookupServiceReferences(java.lang.String clazz,
                                           Filter filter)
Performs a lookup for ServiceReferences that are bound to this ServiceRegistry. If both clazz and filter are null then all bound ServiceReferences are returned.

Parameters:
clazz - A fully qualified class name. All ServiceReferences that reference an object that implement this class are returned. May be null.
filter - Used to match against published Services. All ServiceReferences that match the filter are returned. If a clazz is specified then all ServiceReferences that match the clazz and the filter parameter are returned. May be null.
Returns:
An array of all matching ServiceReferences or null if none exist.

lookupServiceReferences

ServiceReference[] lookupServiceReferences(BundleContext context)
Performs a lookup for ServiceReferences that are bound to this ServiceRegistry using the specified BundleContext.

Parameters:
context - The BundleContext to lookup the ServiceReferences on.
Returns:
An array of all matching ServiceReferences or null if none exist.