|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.felix.ipojo.InstanceManager
public class InstanceManager
The instance manager class manages one instance of a component type. It manages component lifecycle, component instance creation and handlers.
| Field Summary | |
|---|---|
protected java.lang.String |
m_className
Name of the component type implementation class. |
protected HandlerManager[] |
m_handlers
Handler list. |
protected java.util.List |
m_listeners
Instance State Listener List. |
protected java.lang.String |
m_name
Name of the component instance. |
protected int |
m_state
Component state (STOPPED at the beginning). |
| Fields inherited from interface org.apache.felix.ipojo.ComponentInstance |
|---|
DISPOSED, INVALID, STOPPED, VALID |
| Constructor Summary | |
|---|---|
InstanceManager(ComponentFactory factory,
org.osgi.framework.BundleContext context,
HandlerManager[] handlers)
Construct a new Component Manager. |
|
| Method Summary | |
|---|---|
void |
addInstanceStateListener(InstanceStateListener listener)
Register an instance state listener. |
void |
configure(org.apache.felix.ipojo.metadata.Element metadata,
java.util.Dictionary configuration)
Configure the instance manager. |
java.lang.Object |
createPojoObject()
Create an instance of the component. |
void |
dispose()
Dispose the instance. |
java.lang.String |
getClassName()
Get the implementation class of the component type. |
java.lang.Class |
getClazz()
Get the manipulated class. |
org.osgi.framework.BundleContext |
getContext()
Get the bundle context used by this component instance. |
ComponentFactory |
getFactory()
Get the factory which create the current instance. |
java.lang.Object |
getFieldValue(java.lang.String fieldName)
Give access to a field value to the first created pojo. |
java.lang.Object |
getFieldValue(java.lang.String fieldName,
java.lang.Object pojo)
Give access to a field value to the given created pojo. |
org.osgi.framework.BundleContext |
getGlobalContext()
|
Handler |
getHandler(java.lang.String name)
Return a specified handler. |
InstanceDescription |
getInstanceDescription()
Get the description of the current instance. |
java.lang.String |
getInstanceName()
Get the instance name. |
ServiceContext |
getLocalServiceContext()
|
java.lang.Object |
getPojoObject()
Get the first object created by the instance. |
java.lang.Object[] |
getPojoObjects()
Get the array of object created by the instance. |
java.util.Set |
getRegistredFields()
Get the list of registered fields. |
Handler[] |
getRegistredHandlers()
Get the list of handlers plugged on the instance. |
java.util.Set |
getRegistredMethods()
Get the list of registered methods. |
int |
getState()
Get the actual state of the instance. |
boolean |
isStarted()
Check if the instance if started. |
void |
onEntry(java.lang.Object pojo,
java.lang.String methodId,
java.lang.Object[] args)
Dispatch entry method event on registered handler. |
void |
onError(java.lang.Object pojo,
java.lang.String methodId,
java.lang.Throwable error)
Dispatch error method event on registered handler. |
void |
onExit(java.lang.Object pojo,
java.lang.String methodId,
java.lang.Object result)
Dispatch exit method event on registered handler. |
java.lang.Object |
onGet(java.lang.Object pojo,
java.lang.String fieldName)
This method is called by the manipulated class each time that a GETFIELD instruction is found. |
void |
onSet(java.lang.Object pojo,
java.lang.String fieldName,
java.lang.Object objectValue)
This method is called by the manipulated class each time that a PUTFILED instruction is found. |
void |
reconfigure(java.util.Dictionary configuration)
Reconfigure the current instance. |
void |
register(FieldMetadata field,
FieldInterceptor interceptor)
Register a field interceptor. |
void |
register(MethodMetadata method,
MethodInterceptor interceptor)
Register a method interceptor. |
void |
register(PrimitiveHandler handler,
FieldMetadata[] fields,
MethodMetadata[] methods)
Deprecated. use register(FieldMetadata fm, FieldInterceptor fi) and register(MethodMetadata mm, MethodInterceptor mi) instead. |
void |
removeInstanceStateListener(InstanceStateListener listener)
Unregister an instance state listener. |
void |
setState(int state)
Set the state of the component instance. |
void |
start()
Start the instance manager. |
void |
stateChanged(ComponentInstance instance,
int newState)
State Change listener callback. |
void |
stop()
Stop the instance manager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String m_name
protected java.lang.String m_className
protected HandlerManager[] m_handlers
protected int m_state
protected java.util.List m_listeners
| Constructor Detail |
|---|
public InstanceManager(ComponentFactory factory,
org.osgi.framework.BundleContext context,
HandlerManager[] handlers)
factory - : the factory managing the instance managercontext - : the bundle context to give to the instancehandlers - : handlers array| Method Detail |
|---|
public void configure(org.apache.felix.ipojo.metadata.Element metadata,
java.util.Dictionary configuration)
throws ConfigurationException
metadata - : the component type metadataconfiguration - : the configuration of the instance
ConfigurationException - : occurs if the metadata are not correctpublic InstanceDescription getInstanceDescription()
getInstanceDescription in interface ComponentInstanceComponentInstance.getInstanceDescription()public Handler[] getRegistredHandlers()
public Handler getHandler(java.lang.String name)
name - : class name of the handler to find or its qualified name (namespace:name)
public java.lang.Object getFieldValue(java.lang.String fieldName)
fieldName - : field name.
public java.lang.Object getFieldValue(java.lang.String fieldName,
java.lang.Object pojo)
fieldName - : field name.pojo - : the pojo on which computing field value.
public void start()
start in interface ComponentInstancepublic void stop()
stop in interface ComponentInstancepublic void dispose()
dispose in interface ComponentInstanceComponentInstance.dispose()public void setState(int state)
state - : the new statepublic int getState()
getState in interface ComponentInstanceComponentInstance.getState()public boolean isStarted()
isStarted in interface ComponentInstanceComponentInstance.isStarted()public void addInstanceStateListener(InstanceStateListener listener)
addInstanceStateListener in interface ComponentInstancelistener - : listener to register.ComponentInstance.addInstanceStateListener(org.apache.felix.ipojo.InstanceStateListener)public void removeInstanceStateListener(InstanceStateListener listener)
removeInstanceStateListener in interface ComponentInstancelistener - : listener to unregister.ComponentInstance.removeInstanceStateListener(org.apache.felix.ipojo.InstanceStateListener)public ComponentFactory getFactory()
getFactory in interface ComponentInstanceComponentInstance.getFactory()public java.lang.Object[] getPojoObjects()
public java.lang.Object createPojoObject()
public java.lang.Object getPojoObject()
public java.lang.Class getClazz()
public void register(PrimitiveHandler handler,
FieldMetadata[] fields,
MethodMetadata[] methods)
handler - : the handler to registerfields - : the field metadata listmethods - : the method metadata list
public void register(FieldMetadata field,
FieldInterceptor interceptor)
field - : intercepted fieldinterceptor - : interceptor
public void register(MethodMetadata method,
MethodInterceptor interceptor)
method - : intercepted methodinterceptor - : interceptor
public java.lang.Object onGet(java.lang.Object pojo,
java.lang.String fieldName)
pojo - : the pojo object on which the field was getfieldName - : the field name on which the GETFIELD instruction is called
public void onEntry(java.lang.Object pojo,
java.lang.String methodId,
java.lang.Object[] args)
pojo - : the pojo object on which method is invoked.methodId - : method idargs - : argument array
public void onExit(java.lang.Object pojo,
java.lang.String methodId,
java.lang.Object result)
pojo - : the pojo object on which the method was invokedmethodId - : method idresult - : returned object.
public void onError(java.lang.Object pojo,
java.lang.String methodId,
java.lang.Throwable error)
pojo - : the pojo object on which the method was invokedmethodId - : method iderror - : throwable object.
public void onSet(java.lang.Object pojo,
java.lang.String fieldName,
java.lang.Object objectValue)
pojo - : the pojo object on which the field was setfieldName - : the field name on which the PUTFIELD instruction is calledobjectValue - : the value of the fieldpublic org.osgi.framework.BundleContext getContext()
getContext in interface ComponentInstanceComponentInstance.getContext()public org.osgi.framework.BundleContext getGlobalContext()
public ServiceContext getLocalServiceContext()
public java.lang.String getInstanceName()
getInstanceName in interface ComponentInstanceComponentInstance.getInstanceName()public void reconfigure(java.util.Dictionary configuration)
reconfigure in interface ComponentInstanceconfiguration - : the new configuration to pushComponentInstance.reconfigure(java.util.Dictionary)public java.lang.String getClassName()
public void stateChanged(ComponentInstance instance,
int newState)
stateChanged in interface InstanceStateListenerinstance - : changing instancenewState - : new stateInstanceStateListener.stateChanged(org.apache.felix.ipojo.ComponentInstance, int)public java.util.Set getRegistredFields()
public java.util.Set getRegistredMethods()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||