public class ComponentFactoryImpl<S> extends AbstractComponentManager<S> implements org.osgi.service.component.ComponentFactory<S>, ComponentContainer<S>
ComponentFactoryImpl
extends the AbstractComponentManager
class to implement the component factory functionality. As such the
OSGi Declarative Services ComponentFactory
interface is
implemented.
In addition the ComponentHolder
interface is implemented to use this
class directly as the holder for component instances created by the
newInstance(Dictionary)
method.
This class implements spec-compliant component factories and the felix "persistent" component factory, where the factory is always registered whether or not all dependencies are present and the created components also persist whether or not the dependencies are present to allow the component instance to exist.
AbstractComponentManager.State
Modifier and Type | Field and Description |
---|---|
protected long |
m_changeCount
Configuration change count (R5) or imitation (R4)
|
protected TargetedPID |
m_targetedPID |
m_activationLock, m_container, m_factoryInstance
STATE_ACTIVE, STATE_DISPOSED, STATE_SATISFIED, STATE_UNSATISFIED_CONFIGURATION, STATE_UNSATISFIED_REFERENCE
Constructor and Description |
---|
ComponentFactoryImpl(ComponentContainer<S> container,
ComponentMethods componentMethods) |
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 void |
deleteComponent(int reason)
The component factory does not have a component to delete.
|
void |
dispose(int reason)
Disposes off all components ever created by this component holder.
|
void |
disposed(SingleComponentManager<S> component)
Informs the holder that the component has been disposed as a result of
calling the dispose method.
|
boolean |
equals(Object object)
Compares this
ComponentFactoryImpl object to another object. |
void |
getComponentManagers(List<AbstractComponentManager<S>> cms) |
protected void |
getComponentManagers(Map<?,SingleComponentManager<S>> componentMap,
List<AbstractComponentManager<S>> componentManagers) |
TargetedPID |
getConfigurationTargetedPID(TargetedPID pid,
TargetedPID factoryPid) |
Map<String,Object> |
getProperties()
For ComponentFactoryImpl, this is used only for updating targets on the dependency managers, so we don't need any other
properties.
|
protected String[] |
getProvidedServices() |
Dictionary<String,Object> |
getServiceProperties()
Returns the subset of component properties to be used as service
properties.
|
boolean |
hasConfiguration() |
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isFactory() |
org.osgi.service.component.ComponentInstance<S> |
newInstance(Dictionary<String,?> dictionary) |
void |
reconfigure(Map<String,Object> configuration,
boolean configurationDeleted,
TargetedPID factoryPid) |
void |
setServiceProperties(Dictionary<String,?> serviceProperties) |
protected boolean |
verifyDependencyManagers() |
copyTo, copyToDictionary, copyToMap, disable, enable, getActivator, getBundle, getComponentMetadata, getFailureReason, getId, getLogger, getReferenceManagers, getRegisteredServiceReference, getServiceRegistration, getSpecState, isImmediate, registerService, setFailureReason, setServiceProperties, toString, unregisterService
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getActivator, getComponentMetadata, getLogger
protected volatile long m_changeCount
protected TargetedPID m_targetedPID
public ComponentFactoryImpl(ComponentContainer<S> container, ComponentMethods componentMethods)
protected boolean verifyDependencyManagers()
verifyDependencyManagers
in class AbstractComponentManager<S>
public boolean isFactory()
isFactory
in class AbstractComponentManager<S>
public org.osgi.service.component.ComponentInstance<S> newInstance(Dictionary<String,?> dictionary)
newInstance
in interface org.osgi.service.component.ComponentFactory<S>
public boolean equals(Object object)
ComponentFactoryImpl
object to another object.
A component factory impl is considered to be equal to another component
factory impl if the component names are equal(using String.equals
).
public int hashCode()
protected void deleteComponent(int reason)
But in the backwards compatible case any instances created for factory configuration instances are to disabled as a consequence of deactivating the component factory.
deleteComponent
in class AbstractComponentManager<S>
protected String[] getProvidedServices()
getProvidedServices
in class AbstractComponentManager<S>
public boolean hasConfiguration()
public Map<String,Object> getProperties()
getProperties
in interface ComponentManager<S>
getProperties
in class AbstractComponentManager<S>
public void setServiceProperties(Dictionary<String,?> serviceProperties)
setServiceProperties
in class AbstractComponentManager<S>
public Dictionary<String,Object> getServiceProperties()
AbstractComponentManager
getServiceProperties
in class AbstractComponentManager<S>
protected boolean collectDependencies(ComponentContextImpl<S> componentContext)
AbstractComponentManager
collectDependencies
in class AbstractComponentManager<S>
componentContext
- possible instance key for prototype scope referencespublic void dispose(int reason)
dispose
in class AbstractComponentManager<S>
public void disposed(SingleComponentManager<S> component)
ComponentContainer
disposed
in interface ComponentContainer<S>
protected void getComponentManagers(Map<?,SingleComponentManager<S>> componentMap, List<AbstractComponentManager<S>> componentManagers)
public TargetedPID getConfigurationTargetedPID(TargetedPID pid, TargetedPID factoryPid)
public void reconfigure(Map<String,Object> configuration, boolean configurationDeleted, TargetedPID factoryPid)
reconfigure
in class AbstractComponentManager<S>
public void getComponentManagers(List<AbstractComponentManager<S>> cms)
getComponentManagers
in class AbstractComponentManager<S>
Copyright © 2006–2020 The Apache Software Foundation. All rights reserved.