public class SingleComponentManager<S> extends AbstractComponentManager<S> implements org.osgi.framework.ServiceFactory<S>
Modifier and Type | Class and Description |
---|---|
protected static interface |
SingleComponentManager.SetImplementationObject<S>
The
SetImplementationObject interface provides an
API for component managers to setup the implementation object and
potentially other parts as part of the createImplementationObject(org.osgi.framework.Bundle, org.apache.felix.scr.impl.manager.SingleComponentManager.SetImplementationObject<S>, org.apache.felix.scr.impl.manager.ComponentContextImpl<S>) method
processing. |
AbstractComponentManager.State
Modifier and Type | Field and Description |
---|---|
private ComponentContextImpl<S> |
m_componentContext |
private java.util.Map<java.lang.String,java.lang.Object> |
m_configurationProperties |
private java.util.Map<java.lang.String,java.lang.Object> |
m_factoryProperties |
private java.util.Map<java.lang.String,java.lang.Object> |
m_properties |
private java.util.Dictionary<java.lang.String,java.lang.Object> |
m_serviceProperties |
private java.util.concurrent.atomic.AtomicInteger |
m_useCount |
m_activationLock, m_container, m_factoryInstance, REASONS
STATE_ACTIVE, STATE_DISABLED, STATE_DISPOSED, STATE_SATISFIED, STATE_UNSATISFIED_CONFIGURATION, STATE_UNSATISFIED_REFERENCE
Constructor and Description |
---|
SingleComponentManager(ComponentContainer<S> container,
ComponentMethods componentMethods)
The constructor receives both the activator and the metadata
|
SingleComponentManager(ComponentContainer<S> container,
ComponentMethods componentMethods,
boolean factoryInstance) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
clear() |
(package private) void |
clearServiceProperties() |
private boolean |
createComponent(ComponentContextImpl<S> componentContext) |
protected S |
createImplementationObject(org.osgi.framework.Bundle usingBundle,
SingleComponentManager.SetImplementationObject<S> setter,
ComponentContextImpl<S> componentContext) |
protected void |
deleteComponent(int reason) |
protected void |
disposeImplementationObject(ComponentContextImpl<S> componentContext,
int reason) |
org.osgi.service.component.ComponentInstance |
getComponentInstance() |
void |
getComponentManagers(java.util.List<AbstractComponentManager<S>> cms) |
private S |
getInstance()
Get the object that is implementing this descriptor
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns the (private copy) of the Component properties to be used
for the ComponentContext as well as eventual service registration.
|
S |
getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration<S> serviceRegistration) |
private S |
getService(ComponentContextImpl<S> componentContext) |
(package private) boolean |
getServiceInternal(org.osgi.framework.ServiceRegistration<S> serviceRegistration) |
java.util.Dictionary<java.lang.String,java.lang.Object> |
getServiceProperties()
Returns the subset of component properties to be used as service
properties.
|
(package private) org.osgi.framework.ServiceReference<S> |
getServiceReference() |
(package private) org.osgi.framework.ServiceRegistration<S> |
getServiceRegistration() |
(package private) boolean |
hasInstance() |
(package private) <T> void |
invokeBindMethod(DependencyManager<S,T> dependencyManager,
RefPair<S,T> refPair,
int trackingCount) |
protected MethodResult |
invokeModifiedMethod() |
(package private) <T> void |
invokeUnbindMethod(DependencyManager<S,T> dependencyManager,
RefPair<S,T> oldRefPair,
int trackingCount) |
(package private) <T> boolean |
invokeUpdatedMethod(DependencyManager<S,T> dependencyManager,
RefPair<S,T> refPair,
int trackingCount)
Invoke updated method
|
private boolean |
keepInstances() |
private boolean |
modify(boolean configurationDeleted) |
(package private) void |
postRegister() |
(package private) void |
preDeregister() |
(package private) void |
reconfigure(boolean configurationDeleted) |
void |
reconfigure(java.util.Map<java.lang.String,java.lang.Object> configuration,
boolean configurationDeleted,
TargetedPID factoryPid)
Called by the Configuration Admin Service to update the component with
Configuration properties.
|
(package private) void |
registerComponentId() |
private boolean |
servicePropertiesMatches(org.osgi.framework.ServiceRegistration<S> reg,
java.util.Dictionary<java.lang.String,java.lang.Object> props)
Checks if the given service registration properties matches another set
of properties.
|
protected void |
setFactoryProperties(java.util.Dictionary<java.lang.String,?> dictionary) |
void |
setServiceProperties(java.util.Dictionary<java.lang.String,?> serviceProperties) |
void |
ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration<S> serviceRegistration,
S o) |
(package private) void |
unregisterComponentId() |
private void |
updateServiceRegistration() |
activateInternal, collectDependencies, copyTo, copyToDictionary, copyToMap, deactivateInternal, disable, disableInternal, dispose, dispose, dumpThreads, enable, enableInternal, enableLatchWait, getActivator, getBundle, getBundleContext, getComponentMetadata, getComponentMethods, getDependencyManager, getDependencyManagers, getId, getLockTimeout, getName, getProvidedServices, getReferenceManagers, getReversedDependencyManagers, getSpecState, getState, getTrackingCount, isActivatorActive, isFactory, isImmediate, isLogEnabled, isStateLocked, log, log, obtainActivationReadLock, obtainActivationWriteLock, obtainStateLock, registerMissingDependency, registerService, releaseActivationReadLock, releaseActivationWriteeLock, releaseStateLock, setServiceProperties, setState, toString, tracked, unregisterService, updateTargets, verifyDependencyManagers, waitForTracked
private final java.util.concurrent.atomic.AtomicInteger m_useCount
private volatile ComponentContextImpl<S> m_componentContext
private java.util.Map<java.lang.String,java.lang.Object> m_configurationProperties
private java.util.Map<java.lang.String,java.lang.Object> m_factoryProperties
private java.util.Map<java.lang.String,java.lang.Object> m_properties
private java.util.Dictionary<java.lang.String,java.lang.Object> m_serviceProperties
public SingleComponentManager(ComponentContainer<S> container, ComponentMethods componentMethods)
componentMethods
- public SingleComponentManager(ComponentContainer<S> container, ComponentMethods componentMethods, boolean factoryInstance)
void clear()
clear
in class AbstractComponentManager<S>
private boolean createComponent(ComponentContextImpl<S> componentContext)
protected void deleteComponent(int reason)
deleteComponent
in class AbstractComponentManager<S>
void clearServiceProperties()
public org.osgi.service.component.ComponentInstance getComponentInstance()
private S getInstance()
protected S createImplementationObject(org.osgi.framework.Bundle usingBundle, SingleComponentManager.SetImplementationObject<S> setter, ComponentContextImpl<S> componentContext)
protected void disposeImplementationObject(ComponentContextImpl<S> componentContext, int reason)
boolean hasInstance()
hasInstance
in class AbstractComponentManager<S>
<T> void invokeBindMethod(DependencyManager<S,T> dependencyManager, RefPair<S,T> refPair, int trackingCount)
invokeBindMethod
in class AbstractComponentManager<S>
<T> boolean invokeUpdatedMethod(DependencyManager<S,T> dependencyManager, RefPair<S,T> refPair, int trackingCount)
AbstractComponentManager
invokeUpdatedMethod
in class AbstractComponentManager<S>
true
if the component needs reactivation, false
otherwise.<T> void invokeUnbindMethod(DependencyManager<S,T> dependencyManager, RefPair<S,T> oldRefPair, int trackingCount)
invokeUnbindMethod
in class AbstractComponentManager<S>
protected void setFactoryProperties(java.util.Dictionary<java.lang.String,?> dictionary)
void registerComponentId()
registerComponentId
in class AbstractComponentManager<S>
void unregisterComponentId()
unregisterComponentId
in class AbstractComponentManager<S>
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
getProperties
in interface ComponentManager<S>
getProperties
in class AbstractComponentManager<S>
public void setServiceProperties(java.util.Dictionary<java.lang.String,?> serviceProperties)
setServiceProperties
in class AbstractComponentManager<S>
void postRegister()
postRegister
in class AbstractComponentManager<S>
void preDeregister()
preDeregister
in class AbstractComponentManager<S>
public java.util.Dictionary<java.lang.String,java.lang.Object> getServiceProperties()
AbstractComponentManager
getServiceProperties
in class AbstractComponentManager<S>
final org.osgi.framework.ServiceRegistration<S> getServiceRegistration()
final org.osgi.framework.ServiceReference<S> getServiceReference()
private void updateServiceRegistration()
public void reconfigure(java.util.Map<java.lang.String,java.lang.Object> configuration, boolean configurationDeleted, TargetedPID factoryPid)
configuration
parameter is null
. In this case
nothing is to be done. If a configuration has previously been set and
now the configuration is deleted, the configuration
parameter is null
and the component has to be reactivated
with the default configuration.reconfigure
in class AbstractComponentManager<S>
configuration
- The configuration properties for the component from
the Configuration Admin Service or null
if there is
no configuration or if the configuration has just been deleted.configurationDeleted
- TODOfactoryPid
- TODOvoid reconfigure(boolean configurationDeleted)
private boolean modify(boolean configurationDeleted)
protected MethodResult invokeModifiedMethod()
private boolean servicePropertiesMatches(org.osgi.framework.ServiceRegistration<S> reg, java.util.Dictionary<java.lang.String,java.lang.Object> props)
reg
- the service registration whose service properties will be
compared to the props parameterprops
- the properties to be compared with the registration
service properties.true
if the registration service properties equals
the prop properties, false if not.public S getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<S> serviceRegistration)
getService
in interface org.osgi.framework.ServiceFactory<S>
boolean getServiceInternal(org.osgi.framework.ServiceRegistration<S> serviceRegistration)
getServiceInternal
in class AbstractComponentManager<S>
private S getService(ComponentContextImpl<S> componentContext)
public void ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration<S> serviceRegistration, S o)
ungetService
in interface org.osgi.framework.ServiceFactory<S>
private boolean keepInstances()
public void getComponentManagers(java.util.List<AbstractComponentManager<S>> cms)
getComponentManagers
in class AbstractComponentManager<S>