org.apache.felix.scr.impl.manager
Class ServiceFactoryComponentManager

java.lang.Object
  extended by org.apache.felix.scr.impl.manager.AbstractComponentManager
      extended by org.apache.felix.scr.impl.manager.ImmediateComponentManager
          extended by org.apache.felix.scr.impl.manager.ServiceFactoryComponentManager
All Implemented Interfaces:
Component, ServiceFactory

public class ServiceFactoryComponentManager
extends ImmediateComponentManager
implements ServiceFactory

The ServiceFactoryComponentManager TODO


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.felix.scr.impl.manager.AbstractComponentManager
AbstractComponentManager.Activating, AbstractComponentManager.Active, AbstractComponentManager.Deactivating, AbstractComponentManager.Disabled, AbstractComponentManager.Disabling, AbstractComponentManager.Disposed, AbstractComponentManager.Disposing, AbstractComponentManager.Enabling, AbstractComponentManager.Factory, AbstractComponentManager.FactoryInstance, AbstractComponentManager.Registered, AbstractComponentManager.Satisfied, AbstractComponentManager.State, AbstractComponentManager.Unsatisfied
 
Field Summary
 
Fields inherited from interface org.apache.felix.scr.Component
STATE_ACTIVATING, STATE_ACTIVE, STATE_DEACTIVATING, STATE_DESTROYED, STATE_DISABLED, STATE_DISABLING, STATE_DISPOSED, STATE_DISPOSING, STATE_ENABLED, STATE_ENABLING, STATE_FACTORY, STATE_REGISTERED, STATE_UNSATISFIED
 
Constructor Summary
ServiceFactoryComponentManager(BundleComponentActivator activator, ComponentHolder componentHolder, ComponentMetadata metadata)
           
 
Method Summary
protected  boolean createComponent()
          Method is called by #activate() in STATE_ACTIVATING or by DelayedComponentManager.getService(Bundle, ServiceRegistration) in STATE_REGISTERED.
protected  void deleteComponent()
           
 ComponentInstance getComponentInstance()
          Returns the org.osgi.service.component.ComponentInstance representing this component or null if this component is not been activated yet.
protected  Object getService()
          Returns the service object to be registered if the service element is specified.
 Object getService(Bundle bundle, ServiceRegistration registration)
          Creates a new service object.
 void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
          Releases a service object.
 
Methods inherited from class org.apache.felix.scr.impl.manager.ImmediateComponentManager
createImplementationObject, deleteComponent, disposeImplementationObject, getProperties, hasConfiguration, reconfigure, setFactoryProperties
 
Methods inherited from class org.apache.felix.scr.impl.manager.AbstractComponentManager
copyTo, copyTo, disable, dispose, enable, getActivate, getActivator, getBundle, getClassName, getComponentMetadata, getConfigurationPolicy, getDeactivate, getFactory, getId, getModified, getName, getReferences, getServiceProperties, getServices, getState, isActivateDeclared, isDeactivateDeclared, isDefaultEnabled, isImmediate, isLogEnabled, isServiceFactory, log, log, registerComponentService, registerService, state, toString, unregisterComponentService, verifyDependencyManagers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceFactoryComponentManager

public ServiceFactoryComponentManager(BundleComponentActivator activator,
                                      ComponentHolder componentHolder,
                                      ComponentMetadata metadata)
Parameters:
activator -
metadata -
Method Detail

createComponent

protected boolean createComponent()
Description copied from class: AbstractComponentManager
Method is called by #activate() in STATE_ACTIVATING or by DelayedComponentManager.getService(Bundle, ServiceRegistration) in STATE_REGISTERED.

Overrides:
createComponent in class ImmediateComponentManager
Returns:
true if creation of the component succeeded. If false is returned, the cause should have been logged.

deleteComponent

protected void deleteComponent()

getService

protected Object getService()
Description copied from class: ImmediateComponentManager
Returns the service object to be registered if the service element is specified.

Extensions of this class may overwrite this method to return a ServiceFactory to register in the case of a delayed or a service factory component.

Overrides:
getService in class ImmediateComponentManager
Returns:

getService

public Object getService(Bundle bundle,
                         ServiceRegistration 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 caches the value returned (unless it is null), and will return the same service object on any future call to BundleContext.getService for the same bundle. This means the Framework must not allow this method to be concurrently called for the same bundle.

The Framework will check if the returned service object is an instance of all the classes named when the service was registered. If not, then null is returned to the bundle.

Specified by:
getService in interface ServiceFactory
Parameters:
bundle - The bundle using the service.
registration - The ServiceRegistration object for the 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 registration,
                         Object 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.

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

getComponentInstance

public ComponentInstance getComponentInstance()
Description copied from interface: Component
Returns the org.osgi.service.component.ComponentInstance representing this component or null if this component is not been activated yet.

Specified by:
getComponentInstance in interface Component
Overrides:
getComponentInstance in class ImmediateComponentManager


Copyright © 2011 Apache Software Foundation. All Rights Reserved.