|
||||||||||
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
public abstract class AbstractComponentManager
The default ComponentManager. Objects of this class are responsible for managing implementation object's lifecycle.
Nested Class Summary | |
---|---|
protected static class |
AbstractComponentManager.Activating
|
protected static class |
AbstractComponentManager.Active
The Active state is the satisified state of an immediate
component after activation. |
protected static class |
AbstractComponentManager.Deactivating
|
protected static class |
AbstractComponentManager.Disabled
|
protected static class |
AbstractComponentManager.Disabling
|
protected static class |
AbstractComponentManager.Disposed
|
protected static class |
AbstractComponentManager.Disposing
|
protected static class |
AbstractComponentManager.Enabling
|
protected static class |
AbstractComponentManager.Factory
The Factory state is the satisfied state of component
factory components. |
protected static class |
AbstractComponentManager.FactoryInstance
The FactoryInstance state is the satisfied state of
instances of component factory components created with the
ComponentFactory.newInstance method. |
protected static class |
AbstractComponentManager.Registered
The Registered state is the statisfied state of a delayed or
service factory component before the actual service instance is
(first) retrieved. |
protected static class |
AbstractComponentManager.Satisfied
|
protected static class |
AbstractComponentManager.State
There are 12 states in all. |
protected static class |
AbstractComponentManager.Unsatisfied
|
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 | |
---|---|
protected |
AbstractComponentManager(BundleComponentActivator activator,
ComponentMetadata metadata)
The constructor receives both the activator and the metadata |
Method Summary | |
---|---|
protected static Dictionary |
copyTo(Dictionary target,
Dictionary source)
Copies the properties from the source Dictionary
into the target Dictionary . |
protected static Dictionary |
copyTo(Dictionary target,
Dictionary 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 boolean |
createComponent()
Method is called by #activate() in STATE_ACTIVATING or by
DelayedComponentManager.getService(Bundle, ServiceRegistration)
in STATE_REGISTERED. |
protected abstract void |
deleteComponent(int reason)
|
void |
disable()
Disables this component and - if active - first deactivates it. |
void |
dispose(int reason)
Disposes off this component deactivating and disabling it first as required. |
void |
enable()
Enables this component and - if satisfied - also activates it. |
String |
getActivate()
Returns the name of the method to be called when the component is being activated. |
BundleComponentActivator |
getActivator()
|
Bundle |
getBundle()
Returns the Bundle providing this component. |
String |
getClassName()
Returns the class name of the Component implementation. |
ComponentMetadata |
getComponentMetadata()
|
String |
getConfigurationPolicy()
Reuturns the configuration policy declared in the component descriptor. |
String |
getDeactivate()
Returns the name of the method to be called when the component is being deactivated. |
String |
getFactory()
Returns the component factory name or null if this component
is not defined as a component factory. |
long |
getId()
Returns the component ID of this component. |
String |
getModified()
Returns the name of the method to be called when the component configuration has been updated or null if such a method is
not declared in the component descriptor. |
String |
getName()
Returns the name of the component, which is also used as the service PID. |
abstract Dictionary |
getProperties()
Returns the properties of the Component. |
Reference[] |
getReferences()
Returns an array of Reference instances representing the service
references (or dependencies) of this Component. |
protected abstract Object |
getService()
Returns the service object to be registered if the service element is specified. |
Dictionary |
getServiceProperties()
Returns the subset of component properties to be used as service properties. |
String[] |
getServices()
Returns an array of service names provided by this Component or null if the Component is not registered as a service. |
int |
getState()
Returns the current state of the Component, which is one of the STATE_* constants defined in this interface. |
abstract boolean |
hasConfiguration()
|
boolean |
isActivateDeclared()
Returns true if the name of the method to be called on
component activation (see Component.getActivate() is declared in the
component descriptor or not. |
boolean |
isDeactivateDeclared()
Returns true if the name of the method to be called on
component deactivation (see Component.getDeactivate() is declared in the
component descriptor or not. |
boolean |
isDefaultEnabled()
Returns whether the Component is declared to be enabled initially. |
boolean |
isImmediate()
Returns whether the Component is an Immediate or a Delayed Component. |
boolean |
isLogEnabled(int level)
Returns true if logging for the given level is enabled. |
boolean |
isServiceFactory()
Returns true if this component is a service factory. |
void |
log(int level,
String message,
Object[] arguments,
Throwable ex)
|
void |
log(int level,
String message,
Throwable ex)
|
protected void |
registerComponentService()
|
protected ServiceRegistration |
registerService()
|
protected AbstractComponentManager.State |
state()
|
String |
toString()
|
protected void |
unregisterComponentService()
|
protected boolean |
verifyDependencyManagers(Dictionary properties)
|
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.Component |
---|
getComponentInstance |
Constructor Detail |
---|
protected AbstractComponentManager(BundleComponentActivator activator, ComponentMetadata metadata)
activator
- metadata
- Method Detail |
---|
public final void enable()
This method ignores the enabled flag of the component metadata and just enables as requested.
This method enables and activates the component immediately.
enable
in interface Component
public final void disable()
enable()
method.
This method deactivates and disables the component immediately.
disable
in interface Component
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()
Component
getId
in interface Component
public String getName()
Component
name
attribute of the
component
element.
getName
in interface Component
public Bundle getBundle()
Bundle
providing this component. If the
component as already been disposed off, this method returns
null
.
getBundle
in interface Component
public String getClassName()
Component
class
attribute of the
implementation
element.
getClassName
in interface Component
public String getFactory()
Component
null
if this component
is not defined as a component factory. This method provides access to
the factory
attribute of the component
element.
getFactory
in interface Component
public Reference[] getReferences()
Component
Reference
instances representing the service
references (or dependencies) of this Component. If the Component has no
references, null
is returned.
getReferences
in interface Component
public boolean isImmediate()
Component
immediate
attribute of
the component
element.
isImmediate
in interface Component
public boolean isDefaultEnabled()
Component
enabled
attribute of the
component
element.
isDefaultEnabled
in interface Component
public String getActivate()
Component
This method never returns null
, that is, if this method is
not declared in the component descriptor this method returns the
default value activate.
getActivate
in interface Component
public boolean isActivateDeclared()
Component
true
if the name of the method to be called on
component activation (see Component.getActivate()
is declared in the
component descriptor or not.
For a component declared in a Declarative Services 1.0 descriptor, this
method always returns false
.
isActivateDeclared
in interface Component
public String getDeactivate()
Component
This method never returns null
, that is, if this method is
not declared in the component descriptor this method returns the
default value deactivate.
getDeactivate
in interface Component
public boolean isDeactivateDeclared()
Component
true
if the name of the method to be called on
component deactivation (see Component.getDeactivate()
is declared in the
component descriptor or not.
For a component declared in a Declarative Services 1.0 descriptor, this
method always returns false
.
isDeactivateDeclared
in interface Component
public String getModified()
Component
null
if such a method is
not declared in the component descriptor.
For a component declared in a Declarative Services 1.0 descriptor, this
method always returns null
.
getModified
in interface Component
public String getConfigurationPolicy()
Component
The returned string is one of the three policies defined in the Declarative Services specification 1.1:
getConfigurationPolicy
in interface Component
public boolean isServiceFactory()
Component
true
if this component is a service factory. This
method returns the value of the serviceFactory
attribute of
the service
element. If the component has no service
element, this method returns false
.
isServiceFactory
in interface Component
public String[] getServices()
Component
null
if the Component is not registered as a service. This
method provides access to the interface
attributes of the
provide
elements.
getServices
in interface Component
protected abstract boolean createComponent()
#activate()
in STATE_ACTIVATING or by
DelayedComponentManager.getService(Bundle, ServiceRegistration)
in STATE_REGISTERED.
true
if creation of the component succeeded. If
false
is returned, the cause should have been logged.protected abstract void deleteComponent(int reason)
protected abstract Object getService()
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.
protected ServiceRegistration registerService()
protected void registerComponentService()
protected final void unregisterComponentService()
public BundleComponentActivator getActivator()
public boolean isLogEnabled(int level)
true
if logging for the given level is enabled.
public void log(int level, String message, Throwable ex)
public void log(int level, String message, Object[] arguments, Throwable ex)
public String toString()
toString
in class Object
protected boolean verifyDependencyManagers(Dictionary properties)
public abstract boolean hasConfiguration()
public abstract Dictionary getProperties()
Component
ComponentContext.getProperties()
method.
getProperties
in interface Component
public Dictionary getServiceProperties()
protected static Dictionary copyTo(Dictionary target, Dictionary source)
source
Dictionary
into the target
Dictionary
.
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.
target
is returned, which may be empty if
source
is null
or empty and
target
was null
.protected static Dictionary copyTo(Dictionary target, Dictionary 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 copiedpublic ComponentMetadata getComponentMetadata()
public int getState()
Component
STATE_*
constants defined in this interface.
getState
in interface Component
protected AbstractComponentManager.State state()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |