groovy.util
Class GroovyMBean

A GroovyObject facade for an underlying MBean which acts like a normal groovy object but which is actually implemented via an underlying JMX MBean. Properties and normal method invocations delegate to the MBeanServer to the actual MBean.

author:
James Strachan
author:
Steve Button
author:
Paul King
version:
$Revision: 7934 $

Field Summary
 MBeanInfo beanInfo
           
 boolean ignoreErrors
           
 ObjectName name
           
 Map operations
           
 MBeanServerConnection server
           
 
Constructor Summary
GroovyMBean(MBeanServerConnection server, String objectName)
           
GroovyMBean(MBeanServerConnection server, String objectName, boolean ignoreErrors)
           
GroovyMBean(MBeanServerConnection server, ObjectName name)
           
GroovyMBean(MBeanServerConnection server, ObjectName name, boolean ignoreErrors)
           
 
Method Summary
String createOperationKey(String operation, int params)
           Construct a simple key based on the method name and the number of parameters
def createSignature(MBeanOperationInfo info)
          
String describeAttribute(MBeanAttributeInfo attr)
           Description of the specified attribute name.
String describeAttribute(String attributeName)
           Description of the specified attribute name.
List describeOperation(String operationName)
           Get the description of the specified operation.
String describeOperation(MBeanOperationInfo operation)
           Description of the operation.
Object getProperty(String property)
          
MBeanInfo info()
          
Object invokeMethod(String method, Object arguments)
          
Collection listAttributeDescriptions()
           List of string representations of all of the attributes on the MBean.
Collection listAttributeNames()
           List of the names of each of the attributes on the MBean
List listAttributeValues()
           The values of each of the attributes on the MBean
Collection listOperationDescriptions()
           Description of all of the operations available on the MBean.
Collection listOperationNames()
           Names of all the operations available on the MBean.
ObjectName name()
          
MBeanServerConnection server()
          
void setProperty(String property, Object value)
          
void throwException(String m, Exception e)
          
void throwExceptionWithTarget(String m, MBeanException e)
          
String toString()
           Return an end user readable representation of the underlying MBean
 

Constructor Detail

GroovyMBean

public GroovyMBean(MBeanServerConnection server, String objectName)


GroovyMBean

public GroovyMBean(MBeanServerConnection server, String objectName, boolean ignoreErrors)


GroovyMBean

public GroovyMBean(MBeanServerConnection server, ObjectName name)


GroovyMBean

public GroovyMBean(MBeanServerConnection server, ObjectName name, boolean ignoreErrors)


Method Detail

createOperationKey

String createOperationKey(String operation, int params)
Construct a simple key based on the method name and the number of parameters
param:
operation - the mbean operation name
param:
params - the number of parameters the operation supports
return:
simple unique identifier for a method


createSignature

def createSignature(MBeanOperationInfo info)


describeAttribute

String describeAttribute(MBeanAttributeInfo attr)
Description of the specified attribute name.
param:
attr - the attribute
return:
String the description


describeAttribute

public String describeAttribute(String attributeName)
Description of the specified attribute name.
param:
attributeName - stringified name of the attribute
return:
the description


describeOperation

public List describeOperation(String operationName)
Get the description of the specified operation. This returns a Collection since operations can be overloaded and one operationName can have multiple forms.
param:
operationName the name of the operation to describe
return:
Collection of operation description


describeOperation

String describeOperation(MBeanOperationInfo operation)
Description of the operation.
param:
operation the operation to describe
return:
pretty-printed description


getProperty

public Object getProperty(String property)


info

public MBeanInfo info()


invokeMethod

public Object invokeMethod(String method, Object arguments)


listAttributeDescriptions

public Collection listAttributeDescriptions()
List of string representations of all of the attributes on the MBean.
return:
list of descriptions of each attribute on the mbean


listAttributeNames

public Collection listAttributeNames()
List of the names of each of the attributes on the MBean
return:
list of attribute names


listAttributeValues

public List listAttributeValues()
The values of each of the attributes on the MBean
return:
list of values of each attribute


listOperationDescriptions

public Collection listOperationDescriptions()
Description of all of the operations available on the MBean.
return:
full description of each operation on the MBean


listOperationNames

public Collection listOperationNames()
Names of all the operations available on the MBean.
return:
all the operations on the MBean


name

public ObjectName name()


server

public MBeanServerConnection server()


setProperty

public void setProperty(String property, Object value)


throwException

void throwException(String m, Exception e)


throwExceptionWithTarget

void throwExceptionWithTarget(String m, MBeanException e)


toString

public String toString()
Return an end user readable representation of the underlying MBean
return:
the user readable description