org.infinispan.jmx
Class ResourceDMBean

java.lang.Object
  extended by org.infinispan.jmx.ResourceDMBean
All Implemented Interfaces:
DynamicMBean

public class ResourceDMBean
extends Object
implements DynamicMBean

This class was entirely copied from JGroups 2.7 (same name there). Couldn't simply reuse it because JGroups does not ship with MBean, ManagedAttribute and ManagedOperation. Once JGroups will ship these classes, the code can be dynamically reused from there.

The original JGroup's ResourceDMBean logic has been modified so that #invoke() method checks whether the operation called has been exposed as a ManagedOperation, otherwise the call fails. JGroups deviated from this logic on purpose because they liked the fact that you could expose all class methods by simply annotating class with MBean annotation.

Since:
4.0
Author:
Mircea.Markus@jboss.com, Galder ZamarreƱo

Constructor Summary
ResourceDMBean(Object instance)
           
 
Method Summary
 Object getAttribute(String name)
           
 AttributeList getAttributes(String[] names)
           
static Class<?> getClassForName(String name)
           
 MBeanInfo getMBeanInfo()
           
 String getObjectName()
           
 Object invoke(String name, Object[] args, String[] sig)
           
 boolean isManagedResource()
           
 boolean isOperationRegistred(String operationName)
           
 void setAttribute(Attribute attribute)
           
 AttributeList setAttributes(AttributeList list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceDMBean

public ResourceDMBean(Object instance)
Method Detail

getMBeanInfo

public MBeanInfo getMBeanInfo()
Specified by:
getMBeanInfo in interface DynamicMBean

getAttribute

public Object getAttribute(String name)
                    throws AttributeNotFoundException
Specified by:
getAttribute in interface DynamicMBean
Throws:
AttributeNotFoundException

setAttribute

public void setAttribute(Attribute attribute)
Specified by:
setAttribute in interface DynamicMBean

getAttributes

public AttributeList getAttributes(String[] names)
Specified by:
getAttributes in interface DynamicMBean

setAttributes

public AttributeList setAttributes(AttributeList list)
Specified by:
setAttributes in interface DynamicMBean

invoke

public Object invoke(String name,
                     Object[] args,
                     String[] sig)
              throws MBeanException,
                     ReflectionException
Specified by:
invoke in interface DynamicMBean
Throws:
MBeanException
ReflectionException

getClassForName

public static Class<?> getClassForName(String name)
                                throws ClassNotFoundException
Throws:
ClassNotFoundException

isManagedResource

public boolean isManagedResource()

getObjectName

public String getObjectName()

isOperationRegistred

public boolean isOperationRegistred(String operationName)


Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.