public interface Component
Component
interface represents a single component managed
by the Service Component Runtime. Management agents may access the Component
instances through the ScrService
.Modifier and Type | Field and Description |
---|---|
static int |
STATE_ACTIVATING
The Component is currently being activated either because it has been
enabled or because any dependency which was previously unsatisfied has
become satisfied (value is 8).
|
static int |
STATE_ACTIVE
The Component has successfully been activated and is fully functional
(value is 16).
|
static int |
STATE_DEACTIVATING
The Component is being deactivated either because it is being disabled
or because a dependency is not satisfied any more (value is 128).
|
static int |
STATE_DESTROYED
Deprecated.
as of version 1.2 this constant has been renamed to
STATE_DISPOSED . |
static int |
STATE_DISABLED
The Component has just been created and is still disabled or it has
been disabled by calling the
disable() method (value is 1). |
static int |
STATE_DISABLING
The Component is being disabled (value is 1024).
|
static int |
STATE_DISPOSED
The Component has been disposed off and cannot be used any more (value is
256).
|
static int |
STATE_DISPOSING
The Component is being disposed off (value is 2048).
|
static int |
STATE_ENABLED
Deprecated.
as of version 1.2 the enabled state is collapsed into the
STATE_UNSATISFIED state. This status code is never returned
from the getState() method. |
static int |
STATE_ENABLING
The Component is being enabled (value is 512).
|
static int |
STATE_FACTORY
The Component is a Component Factory ready to manage Component instances
from configuration data received from the Configuration Admin Service
(value is 64).
|
static int |
STATE_REGISTERED
The Component has successfully been activated but is a Delayed or Service
Factory Component pending instantiation on first use (value is 32).
|
static int |
STATE_UNSATISFIED
The Component activation failed because any dependency is not satisfied
(value is 4).
|
Modifier and Type | Method and Description |
---|---|
void |
disable()
Disables this Component if it is enabled.
|
void |
enable()
Enables this Component if it is disabled.
|
String |
getActivate()
Returns the name of the method to be called when the component is being
activated.
|
org.osgi.framework.Bundle |
getBundle()
Returns the
Bundle declaring this component. |
String |
getClassName()
Returns the class name of the Component implementation.
|
org.osgi.service.component.ComponentInstance |
getComponentInstance()
Returns the
org.osgi.service.component.ComponentInstance
representing this component or null if this component
is not been activated yet. |
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.
|
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. |
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. |
boolean |
isActivateDeclared()
Returns
true if the name of the method to be called on
component activation (see 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 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 |
isServiceFactory()
Returns
true if this component is a service factory. |
static final int STATE_DISABLED
disable()
method (value is 1).static final int STATE_ENABLING
STATE_UNSATISFIED
state.static final int STATE_ENABLED
STATE_UNSATISFIED
state. This status code is never returned
from the getState()
method.static final int STATE_UNSATISFIED
static final int STATE_ACTIVATING
static final int STATE_ACTIVE
static final int STATE_REGISTERED
static final int STATE_FACTORY
static final int STATE_DEACTIVATING
STATE_UNSATISFIED
state.static final int STATE_DISABLING
STATE_DISABLED
state.static final int STATE_DISPOSING
STATE_DESTROYED
state.static final int STATE_DESTROYED
STATE_DISPOSED
.static final int STATE_DISPOSED
ComponentInstance.dispose()
method has been called.long getId()
String getName()
name
attribute of the
component
element.int getState()
STATE_*
constants defined in this interface.org.osgi.framework.Bundle getBundle()
Bundle
declaring this component.String getFactory()
null
if this component
is not defined as a component factory. This method provides access to
the factory
attribute of the component
element.boolean isServiceFactory()
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
.String getClassName()
class
attribute of the
implementation
element.boolean isDefaultEnabled()
enabled
attribute of the
component
element.boolean isImmediate()
immediate
attribute of
the component
element.String[] getServices()
null
if the Component is not registered as a service. This
method provides access to the interface
attributes of the
provide
elements.Dictionary getProperties()
ComponentContext.getProperties()
method.Reference[] getReferences()
Reference
instances representing the service
references (or dependencies) of this Component. If the Component has no
references, null
is returned.org.osgi.service.component.ComponentInstance getComponentInstance()
org.osgi.service.component.ComponentInstance
representing this component or null
if this component
is not been activated yet.String getActivate()
This method never returns null
, that is, if this method is
not declared in the component descriptor this method returns the
default value activate.
boolean isActivateDeclared()
true
if the name of the method to be called on
component activation (see 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
.
String getDeactivate()
This method never returns null
, that is, if this method is
not declared in the component descriptor this method returns the
default value deactivate.
boolean isDeactivateDeclared()
true
if the name of the method to be called on
component deactivation (see 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
.
String getModified()
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
.
String getConfigurationPolicy()
The returned string is one of the three policies defined in the Declarative Services specification 1.1:
void enable()
disabled
this method has no effect. If
the Component is destroyed
, this method throws
an IllegalStateException
.IllegalStateException
- If the Component is destroyed.void disable()
disabled
this method has no effect. If the
Component is destroyed
, this method throws an
IllegalStateException
.IllegalStateException
- If the Component is destroyed.Copyright © 2006–2013 The Apache Software Foundation. All rights reserved.