Class SingleComponentManager<S>
java.lang.Object
org.apache.felix.scr.impl.manager.AbstractComponentManager<S>
org.apache.felix.scr.impl.manager.SingleComponentManager<S>
- All Implemented Interfaces:
ComponentManager<S>, org.osgi.framework.ServiceFactory<S>
- Direct Known Subclasses:
ServiceFactoryComponentManager
public class SingleComponentManager<S>
extends AbstractComponentManager<S>
implements org.osgi.framework.ServiceFactory<S>
The default ComponentManager. Objects of this class are responsible for managing
implementation object's lifecycle.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceTheSetImplementationObjectinterface provides an API for component managers to setup the implementation object and potentially other parts as part of thecreateImplementationObject(Bundle, SingleComponentManager.SetImplementationObject, ComponentContextImpl)method processing.Nested classes/interfaces inherited from class AbstractComponentManager
AbstractComponentManager.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ComponentContextImpl<S> private Dictionary<String, Object> private final AtomicIntegerFields inherited from class AbstractComponentManager
m_activationLock, m_container, m_factoryInstance, REASONS, registrationManagerFields inherited from interface ComponentManager
STATE_ACTIVE, STATE_DISPOSED, STATE_SATISFIED, STATE_UNSATISFIED_CONFIGURATION, STATE_UNSATISFIED_REFERENCE -
Constructor Summary
ConstructorsConstructorDescriptionSingleComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods) The constructor receives both the activator and the metadataSingleComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods, boolean factoryInstance) -
Method Summary
Modifier and TypeMethodDescription(package private) voidclear()(package private) voidprivate booleancreateComponent(ComponentContextImpl<S> componentContext) protected ScreateImplementationObject(org.osgi.framework.Bundle usingBundle, SingleComponentManager.SetImplementationObject<S> setter, ComponentContextImpl<S> componentContext) protected voiddeleteComponent(int reason) protected voiddisposeImplementationObject(ComponentContextImpl<S> componentContext, int reason) org.osgi.service.component.ComponentInstance<S> voidprivate SGet the object that is implementing this descriptorReturns the (private copy) of the Component properties to be used for the ComponentContext as well as eventual service registration.private SgetService(ComponentContextImpl<S> componentContext) getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<S> serviceRegistration) (package private) booleangetServiceInternal(org.osgi.framework.ServiceRegistration<S> serviceRegistration) Returns the subset of component properties to be used as service properties.(package private) final org.osgi.framework.ServiceReference<S> protected org.osgi.framework.ServiceRegistration<S> (package private) <T> voidinvokeBindMethod(DependencyManager<S, T> dependencyManager, RefPair<S, T> refPair, int trackingCount) protected MethodResult(package private) <T> voidinvokeUnbindMethod(DependencyManager<S, T> dependencyManager, RefPair<S, T> oldRefPair, int trackingCount) (package private) <T> booleaninvokeUpdatedMethod(DependencyManager<S, T> dependencyManager, RefPair<S, T> refPair, int trackingCount) Invoke updated methodprivate booleanprivate booleanmodify(boolean configurationDeleted) (package private) void(package private) void(package private) voidreconfigure(boolean configurationDeleted) voidreconfigure(Map<String, Object> configuration, boolean configurationDeleted, TargetedPID factoryPid) Called by the Configuration Admin Service to update the component with Configuration properties.(package private) voidprivate booleanservicePropertiesMatches(org.osgi.framework.ServiceRegistration<S> reg, Dictionary<String, Object> props) Checks if the given service registration properties matches another set of properties.protected voidsetFactoryProperties(Dictionary<String, ?> dictionary) voidsetServiceProperties(Dictionary<String, ?> serviceProperties) voidungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<S> serviceRegistration, S o) (package private) voidprivate voidMethods inherited from class AbstractComponentManager
activateInternal, collectDependencies, copyTo, copyToDictionary, copyToMap, deactivateInternal, disable, disableInternal, dispose, dispose, dumpThreads, enable, enableInternal, enableLatchWait, getActivator, getBundle, getBundleContext, getComponentMetadata, getComponentMethods, getDependencyManager, getDependencyManagers, getFailureReason, getId, getLockTimeout, getLogger, getProvidedServices, getReferenceManagers, getRegisteredServiceReference, getReversedDependencyManagers, getSpecState, getState, getTrackingCount, isFactory, isImmediate, isStateLocked, notifyWaiters, obtainActivationReadLock, obtainActivationWriteLock, obtainStateLock, registerMissingDependency, registerService, releaseActivationReadLock, releaseActivationWriteeLock, releaseStateLock, setFailureReason, setServiceProperties, setState, toString, tracked, unregisterService, updateTargets, verifyDependencyManagers, waitForTracked
-
Field Details
-
m_useCount
-
m_componentContext
-
m_configurationProperties
-
m_factoryProperties
-
m_properties
-
m_serviceProperties
-
-
Constructor Details
-
SingleComponentManager
public SingleComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods) The constructor receives both the activator and the metadata- Parameters:
componentMethods-
-
SingleComponentManager
public SingleComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods, boolean factoryInstance)
-
-
Method Details
-
clear
void clear()- Overrides:
clearin classAbstractComponentManager<S>
-
createComponent
-
deleteComponent
protected void deleteComponent(int reason) - Specified by:
deleteComponentin classAbstractComponentManager<S>
-
clearServiceProperties
void clearServiceProperties() -
getComponentInstance
-
getInstance
Get the object that is implementing this descriptor- Returns:
- the object that implements the services
-
createImplementationObject
protected S createImplementationObject(org.osgi.framework.Bundle usingBundle, SingleComponentManager.SetImplementationObject<S> setter, ComponentContextImpl<S> componentContext) -
disposeImplementationObject
-
invokeBindMethod
<T> void invokeBindMethod(DependencyManager<S, T> dependencyManager, RefPair<S, T> refPair, int trackingCount) - Specified by:
invokeBindMethodin classAbstractComponentManager<S>
-
invokeUpdatedMethod
<T> boolean invokeUpdatedMethod(DependencyManager<S, T> dependencyManager, RefPair<S, T> refPair, int trackingCount) Description copied from class:AbstractComponentManagerInvoke updated method- Specified by:
invokeUpdatedMethodin classAbstractComponentManager<S>- Returns:
trueif the component needs reactivation,falseotherwise.
-
invokeUnbindMethod
<T> void invokeUnbindMethod(DependencyManager<S, T> dependencyManager, RefPair<S, T> oldRefPair, int trackingCount) - Specified by:
invokeUnbindMethodin classAbstractComponentManager<S>
-
setFactoryProperties
-
registerComponentId
void registerComponentId()- Overrides:
registerComponentIdin classAbstractComponentManager<S>
-
unregisterComponentId
void unregisterComponentId()- Overrides:
unregisterComponentIdin classAbstractComponentManager<S>
-
getProperties
Returns the (private copy) of the Component properties to be used for the ComponentContext as well as eventual service registration. Method implements the Component Properties provisioning as described in 112.6, Component Properties.- Specified by:
getPropertiesin interfaceComponentManager<S>- Specified by:
getPropertiesin classAbstractComponentManager<S>- Returns:
- a private map of component properties
-
setServiceProperties
- Specified by:
setServicePropertiesin classAbstractComponentManager<S>
-
postRegister
void postRegister()- Specified by:
postRegisterin classAbstractComponentManager<S>
-
preDeregister
void preDeregister()- Specified by:
preDeregisterin classAbstractComponentManager<S>
-
getServiceProperties
Description copied from class:AbstractComponentManagerReturns 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.- Overrides:
getServicePropertiesin classAbstractComponentManager<S>
-
getServiceReference
-
getServiceRegistration
- Overrides:
getServiceRegistrationin classAbstractComponentManager<S>
-
updateServiceRegistration
private void updateServiceRegistration() -
reconfigure
public void reconfigure(Map<String, Object> configuration, boolean configurationDeleted, TargetedPID factoryPid) Called by the Configuration Admin Service to update the component with Configuration properties. This causes the component to be reactivated with the new configuration unless no configuration has ever been set on this component and theconfigurationparameter isnull. In this case nothing is to be done. If a configuration has previously been set and now the configuration is deleted, theconfigurationparameter isnulland the component has to be reactivated with the default configuration.- Specified by:
reconfigurein classAbstractComponentManager<S>- Parameters:
configuration- The configuration properties for the component from the Configuration Admin Service ornullif there is no configuration or if the configuration has just been deleted.configurationDeleted- TODOfactoryPid- TODO
-
reconfigure
void reconfigure(boolean configurationDeleted) -
modify
private boolean modify(boolean configurationDeleted) -
invokeModifiedMethod
-
servicePropertiesMatches
private boolean servicePropertiesMatches(org.osgi.framework.ServiceRegistration<S> reg, Dictionary<String, Object> props) Checks if the given service registration properties matches another set of properties.- Parameters:
reg- the service registration whose service properties will be compared to the props parameterprops- the properties to be compared with the registration service properties.- Returns:
trueif the registration service properties equals the prop properties, false if not.
-
getService
-
getServiceInternal
- Overrides:
getServiceInternalin classAbstractComponentManager<S>
-
getService
-
ungetService
-
keepInstances
private boolean keepInstances() -
getComponentManagers
- Specified by:
getComponentManagersin classAbstractComponentManager<S>
-