org.apache.felix.ipojo

## Interface ComponentInstance

All Known Implementing Classes:
  HandlerManager, InstanceManager

    public interface ComponentInstance

This class defines the iPOJO's component instance concept.

Author:
  Felix Project Team

### Field Summary

Fields
`static int` `DISPOSED` Component Instance State : DISPOSED.
`static int` `INVALID` Component Instance State : INVALID.
`static int` `STOPPED` Component Instance State : STOPPED.
`static int` `VALID` Component Instance State : VALID.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addInstanceStateListener(InstanceStateListener listener)` Adds an instance state listener on the current instance.
`void` `dispose()` Disposes the component instance.
`org.osgi.framework.BundleContext` `getContext()` Returns the bundle context of this instance.
`ComponentFactory` `getFactory()` Returns the factory who created this instance.
`InstanceDescription` `getInstanceDescription()` Returns the instance description.
`java.lang.String` `getInstanceName()` Returns the name of the instance.
`int` `getState()` Returns the actual state of the instance.
`boolean` `isStarted()` Checks if the instance is started.
`void` `reconfigure(java.util.Dictionary configuration)` Re-configures an instance.
`void` `removeInstanceStateListener(InstanceStateListener listener)` Removes an instance state listener on the current instance.
`void` `start()` Starts the component instance.
`void` `stop()` Stops the component instance.

### Field Detail

#### DISPOSED

    static final int DISPOSED

Component Instance State : DISPOSED. The component instance was disposed.

See Also:
  Constant Field Values

#### STOPPED

    static final int STOPPED

Component Instance State : STOPPED. The component instance is not started.

See Also:
  Constant Field Values

#### INVALID

    static final int INVALID

Component Instance State : INVALID. The component instance is invalid when it starts or when a component dependency is invalid.

See Also:
  Constant Field Values

#### VALID

    static final int VALID

Component Instance State : VALID. The component instance is resolved when it is running and all its attached handlers are valid.

See Also:
  Constant Field Values

### Method Detail

#### start

    void start()

Starts the component instance.

#### stop

    void stop()

Stops the component instance. A stopped instance can be re-started.

#### dispose

    void dispose()

Disposes the component instance. A disposed instance cannot be re-started.

#### getState

    int getState()

Returns the actual state of the instance.

Returns:
  the actual state of the component instance.

#### getInstanceDescription

    InstanceDescription getInstanceDescription()

Returns the instance description.

Returns:
  the instance description of the current instance

#### getFactory

    ComponentFactory getFactory()

Returns the factory who created this instance.

Returns:
  the factory of the component instance.

#### getContext

    org.osgi.framework.BundleContext getContext()

Returns the bundle context of this instance.

Returns:
  the context of the component instance

#### getInstanceName

    java.lang.String getInstanceName()

Returns the name of the instance.

Returns:
  the name of the component instance

#### isStarted

    boolean isStarted()

Checks if the instance is started.

Returns:
  `true` if `getState()` returns `INVALID` or `VALID`.

#### reconfigure

    void reconfigure(java.util.Dictionary configuration)

Re-configures an instance. Do nothing if the instance does not support dynamic reconfiguration. The reconfiguration does not stop the instance.

Parameters:
  `configuration` - the new configuration.

#### addInstanceStateListener

    void addInstanceStateListener(InstanceStateListener listener)

Adds an instance state listener on the current instance.

Parameters:
  `listener` - the listener to add.

#### removeInstanceStateListener

    void removeInstanceStateListener(InstanceStateListener listener)

Removes an instance state listener on the current instance.

Parameters:
  `listener` - the listener to remove.