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

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.DelayedComponentManager
All Implemented Interfaces:
Component, ServiceFactory

public class DelayedComponentManager
extends ImmediateComponentManager
implements ServiceFactory

The DelayedComponentManager 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
DelayedComponentManager(BundleComponentActivator activator, ComponentHolder componentHolder, ComponentMetadata metadata)
           
 
Method Summary
protected  boolean createComponent()
          Method is called by #activate() in STATE_ACTIVATING or by getService(Bundle, ServiceRegistration) in STATE_REGISTERED.
protected  boolean createRealComponent()
           
protected  void deleteComponent(int reason)
           
protected  Object getService()
          Returns the service object to be registered if the service element is specified.
 Object getService(Bundle bundle, ServiceRegistration sr)
          Creates a new service object.
 void ungetService(Bundle bundle, ServiceRegistration sr, Object service)
          Releases a service object.
 
Methods inherited from class org.apache.felix.scr.impl.manager.ImmediateComponentManager
createImplementationObject, disposeImplementationObject, getComponentInstance, 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

DelayedComponentManager

public DelayedComponentManager(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 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(int reason)
Overrides:
deleteComponent in class ImmediateComponentManager

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 sr)
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.
sr - 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)

createRealComponent

protected boolean createRealComponent()

ungetService

public void ungetService(Bundle bundle,
                         ServiceRegistration sr,
                         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.
sr - 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)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.