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

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.apache.felix.ipojo.handlers.jmx.DynamicMBeanImpl
          extended by org.apache.felix.ipojo.handlers.jmx.DynamicMBeanWRegisterImpl
All Implemented Interfaces:
javax.management.DynamicMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

public class DynamicMBeanWRegisterImpl
extends DynamicMBeanImpl
implements javax.management.MBeanRegistration

This class implements a 'wide' iPOJO DynamicMBean that can perform actions before and after its registration and deregistration.

Author:
Felix Project Team

Field Summary
private  javax.management.ObjectName m_objName
          The effective name of the MBean.
private  MethodMetadata m_postDeregisterMeth
          The postDeregister method of MBeanRegistration interface.
private  MethodMetadata m_postRegisterMeth
          The postRegister method of MBeanRegistration interface.
private  MethodMetadata m_preDeregisterMeth
          The preDeregister method of MBeanRegistration interface.
private  MethodMetadata m_preRegisterMeth
          The preRegister method of MBeanRegistration interface.
 
Fields inherited from class org.apache.felix.ipojo.handlers.jmx.DynamicMBeanImpl
m_instanceManager
 
Constructor Summary
DynamicMBeanWRegisterImpl(JmxConfigFieldMap properties, InstanceManager instanceManager, MethodMetadata preRegisterMeth, MethodMetadata postRegisterMeth, MethodMetadata preDeregisterMeth, MethodMetadata postDeregisterMeth)
          Constructs a new DynamicMBeanWRegisterImpl.
 
Method Summary
private  java.lang.Object callMethod(MethodMetadata methodMetadata, java.lang.String methodName, java.lang.Object[] params)
          Private method used to execute a given callback.
 javax.management.ObjectName getObjectName()
          Returns the MBean name used to register it.
 void postDeregister()
          This method is executed after the MBean deregistration.
 void postRegister(java.lang.Boolean registrationDone)
          This method is executed after the MBean registration.
 void preDeregister()
          This method is before after the MBean deregistration.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          This method is executed before the MBean registration.
 
Methods inherited from class org.apache.felix.ipojo.handlers.jmx.DynamicMBeanImpl
getAttribute, getAttributes, getMBeanInfo, getNotificationInfo, invoke, sendNotification, setAttribute, setAttributes
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_preRegisterMeth

private MethodMetadata m_preRegisterMeth
The preRegister method of MBeanRegistration interface.


m_postRegisterMeth

private MethodMetadata m_postRegisterMeth
The postRegister method of MBeanRegistration interface.


m_preDeregisterMeth

private MethodMetadata m_preDeregisterMeth
The preDeregister method of MBeanRegistration interface.


m_postDeregisterMeth

private MethodMetadata m_postDeregisterMeth
The postDeregister method of MBeanRegistration interface.


m_objName

private javax.management.ObjectName m_objName
The effective name of the MBean.

Constructor Detail

DynamicMBeanWRegisterImpl

public DynamicMBeanWRegisterImpl(JmxConfigFieldMap properties,
                                 InstanceManager instanceManager,
                                 MethodMetadata preRegisterMeth,
                                 MethodMetadata postRegisterMeth,
                                 MethodMetadata preDeregisterMeth,
                                 MethodMetadata postDeregisterMeth)
Constructs a new DynamicMBeanWRegisterImpl.

Parameters:
properties - the data extracted from the metadata.xml
instanceManager - the instance manager
preRegisterMeth - the method to call before MBean registration
postRegisterMeth - the method to call after MBean registration
preDeregisterMeth - the method to call before MBean deregistration
postDeregisterMeth - the method to call after MBean registration
Method Detail

getObjectName

public javax.management.ObjectName getObjectName()
Returns the MBean name used to register it.

Returns:
the MBean name used to register it.

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
This method is executed before the MBean registration.

Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - the server on which the MBean will be registered
name - the name of the MBean to expose
Returns:
the name with which the MBean will be registered
Throws:
java.lang.Exception - This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
This method is executed after the MBean registration.

Specified by:
postRegister in interface javax.management.MBeanRegistration
Parameters:
registrationDone - indicates whether or not the MBean has been successfully registered in the MBean server.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
This method is before after the MBean deregistration.

Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception - This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
This method is executed after the MBean deregistration.

Specified by:
postDeregister in interface javax.management.MBeanRegistration

callMethod

private java.lang.Object callMethod(MethodMetadata methodMetadata,
                                    java.lang.String methodName,
                                    java.lang.Object[] params)
Private method used to execute a given callback.

Parameters:
methodMetadata - the metadata description of the callback
methodName - the name of the callback
params - the parameters of the callback
Returns:
the object eventually returned by the callback, or null if nothing's returned


Copyright © 2006-2010 The Apache Software Foundation. All Rights Reserved.