org.apache.felix.ipojo.api
Class SingletonComponentType

java.lang.Object
  extended by org.apache.felix.ipojo.api.ComponentType
      extended by org.apache.felix.ipojo.api.PrimitiveComponentType
          extended by org.apache.felix.ipojo.api.SingletonComponentType

public class SingletonComponentType
extends PrimitiveComponentType

Allows defining a primitive component type that create an unique instance when created. The factory is set to private by default.

Author:
Felix Project Team

Constructor Summary
SingletonComponentType()
          Creates a SingletonComponentType.
 
Method Summary
 ComponentInstance create()
          Starts the component type and creates the singleton instance.
 ComponentInstance create(Dictionary conf)
          Starts the component type and creates the singleton instance.
 ComponentInstance create(String name)
          Starts the component type and creates the singleton instance.
 SingletonComponentType setObject(Object obj)
          Sets the pojo object used by the instance.
 
Methods inherited from class org.apache.felix.ipojo.api.PrimitiveComponentType
addDependency, addDependency, addHandler, addProperty, addProperty, addService, getFactory, setBundleContext, setClassName, setComponentTypeName, setComponentTypeVersion, setFactoryMethod, setImmediate, setInvalidateMethod, setManagedServicePID, setPropagation, setPublic, setUpdatedMethod, setValidateMethod, start, stop
 
Methods inherited from class org.apache.felix.ipojo.api.ComponentType
createInstance, createInstance, createInstance, disposeInstance, disposeInstance, getInstanceByName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingletonComponentType

public SingletonComponentType()
Creates a SingletonComponentType. This type is set to private by default.

Method Detail

setObject

public SingletonComponentType setObject(Object obj)
Sets the pojo object used by the instance. The object must be compatible with the implementation class.

Parameters:
obj - the object.
Returns:
the current singleton component type.

create

public ComponentInstance create()
                         throws UnacceptableConfiguration,
                                MissingHandlerException,
                                ConfigurationException
Starts the component type and creates the singleton instance. This method has to be called in place of the PrimitiveComponentType.start() and the ComponentType.createInstance() methods.

Returns:
the created component instance.
Throws:
ConfigurationException - occurs if the type description is incorrect
MissingHandlerException - occurs if a handler is not available
UnacceptableConfiguration - occurs if the configuration is not acceptable by the instance
See Also:
ComponentType.start(), ComponentType.createInstance()

create

public ComponentInstance create(Dictionary conf)
                         throws UnacceptableConfiguration,
                                MissingHandlerException,
                                ConfigurationException
Starts the component type and creates the singleton instance. This method has to be called in place of the PrimitiveComponentType.start() and the ComponentType.createInstance() methods.

Parameters:
conf - the instance configuration
Returns:
the created component instance
Throws:
ConfigurationException - occurs if the type description is incorrect
MissingHandlerException - occurs if a handler is not available
UnacceptableConfiguration - occurs if the configuration is not acceptable by the instance
See Also:
ComponentType.start(), ComponentType.createInstance()

create

public ComponentInstance create(String name)
                         throws UnacceptableConfiguration,
                                MissingHandlerException,
                                ConfigurationException
Starts the component type and creates the singleton instance. This method has to be called in place of the PrimitiveComponentType.start() and the ComponentType.createInstance() methods.

Parameters:
name - the name of the instance to create. This parameter will be used as the instance.name property.
Returns:
the created component instance.
Throws:
ConfigurationException - occurs if the type description is incorrect
MissingHandlerException - occurs if a handler is not available
UnacceptableConfiguration - occurs if the configuration is not acceptable by the instance
See Also:
ComponentType.start(), ComponentType.createInstance()


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