Class AbstractComponentManager<S>
java.lang.Object
org.apache.felix.scr.impl.manager.AbstractComponentManager<S>
- All Implemented Interfaces:
ComponentManager<S>
- Direct Known Subclasses:
ComponentFactoryImpl,SingleComponentManager
The default ComponentManager. Objects of this class are responsible for managing
implementation object's lifecycle.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ReentrantReadWriteLockprotected final ComponentContainer<S> protected final booleanFields inherited from interface org.apache.felix.scr.impl.manager.ComponentManager
STATE_ACTIVE, STATE_DISPOSED, STATE_SATISFIED, STATE_UNSATISFIED_CONFIGURATION, STATE_UNSATISFIED_REFERENCE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods) The constructor receives both the container and the methods.protectedAbstractComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods, boolean factoryInstance) The constructor receives both the container and the methods. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancollectDependencies(ComponentContextImpl<S> componentContext) Collect and store in m_dependencies_map all the services for dependencies, outside of any locks.protected static Dictionary<String, Object> Copies the properties from thesourceDictionaryinto thetargetDictionaryexcept for private properties (whose name has a leading dot) which are only copied if theallPropsparameter istrue.protected static Dictionary<String, Object> copyToDictionary(Dictionary<String, ?> source, boolean allProps) copyToMap(Dictionary<String, ?> source, boolean allProps) Copies the properties from thesourceDictionaryinto thetargetDictionaryexcept for private properties (whose name has a leading dot) which are only copied if theallPropsparameter istrue.protected abstract voiddeleteComponent(int reason) final org.osgi.util.promise.Promise<Void> disable(boolean async) voiddispose(int reason) Disposes off this component deactivating and disabling it first as required.final org.osgi.util.promise.Promise<Void> enable(boolean async) org.osgi.framework.BundleReturns theBundleproviding this component.abstract voidlonggetId()protected String[]List<? extends ReferenceManager<S, ?>> final org.osgi.framework.ServiceReference<S> Returns the subset of component properties to be used as service properties.protected org.osgi.framework.ServiceRegistration<S> intbooleanprotected booleanabstract voidreconfigure(Map<String, Object> configuration, boolean configurationDeleted, TargetedPID factoryPid) protected booleanRegisters the service on behalf of the component.voidSet the activation failure reasonabstract voidsetServiceProperties(Dictionary<String, ?> serviceProperties) voidsetServiceProperties(MethodResult methodResult, Integer trackingCount) toString()protected booleanprotected boolean
-
Field Details
-
m_container
-
m_factoryInstance
protected final boolean m_factoryInstance -
m_activationLock
-
-
Constructor Details
-
AbstractComponentManager
protected AbstractComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods) The constructor receives both the container and the methods.- Parameters:
container- The component containercomponentMethods- The component methods
-
AbstractComponentManager
protected AbstractComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods, boolean factoryInstance) The constructor receives both the container and the methods.- Parameters:
container- The component containercomponentMethods- The component methodsfactoryInstance- Flag whether this is a factory instance
-
-
Method Details
-
enable
-
disable
-
dispose
public void dispose(int reason) Disposes off this component deactivating and disabling it first as required. After disposing off the component, it may not be used anymore.This method unlike the other state change methods immediately takes action and disposes the component. The reason for this is, that this method has to actually complete before other actions like bundle stopping may continue.
-
getId
public long getId()- Specified by:
getIdin interfaceComponentManager<S>
-
getBundle
public org.osgi.framework.Bundle getBundle()Returns theBundleproviding this component. If the component as already been disposed off, this method returnsnull. -
isImmediate
protected boolean isImmediate() -
isFactory
public boolean isFactory() -
deleteComponent
protected abstract void deleteComponent(int reason) -
getProvidedServices
-
registerService
protected boolean registerService()Registers the service on behalf of the component. -
unregisterService
protected boolean unregisterService() -
getServiceRegistration
-
collectDependencies
Collect and store in m_dependencies_map all the services for dependencies, outside of any locks.- Parameters:
componentContext- possible instance key for prototype scope references- Returns:
- true if all references can be collected, false if some dependency is no longer available.
-
getActivator
-
getLogger
-
toString
-
verifyDependencyManagers
protected boolean verifyDependencyManagers() -
getReferenceManagers
- Specified by:
getReferenceManagersin interfaceComponentManager<S>
-
getProperties
- Specified by:
getPropertiesin interfaceComponentManager<S>
-
setServiceProperties
-
getServiceProperties
Returns the subset of component properties to be used as service properties. These properties are all component properties where property name does not start with dot (.), properties which are considered private. -
copyTo
protected static Dictionary<String,Object> copyTo(Dictionary<String, Object> target, Map<String, ?> source, boolean allProps) Copies the properties from thesourceDictionaryinto thetargetDictionaryexcept for private properties (whose name has a leading dot) which are only copied if theallPropsparameter istrue.- Parameters:
target- TheDictionaryinto which to copy the properties. Ifnulla newHashtableis created.source- TheDictionaryproviding the properties to copy. Ifnullor empty, nothing is copied.allProps- Whether all properties (true) or only the public properties (false) are to be copied.- Returns:
- The
targetis returned, which may be empty ifsourceisnullor empty andtargetwasnullor all properties are private and had not to be copied
-
copyToMap
Copies the properties from thesourceDictionaryinto thetargetDictionaryexcept for private properties (whose name has a leading dot) which are only copied if theallPropsparameter istrue.- Parameters:
source- TheDictionaryproviding the properties to copy. Ifnullor empty, nothing is copied.allProps- Whether all properties (true) or only the public properties (false) are to be copied.- Returns:
- The
targetis returned, which may be empty ifsourceisnullor empty andtargetwasnullor all properties are private and had not to be copied
-
copyToDictionary
protected static Dictionary<String,Object> copyToDictionary(Dictionary<String, ?> source, boolean allProps) -
getComponentMetadata
-
getSpecState
public int getSpecState()- Specified by:
getSpecStatein interfaceComponentManager<S>
-
getFailureReason
- Specified by:
getFailureReasonin interfaceComponentManager<S>
-
setFailureReason
Set the activation failure reason- Parameters:
e- The exception which caused the activation to fail
-
setServiceProperties
-
reconfigure
public abstract void reconfigure(Map<String, Object> configuration, boolean configurationDeleted, TargetedPID factoryPid) -
getComponentManagers
-
getRegisteredServiceReference
- Specified by:
getRegisteredServiceReferencein interfaceComponentManager<S>
-