org.apache.felix.scr
Interface Component

All Known Subinterfaces:
ComponentManager
All Known Implementing Classes:
ComponentFactoryImpl, DelayedComponentManager, ServiceFactoryComponentManager

public interface Component

The Component interface represents a single component managed by the Service Component Runtime. Management agents may access the Component instances through the ScrService.


Field Summary
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
          The Component has been destroyed and cannot be used any more (value is 256).
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_ENABLED
          The Component has been enabled and is now going to be activated (value is 2).
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).
 
Method Summary
 void disable()
          Disables this Component if it is enabled.
 void enable()
          Enables this Component if it is disabled.
 Bundle getBundle()
          Returns the Bundle declaring this component.
 String getClassName()
          Returns the class name of the Component implementation.
 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 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 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.
 

Field Detail

STATE_DISABLED

static final 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).

See Also:
Constant Field Values

STATE_ENABLED

static final int STATE_ENABLED
The Component has been enabled and is now going to be activated (value is 2).

See Also:
Constant Field Values

STATE_UNSATISFIED

static final int STATE_UNSATISFIED
The Component activation failed because any dependency is not satisfied (value is 4).

See Also:
Constant Field Values

STATE_ACTIVATING

static final 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).

See Also:
Constant Field Values

STATE_ACTIVE

static final int STATE_ACTIVE
The Component has successfully been activated and is fully functional (value is 16). This is the state of immediate components after successfull activation. Delayed and Service Factory Components enter this state when the service instance has actually be instantiated because the service has been acquired.

See Also:
Constant Field Values

STATE_REGISTERED

static final 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).

See Also:
Constant Field Values

STATE_FACTORY

static final 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).

See Also:
Constant Field Values

STATE_DEACTIVATING

static final 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). After deactivation the Component enters the STATE_UNSATISFIED state.

See Also:
Constant Field Values

STATE_DESTROYED

static final int STATE_DESTROYED
The Component has been destroyed and cannot be used any more (value is 256). This state is only used when the bundle declaring the component is being stopped and all components have to be removed.

See Also:
Constant Field Values
Method Detail

getId

long getId()
Returns the component ID of this component. This ID is managed by the SCR.


getName

String getName()
Returns the name of the component, which is also used as the service PID. This method provides access to the name attribute of the component element.


getState

int getState()
Returns the current state of the Component, which is one of the STATE_* constants defined in this interface.


getBundle

Bundle getBundle()
Returns the Bundle declaring this component.


getFactory

String getFactory()
Returns the component factory name or null if this component is not defined as a component factory. This method provides access to the factory attribute of the component element.


isServiceFactory

boolean isServiceFactory()
Returns 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.


getClassName

String getClassName()
Returns the class name of the Component implementation. This method provides access to the class attribute of the implementation element.


isDefaultEnabled

boolean isDefaultEnabled()
Returns whether the Component is declared to be enabled initially. This method provides access to the enabled attribute of the component element.


isImmediate

boolean isImmediate()
Returns whether the Component is an Immediate or a Delayed Component. This method provides access to the immediate attribute of the component element.


getServices

String[] getServices()
Returns an array of service names provided by this Component or null if the Component is not registered as a service. This method provides access to the interface attributes of the provide elements.


getProperties

Dictionary getProperties()
Returns the properties of the Component. The Dictionary returned is a private copy of the actual properties and contains the same entries as are used to register the Component as a service and are returned by the ComponentContext.getProperties() method.


getReferences

Reference[] getReferences()
Returns an array of Reference instances representing the service references (or dependencies) of this Component. If the Component has no references, null is returned.


enable

void enable()
Enables this Component if it is disabled. If the Component is not currently disabled this method has no effect. If the Component is destroyed, this method throws an IllegalStateException.

Throws:
IllegalStateException - If the Component is destroyed.

disable

void disable()
Disables this Component if it is enabled. If the Component is already disabled this method has no effect. If the Component is destroyed, this method throws an IllegalStateException.

Throws:
IllegalStateException - If the Component is destroyed.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.