|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.ipojo.IPojoFactory
public abstract class IPojoFactory
This class abstracts iPOJO factories.
Nested Class Summary | |
---|---|
protected class |
IPojoFactory.RequiredHandler
Structure storing required handlers. |
Field Summary | |
---|---|
protected ComponentTypeDescription |
m_componentDesc
Component-Type description exposed by the factory service. |
protected java.util.Map |
m_componentInstances
List of the managed instance managers. |
protected org.apache.felix.ipojo.metadata.Element |
m_componentMetadata
Component Type provided by this factory. |
protected org.osgi.framework.BundleContext |
m_context
The bundle context reference. |
protected java.lang.String |
m_factoryName
Factory Name. |
protected static java.util.List |
m_instancesName
List of the managed instance name. |
protected boolean |
m_isPublic
Is the factory public (expose as a service). |
protected java.util.List |
m_listeners
List of listeners. |
protected Logger |
m_logger
Logger for the factory (and all component instance). |
protected java.util.List |
m_requiredHandlers
List of required handler. |
protected org.osgi.framework.ServiceRegistration |
m_sr
Service Registration of this factory (Factory & ManagedServiceFactory). |
protected int |
m_state
Factory state. |
Fields inherited from interface org.apache.felix.ipojo.Factory |
---|
INVALID, VALID |
Constructor Summary | |
---|---|
IPojoFactory(org.osgi.framework.BundleContext context,
org.apache.felix.ipojo.metadata.Element metadata)
Constructor. |
Method Summary | |
---|---|
void |
addFactoryStateListener(FactoryStateListener listener)
Add a factory listener. |
void |
checkAcceptability(java.util.Dictionary conf)
Check if the configuration is acceptable. |
protected void |
computeDescription()
Compute the component type description. |
protected void |
computeFactoryState()
Compute factory state. |
ComponentInstance |
createComponentInstance(java.util.Dictionary configuration)
Create an instance. |
ComponentInstance |
createComponentInstance(java.util.Dictionary configuration,
ServiceContext serviceContext)
Create an instance. |
abstract ComponentInstance |
createInstance(java.util.Dictionary config,
IPojoContext context,
HandlerManager[] handlers)
Create an instance. |
void |
deleted(java.lang.String name)
Delete an instance. |
void |
disposed(ComponentInstance instance)
Callback called by instance when disposed. |
protected java.lang.String |
generateName()
Helping method generating a new unique name. |
org.osgi.framework.BundleContext |
getBundleContext()
Get the bundle context of the factory. |
abstract java.lang.String |
getClassName()
Get the factory class name. |
ComponentTypeDescription |
getComponentDescription()
Get the component type description. |
ComponentTypeDescription |
getComponentTypeDescription()
|
org.apache.felix.ipojo.metadata.Element |
getDescription()
Get the component type description (Element-Attribute form). |
abstract java.lang.String |
getFactoryName()
Compute the factory name. |
protected HandlerManager |
getHandler(IPojoFactory.RequiredHandler req,
ServiceContext context)
Return the handler object for the given required handler. |
Logger |
getLogger()
Get the logger used by instances of he current factory. |
java.util.List |
getMissingHandlers()
Compute the list of missing handlers. |
java.lang.String |
getName()
Return the factory name. |
abstract java.util.List |
getRequiredHandlerList()
Compute the required handler list. |
java.util.List |
getRequiredHandlers()
Get the list of required handlers. |
int |
getState()
Return the state of the factory. |
boolean |
isAcceptable(java.util.Dictionary conf)
Check if the configuration is acceptable. |
protected boolean |
match(IPojoFactory.RequiredHandler req,
org.osgi.framework.ServiceReference ref)
Check if the given handler identifier and the service reference can match. |
void |
reconfigure(java.util.Dictionary properties)
Reconfigure an existing instance. |
void |
removeFactoryStateListener(FactoryStateListener listener)
Remove a factory listener. |
void |
start()
Start the factory. |
abstract void |
starting()
Starting method. |
void |
stop()
Stop all the instance managers. |
abstract void |
stopping()
Stopping method. |
void |
updated(java.lang.String name,
java.util.Dictionary properties)
Create of update an instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.List m_instancesName
protected ComponentTypeDescription m_componentDesc
protected java.util.Map m_componentInstances
protected org.apache.felix.ipojo.metadata.Element m_componentMetadata
protected org.osgi.framework.BundleContext m_context
protected java.lang.String m_factoryName
protected java.util.List m_requiredHandlers
protected java.util.List m_listeners
protected Logger m_logger
protected boolean m_isPublic
protected org.osgi.framework.ServiceRegistration m_sr
protected int m_state
Constructor Detail |
---|
public IPojoFactory(org.osgi.framework.BundleContext context, org.apache.felix.ipojo.metadata.Element metadata) throws ConfigurationException
context
- : bundle context of the bundle containing the factory.metadata
- : description of the component type.
ConfigurationException
- occurs when the element describing the factory is malformed.Method Detail |
---|
public ComponentTypeDescription getComponentTypeDescription()
public void addFactoryStateListener(FactoryStateListener listener)
addFactoryStateListener
in interface Factory
listener
- : the factory listener to add.Factory.addFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener)
public Logger getLogger()
public abstract java.lang.String getFactoryName()
public abstract java.util.List getRequiredHandlerList()
public abstract ComponentInstance createInstance(java.util.Dictionary config, IPojoContext context, HandlerManager[] handlers) throws ConfigurationException
config
- : instance configurationcontext
- : ipojo context to usehandlers
- : handler array to use
ConfigurationException
- : occurs when the instance creation failed during the configuration process.public ComponentInstance createComponentInstance(java.util.Dictionary configuration) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException
createComponentInstance
in interface Factory
configuration
- : configuration of the created instance.
UnacceptableConfiguration
- : occurs if the given configuration is not consistent with the component type of this factory.
MissingHandlerException
- : occurs if an handler is unavailable when the instance is created.
ConfigurationException
- : occurs when the instance or type configuration are not correct.Factory.createComponentInstance(java.util.Dictionary)
public ComponentInstance createComponentInstance(java.util.Dictionary configuration, ServiceContext serviceContext) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException
createComponentInstance
in interface Factory
configuration
- : configuration of the created instance.serviceContext
- : the service context to push for this instance.
UnacceptableConfiguration
- : occurs if the given configuration is not consistent with the component type of this factory.
MissingHandlerException
- : occurs when an handler is unavailable when creating the instance.
ConfigurationException
- : when the instance configuration failed.Factory.createComponentInstance(java.util.Dictionary)
public org.osgi.framework.BundleContext getBundleContext()
Factory
getBundleContext
in interface Factory
public abstract java.lang.String getClassName()
getClassName
in interface Factory
Factory.getClassName()
public ComponentTypeDescription getComponentDescription()
getComponentDescription
in interface Factory
public org.apache.felix.ipojo.metadata.Element getDescription()
getDescription
in interface Factory
Factory.getDescription()
public java.util.List getMissingHandlers()
getMissingHandlers
in interface Factory
Factory.getMissingHandlers()
public java.lang.String getName()
Factory
getName
in interface Factory
getName
in interface org.osgi.service.cm.ManagedServiceFactory
public java.util.List getRequiredHandlers()
getRequiredHandlers
in interface Factory
Factory.getRequiredHandlers()
public int getState()
Factory
getState
in interface Factory
public boolean isAcceptable(java.util.Dictionary conf)
isAcceptable
in interface Factory
conf
- : the configuration to test.
Factory.isAcceptable(java.util.Dictionary)
public void checkAcceptability(java.util.Dictionary conf) throws UnacceptableConfiguration, MissingHandlerException
conf
- : the configuration to test.
UnacceptableConfiguration
- occurs if the configuration is unacceptable.
MissingHandlerException
- occurs if an handler is missing.public void reconfigure(java.util.Dictionary properties) throws UnacceptableConfiguration, MissingHandlerException
reconfigure
in interface Factory
properties
- : the new configuration to push.
UnacceptableConfiguration
- : occurs if the new configuration is not consistent with the component type.
MissingHandlerException
- : occurs if the current factory is not valid.Factory.reconfigure(java.util.Dictionary)
public void removeFactoryStateListener(FactoryStateListener listener)
removeFactoryStateListener
in interface Factory
listener
- : the factory listener to remove.Factory.removeFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener)
public abstract void stopping()
public void stop()
public abstract void starting()
public void start()
public void updated(java.lang.String name, java.util.Dictionary properties) throws org.osgi.service.cm.ConfigurationException
updated
in interface org.osgi.service.cm.ManagedServiceFactory
name
- : name of the instanceproperties
- : configuration of the instance
org.osgi.service.cm.ConfigurationException
- : if the configuration is not consistent for this component typeManagedServiceFactory.updated(java.lang.String, java.util.Dictionary)
public void deleted(java.lang.String name)
deleted
in interface org.osgi.service.cm.ManagedServiceFactory
name
- : name of the instance to deleteManagedServiceFactory.deleted(java.lang.String)
public void disposed(ComponentInstance instance)
instance
- : the destroyed instanceprotected void computeDescription()
protected void computeFactoryState()
protected boolean match(IPojoFactory.RequiredHandler req, org.osgi.framework.ServiceReference ref)
req
- : the handler identifier.ref
- : the service reference.
protected HandlerManager getHandler(IPojoFactory.RequiredHandler req, ServiceContext context)
req
- : handler to create.context
- : service context in which create the handler (instance context).
protected java.lang.String generateName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |