org.apache.felix.ipojo.api
Class ComponentType

java.lang.Object
  extended by org.apache.felix.ipojo.api.ComponentType
Direct Known Subclasses:
CompositeComponentType, PrimitiveComponentType

public abstract class ComponentType
extends Object

The component type class allows specifying a new component type and its attached factory. It also allows creating instances form the specified component type.

Author:
Felix Project Team

Constructor Summary
ComponentType()
           
 
Method Summary
 ComponentInstance createInstance()
          Creates a component instance from the current type with an empty configuration.
 ComponentInstance createInstance(Dictionary conf)
          Creates a component instance from the current type with the given configuration.
 ComponentInstance createInstance(String name)
          Creates a component instance from the current type with the given name.
 boolean disposeInstance(ComponentInstance ci)
          Disposes the given name.
 boolean disposeInstance(String name)
          Disposes the instance created with this component type which has the given name.
abstract  Factory getFactory()
          Gets the factory attached to the current component type.
 ComponentInstance getInstanceByName(String name)
          Gets the component instance created from this component type.
abstract  void start()
          Starts the factory attached to this component type.
abstract  void stop()
          Stops the factory attached to this component type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentType

public ComponentType()
Method Detail

getFactory

public abstract Factory getFactory()
Gets the factory attached to the current component type.

Returns:
the factory

start

public abstract void start()
Starts the factory attached to this component type. Once started a factory and its attached component type cannot be modified.


stop

public abstract void stop()
Stops the factory attached to this component type.


createInstance

public ComponentInstance createInstance()
                                 throws UnacceptableConfiguration,
                                        MissingHandlerException,
                                        ConfigurationException
Creates a component instance from the current type with an empty configuration.

Returns:
the component instance object.
Throws:
UnacceptableConfiguration - the configuration is not acceptable
MissingHandlerException - the factory in invalid
ConfigurationException - the instance configuration failed

createInstance

public ComponentInstance createInstance(String name)
                                 throws UnacceptableConfiguration,
                                        MissingHandlerException,
                                        ConfigurationException
Creates a component instance from the current type with the given name.

Parameters:
name - the instance name
Returns:
the component instance object.
Throws:
UnacceptableConfiguration - the configuration is not acceptable
MissingHandlerException - the factory in invalid
ConfigurationException - the instance configuration failed

createInstance

public ComponentInstance createInstance(Dictionary conf)
                                 throws UnacceptableConfiguration,
                                        MissingHandlerException,
                                        ConfigurationException
Creates a component instance from the current type with the given configuration.

Parameters:
conf - the configuration
Returns:
the component instance object.
Throws:
UnacceptableConfiguration - the configuration is not acceptable
MissingHandlerException - the factory in invalid
ConfigurationException - the instance configuration failed

disposeInstance

public boolean disposeInstance(ComponentInstance ci)
Disposes the given name. The instance must be created from this component type.

Parameters:
ci - the component instance to delete
Returns:
true if the instance was successfully disposed.

getInstanceByName

public ComponentInstance getInstanceByName(String name)
Gets the component instance created from this component type. with the given name.

Parameters:
name - the instance name.
Returns:
the component instance with the given name and created from the current component type factory. null if the instance cannot be found.

disposeInstance

public boolean disposeInstance(String name)
Disposes the instance created with this component type which has the given name.

Parameters:
name - the name of the instance to delete.
Returns:
true is the instance is successfully disposed.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.