org.objectweb.easybeans.jmx
Class MBeansHelper

java.lang.Object
  extended by org.objectweb.easybeans.jmx.MBeansHelper

public final class MBeansHelper
extends java.lang.Object

Singleton object.Creates the MBeans and register them.

Author:
florent

Field Summary
private  boolean activate
          Is Management activated ?
private  java.util.Map<java.lang.Class,EZBManagementIdentifier> identifiers
          The Identifier in charge of creating the right ObjectName for a given instance.
private static MBeansHelper instance
          Singleton instance.
private static JLog logger
          Logger.
 
Constructor Summary
private MBeansHelper()
          Singleton class, no public constructor.
 
Method Summary
 void activate(boolean activate)
          Activate the MBeans registration.
private
<T> EZBManagementIdentifier<T>
getIdentifier(T instance)
           
static MBeansHelper getInstance()
           
<T> java.lang.String
getObjectName(T instance)
           
<T> void
registerMBean(T instance)
          Register the instance as a ModelMBean using the delegate.
<T> void
unregisterMBean(T instance)
          Unregister the given Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static JLog logger
Logger.


instance

private static MBeansHelper instance
Singleton instance.


identifiers

private java.util.Map<java.lang.Class,EZBManagementIdentifier> identifiers
The Identifier in charge of creating the right ObjectName for a given instance.


activate

private boolean activate
Is Management activated ?

Constructor Detail

MBeansHelper

private MBeansHelper()
Singleton class, no public constructor.

Method Detail

getInstance

public static MBeansHelper getInstance()
Returns:
Returns the Singleton MBeansHelper instance.

activate

public void activate(boolean activate)
Activate the MBeans registration.

Parameters:
activate - true if mbeans should be registered, false otherwise.

registerMBean

public <T> void registerMBean(T instance)
                   throws MBeansException
Register the instance as a ModelMBean using the delegate.

Type Parameters:
T - instance Type
Parameters:
instance - Object instance to be managed
Throws:
MBeansException - if registration fails.

unregisterMBean

public <T> void unregisterMBean(T instance)
                     throws MBeansException
Unregister the given Object.

Type Parameters:
T - instance Type
Parameters:
instance - Instance to be deregistered.
Throws:
MBeansException - if unregistration fails.

getObjectName

public <T> java.lang.String getObjectName(T instance)
                               throws MBeansException
Type Parameters:
T - instance Type
Parameters:
instance - Object instance to be managed
Returns:
Returns the instance ObjectName.
Throws:
MBeansException - if registration fails.

getIdentifier

private <T> EZBManagementIdentifier<T> getIdentifier(T instance)
                                          throws MBeansException
Type Parameters:
T - instance type
Parameters:
instance - instance to be managed.
Returns:
Returns an EZBManagementIdentifier for the given Resource type.
Throws:
MBeansException - if the Identifier cannot be returned.