org.apache.felix.ipojo.handlers.jmx
Class MBeanHandler

java.lang.Object
  extended by org.apache.felix.ipojo.Handler
      extended by org.apache.felix.ipojo.PrimitiveHandler
          extended by org.apache.felix.ipojo.handlers.jmx.MBeanHandler
All Implemented Interfaces:
ConstructorInjector, FieldInterceptor, MethodInterceptor

public class MBeanHandler
extends PrimitiveHandler

This class implements iPOJO Handler. it builds the dynamic MBean from metadata.xml and exposes it to the MBean Server.

Author:
Felix Project Team

Field Summary
static String POST_DEREGISTER_METH_NAME
          The name of the MBeanRegistration postDeregister method.
static String POST_REGISTER_METH_NAME
          The name of the MBeanRegistration postRegister method.
static String PRE_DEREGISTER_METH_NAME
          The name of the MBeanRegistration preDeregister method.
static String PRE_REGISTER_METH_NAME
          The name of the MBeanRegistration preRegister method.
 
Fields inherited from class org.apache.felix.ipojo.PrimitiveHandler
HANDLER_TYPE
 
Fields inherited from class org.apache.felix.ipojo.Handler
HANDLER_LEVEL_PROPERTY, HANDLER_NAME_PROPERTY, HANDLER_NAMESPACE_PROPERTY, HANDLER_TYPE_PROPERTY, m_instance, m_isValid
 
Constructor Summary
MBeanHandler()
           
 
Method Summary
 void configure(Element metadata, Dictionary dict)
          Constructs the structure JmxConfigFieldMap and the Dynamic Mbean.
 HandlerDescription getDescription()
          Gets the JMX handler description.
 String getUsedObjectName()
          Returns the objectName used to register the MBean.
 boolean isMOSGiExists()
          Returns true if the MOSGi framework is present on the OSGi platform.
 boolean isRegistered()
          Returns true if the MBean is registered.
 boolean isUsesMOSGi()
          Returns true if the MBean must be registered thanks to white board pattern of MOSGi.
 Object onGet(Object pojo, String fieldName, Object value)
          Called when a POJO member is read by the MBean.
 void onSet(Object pojo, String fieldName, Object value)
          Called when a POJO member is modified externally.
 void start()
          Registers the Dynamic Mbean.
 void stop()
          Unregisters the Dynamic Mbean.
 
Methods inherited from class org.apache.felix.ipojo.PrimitiveHandler
attach, getConstructorParameter, getConstructorParameterType, getFactory, getHandler, getInstanceManager, getLogger, getPojoMetadata, onCreation, onEntry, onError, onExit, onFinally, setFactory
 
Methods inherited from class org.apache.felix.ipojo.Handler
debug, error, error, getHandlerManager, getValidity, info, initializeComponentFactory, isValid, reconfigure, setValidity, stateChanged, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POST_DEREGISTER_METH_NAME

public static final String POST_DEREGISTER_METH_NAME
The name of the MBeanRegistration postDeregister method.

See Also:
Constant Field Values

PRE_DEREGISTER_METH_NAME

public static final String PRE_DEREGISTER_METH_NAME
The name of the MBeanRegistration preDeregister method.

See Also:
Constant Field Values

POST_REGISTER_METH_NAME

public static final String POST_REGISTER_METH_NAME
The name of the MBeanRegistration postRegister method.

See Also:
Constant Field Values

PRE_REGISTER_METH_NAME

public static final String PRE_REGISTER_METH_NAME
The name of the MBeanRegistration preRegister method.

See Also:
Constant Field Values
Constructor Detail

MBeanHandler

public MBeanHandler()
Method Detail

configure

public void configure(Element metadata,
                      Dictionary dict)
Constructs the structure JmxConfigFieldMap and the Dynamic Mbean.

Specified by:
configure in class Handler
Parameters:
metadata - the component metadata
dict - the instance configuration

start

public void start()
Registers the Dynamic Mbean.

Specified by:
start in class Handler

stop

public void stop()
Unregisters the Dynamic Mbean.

Specified by:
stop in class Handler

onSet

public void onSet(Object pojo,
                  String fieldName,
                  Object value)
Called when a POJO member is modified externally.

Specified by:
onSet in interface FieldInterceptor
Overrides:
onSet in class PrimitiveHandler
Parameters:
pojo - the modified POJO object
fieldName - the name of the modified field
value - the new value of the field
See Also:
FieldInterceptor#onSet(Object, String, Object)

onGet

public Object onGet(Object pojo,
                    String fieldName,
                    Object value)
Called when a POJO member is read by the MBean.

Specified by:
onGet in interface FieldInterceptor
Overrides:
onGet in class PrimitiveHandler
Parameters:
pojo - the read POJO object.
fieldName - the name of the modified field
value - the old value of the field
Returns:
the (injected) value of the field
See Also:
FieldInterceptor#onGet(Object, String, Object)

getDescription

public HandlerDescription getDescription()
Gets the JMX handler description.

Overrides:
getDescription in class Handler
Returns:
the JMX handler description.
See Also:
Handler.getDescription()

getUsedObjectName

public String getUsedObjectName()
Returns the objectName used to register the MBean. If the MBean is not registered, return an empty string.

Returns:
the objectName used to register the MBean.
See Also:
Handler.getDescription()

isRegistered

public boolean isRegistered()
Returns true if the MBean is registered.

Returns:
true if the MBean is registered.

isUsesMOSGi

public boolean isUsesMOSGi()
Returns true if the MBean must be registered thanks to white board pattern of MOSGi.

Returns:
true if the MBean must be registered thanks to white board pattern of MOSGi, false otherwise.

isMOSGiExists

public boolean isMOSGiExists()
Returns true if the MOSGi framework is present on the OSGi platform.

Returns:
true if the MOSGi framework is present on the OSGi platform, false otherwise.


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