org.eclipse.equinox.log.internal
Class ExtendedLogServiceFactory

java.lang.Object
  extended by org.eclipse.equinox.log.internal.ExtendedLogServiceFactory
All Implemented Interfaces:
java.util.EventListener, BundleListener, ServiceFactory<ExtendedLogService>

public class ExtendedLogServiceFactory
extends java.lang.Object
implements ServiceFactory<ExtendedLogService>, BundleListener


Constructor Summary
ExtendedLogServiceFactory(ExtendedLogReaderServiceFactory logReaderServiceFactory)
           
 
Method Summary
 void bundleChanged(BundleEvent event)
          Receives notification that a bundle has had a lifecycle change.
 ExtendedLogServiceImpl getService(Bundle bundle, ServiceRegistration<ExtendedLogService> registration)
          Creates a new service object.
 void ungetService(Bundle bundle, ServiceRegistration<ExtendedLogService> registration, ExtendedLogService service)
          Releases a service object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedLogServiceFactory

public ExtendedLogServiceFactory(ExtendedLogReaderServiceFactory logReaderServiceFactory)
Method Detail

getService

public ExtendedLogServiceImpl getService(Bundle bundle,
                                         ServiceRegistration<ExtendedLogService> registration)
Description copied from interface: ServiceFactory
Creates a new service object.

The Framework invokes this method the first time the specified bundle requests a service object using the BundleContext.getService(ServiceReference) method. The service factory can then return a specific service object for each bundle.

The Framework must check that the returned service object is valid. If the returned service object is null or is not an instanceof all the classes named when the service was registered, a framework event of type FrameworkEvent.ERROR is fired containing a service exception of type ServiceException.FACTORY_ERROR and null is returned to the bundle. If this method throws an exception, a framework event of type FrameworkEvent.ERROR is fired containing a service exception of type ServiceException.FACTORY_EXCEPTION with the thrown exception as the cause and null is returned to the bundle. If this method is recursively called for the specified bundle, a framework event of type FrameworkEvent.ERROR is fired containing a service exception of type ServiceException.FACTORY_RECURSION and null is returned to the bundle.

The Framework caches the valid service object and will return the same service object on any future call to BundleContext.getService for the specified bundle. This means the Framework must not allow this method to be concurrently called for the specified bundle.

Specified by:
getService in interface ServiceFactory<ExtendedLogService>
Parameters:
bundle - The bundle requesting the service.
registration - The ServiceRegistration object for the requested service.
Returns:
A service object that must be an instance of all the classes named when the service was registered.
See Also:
BundleContext.getService(org.osgi.framework.ServiceReference)

ungetService

public void ungetService(Bundle bundle,
                         ServiceRegistration<ExtendedLogService> registration,
                         ExtendedLogService service)
Description copied from interface: ServiceFactory
Releases a service object.

The Framework invokes this method when a service has been released by a bundle. The service object may then be destroyed.

If this method throws an exception, a framework event of type FrameworkEvent.ERROR is fired containing a service exception of type ServiceException.FACTORY_EXCEPTION with the thrown exception as the cause.

Specified by:
ungetService in interface ServiceFactory<ExtendedLogService>
Parameters:
bundle - The bundle releasing the service.
registration - The ServiceRegistration object for the service being released.
service - The service object returned by a previous call to the getService method.
See Also:
BundleContext.ungetService(org.osgi.framework.ServiceReference)

bundleChanged

public void bundleChanged(BundleEvent event)
Description copied from interface: BundleListener
Receives notification that a bundle has had a lifecycle change.

Specified by:
bundleChanged in interface BundleListener
Parameters:
event - The BundleEvent.


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.