org.apache.felix.framework

## Class ServiceRegistry

- java.lang.Object
- - org.apache.felix.framework.ServiceRegistry

    public class ServiceRegistry
    extends Object

### Nested Class Summary

Nested Classes
`static interface` `ServiceRegistry.ServiceRegistryCallbacks`

### Constructor Summary

Constructors
Constructor and Description
`ServiceRegistry(Logger logger, ServiceRegistry.ServiceRegistryCallbacks callbacks)`

### Method Summary

All Methods Instance Methods Concrete Methods
`HookRegistry` `getHookRegistry()`
`Logger` `getLogger()`
`ServiceReference<?>[]` `getRegisteredServices(Bundle bundle)` Get all service references for a bundle
`<S> S` `getService(Bundle bundle, ServiceReference<S> ref, boolean isServiceObjects)`
`Collection<Capability>` `getServiceReferences(String className, SimpleFilter filter)`
`ServiceReference<?>[]` `getServicesInUse(Bundle bundle)`
`Bundle[]` `getUsingBundles(ServiceReference<?> ref)`
`ServiceRegistration<?>` `registerService(Bundle bundle, String[] classNames, Object svcObj, Dictionary<?,?> dict)` Register a new service Caller must fire service event as this method is not doing it!
`boolean` `ungetService(Bundle bundle, ServiceReference<?> ref, Object svcObj)`
`void` `ungetServices(Bundle bundle)` This is a utility method to release all services being used by the specified bundle.
`void` `unregisterService(Bundle bundle, ServiceRegistration<?> reg)` Unregister a service
`void` `unregisterServices(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 ServiceReference<?>[] getRegisteredServices(Bundle bundle)

Get all service references for a bundle

Parameters:
  `bundle` -
Returns:
  List with all valid service references or `null`.

#### registerService

    public ServiceRegistration<?> registerService(Bundle bundle,
                                                  String[] classNames,
                                                  Object svcObj,
                                                  Dictionary<?,?> dict)

Register a new service Caller must fire service event as this method is not doing it!

Parameters:
  `bundle` - The bundle registering the service
  `classNames` - The service class names
  `svcObj` - The service object
  `dict` - Optional service properties
Returns:
  Service registration

#### unregisterService

    public void unregisterService(Bundle bundle,
                                  ServiceRegistration<?> reg)

Unregister a service

Parameters:
  `bundle` - The bundle unregistering the service
  `reg` - The service registration

#### unregisterServices

    public void unregisterServices(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 Collection<Capability> getServiceReferences(String className,
                                                       SimpleFilter filter)

#### getServicesInUse

    public ServiceReference<?>[] getServicesInUse(Bundle bundle)

#### getService

    public <S> S getService(Bundle bundle,
                            ServiceReference<S> ref,
                            boolean isServiceObjects)

#### ungetService

    public boolean ungetService(Bundle bundle,
                                ServiceReference<?> ref,
                                Object svcObj)

#### ungetServices

    public void ungetServices(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 Bundle[] getUsingBundles(ServiceReference<?> ref)

#### getLogger

    public Logger getLogger()

#### getHookRegistry

    public HookRegistry getHookRegistry()