|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.scr.impl.manager.AbstractComponentManager
org.apache.felix.scr.impl.manager.ComponentFactoryImpl
public class ComponentFactoryImpl
The 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.
Finally, if the ds.factory.enabled
bundle context property is
set to true
, component instances can be created by factory
configurations. This functionality is present for backwards compatibility
with earlier releases of the Apache Felix Declarative Services implementation.
But keep in mind, that this is non-standard behaviour.
Nested Class Summary |
---|
Field Summary |
---|
Fields inherited from interface org.apache.felix.scr.Component |
---|
STATE_ACTIVATING, STATE_ACTIVE, STATE_DEACTIVATING, STATE_DESTROYED, STATE_DISABLED, STATE_DISABLING, STATE_DISPOSED, STATE_DISPOSING, STATE_ENABLED, STATE_ENABLING, STATE_FACTORY, STATE_REGISTERED, STATE_UNSATISFIED |
Constructor Summary | |
---|---|
ComponentFactoryImpl(BundleComponentActivator activator,
ComponentMetadata metadata)
|
Method Summary | |
---|---|
void |
configurationDeleted(String pid)
The configuration with the given PID has been deleted from the Configuration Admin service. |
void |
configurationUpdated(String pid,
Dictionary configuration)
Configure a component with configuration from the given PID. |
protected boolean |
createComponent()
The component factory does not have a component to create. |
protected void |
deleteComponent(int reason)
The component factory does not have a component to delete. |
void |
disableComponents()
A component factory component holder disables the held components by disabling itself. |
void |
disposeComponents(int reason)
Disposes off all components ever created by this component holder. |
void |
disposed(ImmediateComponentManager component)
Informs the holder that the component has been disposed as a result of calling the dispose method. |
void |
enableComponents()
A component factory component holder enables the held components by enabling itself. |
ComponentInstance |
getComponentInstance()
Returns the org.osgi.service.component.ComponentInstance
representing this component or null if this component
is not been activated yet. |
Component[] |
getComponents()
Returns all Component instances held by this holder. |
Object |
getInstance()
Get the object that is implementing this descriptor |
Dictionary |
getProperties()
Returns the properties of the Component. |
protected Object |
getService()
Returns the service object to be registered if the service element is specified. |
boolean |
hasConfiguration()
|
ComponentInstance |
newInstance(Dictionary dictionary)
Create and activate a new component configuration. |
protected ServiceRegistration |
registerService()
|
Methods inherited from class org.apache.felix.scr.impl.manager.AbstractComponentManager |
---|
copyTo, copyTo, disable, dispose, enable, getActivate, getActivator, getBundle, getClassName, getComponentMetadata, getConfigurationPolicy, getDeactivate, getFactory, getId, getModified, getName, getReferences, getServiceProperties, getServices, getState, isActivateDeclared, isDeactivateDeclared, isDefaultEnabled, isImmediate, isLogEnabled, isServiceFactory, log, log, registerComponentService, state, toString, unregisterComponentService, verifyDependencyManagers |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.felix.scr.impl.config.ComponentHolder |
---|
getActivator, getComponentMetadata |
Constructor Detail |
---|
public ComponentFactoryImpl(BundleComponentActivator activator, ComponentMetadata metadata)
Method Detail |
---|
public ComponentInstance newInstance(Dictionary dictionary)
ComponentFactory
newInstance
in interface ComponentFactory
dictionary
- Additional properties for the component configuration
or null
if there are no additional properties.
ComponentInstance
object encapsulating the
component instance of the component configuration. The component
configuration has been activated and, if the component specifies
a service
element, the component instance has been
registered as a service.protected boolean createComponent()
But in the backwards compatible case any instances created for factory configuration instances are to enabled as a consequence of activating the component factory.
createComponent
in class AbstractComponentManager
true
if creation of the component succeeded. If
false
is returned, the cause should have been logged.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
protected ServiceRegistration registerService()
registerService
in class AbstractComponentManager
public Object getInstance()
AbstractComponentManager
public boolean hasConfiguration()
hasConfiguration
in class AbstractComponentManager
public Dictionary getProperties()
Component
ComponentContext.getProperties()
method.
getProperties
in interface Component
getProperties
in class AbstractComponentManager
protected Object getService()
AbstractComponentManager
Extensions of this class may overwrite this method to return a ServiceFactory to register in the case of a delayed or a service factory component.
getService
in class AbstractComponentManager
public ComponentInstance getComponentInstance()
Component
org.osgi.service.component.ComponentInstance
representing this component or null
if this component
is not been activated yet.
getComponentInstance
in interface Component
public void configurationDeleted(String pid)
ComponentHolder
configurationDeleted
in interface ComponentHolder
pid
- The PID of the deleted configurationpublic void configurationUpdated(String pid, Dictionary configuration)
ComponentHolder
configurationUpdated
in interface ComponentHolder
pid
- The PID of the configuration used to configure the componentpublic Component[] getComponents()
ComponentHolder
Component
instances held by this holder.
getComponents
in interface ComponentHolder
public void enableComponents()
enableComponents
in interface ComponentHolder
public void disableComponents()
disableComponents
in interface ComponentHolder
public void disposeComponents(int reason)
disposeComponents
in interface ComponentHolder
public void disposed(ImmediateComponentManager component)
ComponentHolder
disposed
in interface ComponentHolder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |