public abstract class AbstractComponentManager<S> extends Object implements ComponentManager<S>
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractComponentManager.State |
Modifier and Type | Field and Description |
---|---|
protected ReentrantReadWriteLock |
m_activationLock |
protected ComponentContainer<S> |
m_container |
protected boolean |
m_factoryInstance |
STATE_ACTIVE, STATE_DISPOSED, STATE_SATISFIED, STATE_UNSATISFIED_CONFIGURATION, STATE_UNSATISFIED_REFERENCE
Modifier | Constructor and Description |
---|---|
protected |
AbstractComponentManager(ComponentContainer<S> container,
ComponentMethods<S> componentMethods)
The constructor receives both the container and the methods.
|
protected |
AbstractComponentManager(ComponentContainer<S> container,
ComponentMethods<S> componentMethods,
boolean factoryInstance)
The constructor receives both the container and the methods.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
collectDependencies(ComponentContextImpl<S> componentContext)
Collect and store in m_dependencies_map all the services for dependencies, outside of any locks.
|
protected static Dictionary<String,Object> |
copyTo(Dictionary<String,Object> target,
Map<String,?> source,
boolean allProps)
Copies the properties from the
source Dictionary
into the target Dictionary except for private
properties (whose name has a leading dot) which are only copied if the
allProps parameter is true . |
protected static Dictionary<String,Object> |
copyToDictionary(Dictionary<String,?> source,
boolean allProps) |
protected static Map<String,Object> |
copyToMap(Dictionary<String,?> source,
boolean allProps)
Copies the properties from the
source Dictionary
into the target Dictionary except for private
properties (whose name has a leading dot) which are only copied if the
allProps parameter is true . |
protected abstract void |
deleteComponent(int reason) |
org.osgi.util.promise.Promise<Void> |
disable(boolean async) |
void |
dispose(int reason)
Disposes off this component deactivating and disabling it first as
required.
|
org.osgi.util.promise.Promise<Void> |
enable(boolean async) |
ComponentActivator |
getActivator() |
org.osgi.framework.Bundle |
getBundle()
Returns the
Bundle providing this component. |
abstract void |
getComponentManagers(List<AbstractComponentManager<S>> cms) |
ComponentMetadata |
getComponentMetadata() |
String |
getFailureReason() |
long |
getId() |
ComponentLogger |
getLogger() |
abstract Map<String,Object> |
getProperties() |
protected String[] |
getProvidedServices() |
List<? extends ReferenceManager<S,?>> |
getReferenceManagers() |
org.osgi.framework.ServiceReference<S> |
getRegisteredServiceReference() |
Dictionary<String,Object> |
getServiceProperties()
Returns the subset of component properties to be used as service
properties.
|
protected org.osgi.framework.ServiceRegistration<S> |
getServiceRegistration() |
int |
getSpecState() |
boolean |
isFactory() |
protected boolean |
isImmediate() |
abstract void |
reconfigure(Map<String,Object> configuration,
boolean configurationDeleted,
TargetedPID factoryPid) |
protected boolean |
registerService()
Registers the service on behalf of the component.
|
void |
setFailureReason(Throwable e)
Set the activation failure reason
|
abstract void |
setServiceProperties(Dictionary<String,?> serviceProperties) |
void |
setServiceProperties(MethodResult methodResult,
Integer trackingCount) |
String |
toString() |
protected boolean |
unregisterService() |
protected boolean |
verifyDependencyManagers() |
protected final ComponentContainer<S> m_container
protected final boolean m_factoryInstance
protected final ReentrantReadWriteLock m_activationLock
protected AbstractComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods)
container
- The component containercomponentMethods
- The component methodsprotected AbstractComponentManager(ComponentContainer<S> container, ComponentMethods<S> componentMethods, boolean factoryInstance)
container
- The component containercomponentMethods
- The component methodsfactoryInstance
- Flag whether this is a factory instancepublic final org.osgi.util.promise.Promise<Void> enable(boolean async)
public final org.osgi.util.promise.Promise<Void> disable(boolean async)
public void dispose(int reason)
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.
public long getId()
getId
in interface ComponentManager<S>
public org.osgi.framework.Bundle getBundle()
Bundle
providing this component. If the
component as already been disposed off, this method returns
null
.protected boolean isImmediate()
public boolean isFactory()
protected abstract void deleteComponent(int reason)
protected String[] getProvidedServices()
protected boolean registerService()
protected boolean unregisterService()
protected org.osgi.framework.ServiceRegistration<S> getServiceRegistration()
protected boolean collectDependencies(ComponentContextImpl<S> componentContext)
componentContext
- possible instance key for prototype scope referencespublic ComponentActivator getActivator()
public ComponentLogger getLogger()
protected boolean verifyDependencyManagers()
public List<? extends ReferenceManager<S,?>> getReferenceManagers()
getReferenceManagers
in interface ComponentManager<S>
public abstract Map<String,Object> getProperties()
getProperties
in interface ComponentManager<S>
public abstract void setServiceProperties(Dictionary<String,?> serviceProperties)
public Dictionary<String,Object> getServiceProperties()
protected static Dictionary<String,Object> copyTo(Dictionary<String,Object> target, Map<String,?> source, boolean allProps)
source
Dictionary
into the target
Dictionary
except for private
properties (whose name has a leading dot) which are only copied if the
allProps
parameter is true
.target
- The Dictionary
into which to copy the
properties. If null
a new Hashtable
is
created.source
- The Dictionary
providing the properties to
copy. If null
or empty, nothing is copied.allProps
- Whether all properties (true
) or only the
public properties (false
) are to be copied.target
is returned, which may be empty if
source
is null
or empty and
target
was null
or all properties are
private and had not to be copiedprotected static Map<String,Object> copyToMap(Dictionary<String,?> source, boolean allProps)
source
Dictionary
into the target
Dictionary
except for private
properties (whose name has a leading dot) which are only copied if the
allProps
parameter is true
.source
- The Dictionary
providing the properties to
copy. If null
or empty, nothing is copied.allProps
- Whether all properties (true
) or only the
public properties (false
) are to be copied.target
is returned, which may be empty if
source
is null
or empty and
target
was null
or all properties are
private and had not to be copiedprotected static Dictionary<String,Object> copyToDictionary(Dictionary<String,?> source, boolean allProps)
public ComponentMetadata getComponentMetadata()
public int getSpecState()
getSpecState
in interface ComponentManager<S>
public String getFailureReason()
getFailureReason
in interface ComponentManager<S>
public void setFailureReason(Throwable e)
e
- The exception which caused the activation to failpublic void setServiceProperties(MethodResult methodResult, Integer trackingCount)
public abstract void reconfigure(Map<String,Object> configuration, boolean configurationDeleted, TargetedPID factoryPid)
public abstract void getComponentManagers(List<AbstractComponentManager<S>> cms)
public final org.osgi.framework.ServiceReference<S> getRegisteredServiceReference()
getRegisteredServiceReference
in interface ComponentManager<S>
Copyright © 2006–2020 The Apache Software Foundation. All rights reserved.