Package groovy.util
Class GroovyMBean
- java.lang.Object
 - 
- groovy.lang.GroovyObjectSupport
 - 
- groovy.util.GroovyMBean
 
 
 
- 
- All Implemented Interfaces:
 GroovyObject
public class GroovyMBean extends GroovyObjectSupport
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. 
- 
- 
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringcreateOperationKey(String operation, int params)Construct a simple key based on the method name and the number of parametersprotected String[]createSignature(MBeanOperationInfo info)StringdescribeAttribute(String attributeName)Description of the specified attribute name.protected StringdescribeAttribute(MBeanAttributeInfo attr)Description of the specified attribute name.List<String>describeOperation(String operationName)Get the description of the specified operation.protected StringdescribeOperation(MBeanOperationInfo operation)Description of the operation.ObjectgetProperty(String property)Retrieves a property value.MBeanInfoinfo()ObjectinvokeMethod(String method, Object arguments)Invokes the given method.Collection<String>listAttributeDescriptions()List of string representations of all of the attributes on the MBean.Collection<String>listAttributeNames()List of the names of each of the attributes on the MBeanList<String>listAttributeValues()The values of each of the attributes on the MBeanCollection<String>listOperationDescriptions()Description of all of the operations available on the MBean.Collection<String>listOperationNames()Names of all the operations available on the MBean.ObjectNamename()MBeanServerConnectionserver()voidsetProperty(String property, Object value)Sets the given property to the new value.StringtoString()Return an end user readable representation of the underlying MBean- 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
GroovyMBean
public GroovyMBean(MBeanServerConnection server, String objectName) throws JMException, IOException
- Throws:
 JMExceptionIOException
 
- 
GroovyMBean
public GroovyMBean(MBeanServerConnection server, String objectName, boolean ignoreErrors) throws JMException, IOException
- Throws:
 JMExceptionIOException
 
- 
GroovyMBean
public GroovyMBean(MBeanServerConnection server, ObjectName name) throws JMException, IOException
- Throws:
 JMExceptionIOException
 
- 
GroovyMBean
public GroovyMBean(MBeanServerConnection server, ObjectName name, boolean ignoreErrors) throws JMException, IOException
- Throws:
 JMExceptionIOException
 
 - 
 
- 
Method Detail
- 
server
public MBeanServerConnection server()
 
- 
name
public ObjectName name()
 
- 
info
public MBeanInfo info()
 
- 
getProperty
public Object getProperty(String property)
Description copied from interface:GroovyObjectRetrieves a property value.- Specified by:
 getPropertyin interfaceGroovyObject- Overrides:
 getPropertyin classGroovyObjectSupport- Parameters:
 property- the name of the property of interest- Returns:
 - the given property
 
 
- 
setProperty
public void setProperty(String property, Object value)
Description copied from interface:GroovyObjectSets the given property to the new value.- Specified by:
 setPropertyin interfaceGroovyObject- Overrides:
 setPropertyin classGroovyObjectSupport- Parameters:
 property- the name of the property of interestvalue- the new value for the property
 
- 
invokeMethod
public Object invokeMethod(String method, Object arguments)
Description copied from interface:GroovyObjectInvokes the given method.- Specified by:
 invokeMethodin interfaceGroovyObject- Overrides:
 invokeMethodin classGroovyObjectSupport- Parameters:
 method- the name of the method to callarguments- the arguments to use for the method call- Returns:
 - the result of invoking the method
 
 
- 
createSignature
protected String[] createSignature(MBeanOperationInfo info)
 
- 
createOperationKey
protected String createOperationKey(String operation, int params)
Construct a simple key based on the method name and the number of parameters- Parameters:
 operation- - the mbean operation nameparams- - the number of parameters the operation supports- Returns:
 - simple unique identifier for a method
 
 
- 
listAttributeNames
public Collection<String> listAttributeNames()
List of the names of each of the attributes on the MBean- Returns:
 - list of attribute names
 
 
- 
listAttributeValues
public List<String> listAttributeValues()
The values of each of the attributes on the MBean- Returns:
 - list of values of each attribute
 
 
- 
listAttributeDescriptions
public Collection<String> listAttributeDescriptions()
List of string representations of all of the attributes on the MBean.- Returns:
 - list of descriptions of each attribute on the mbean
 
 
- 
describeAttribute
protected String describeAttribute(MBeanAttributeInfo attr)
Description of the specified attribute name.- Parameters:
 attr- - the attribute- Returns:
 - String the description
 
 
- 
describeAttribute
public String describeAttribute(String attributeName)
Description of the specified attribute name.- Parameters:
 attributeName- - stringified name of the attribute- Returns:
 - the description
 
 
- 
listOperationNames
public Collection<String> listOperationNames()
Names of all the operations available on the MBean.- Returns:
 - all the operations on the MBean
 
 
- 
listOperationDescriptions
public Collection<String> listOperationDescriptions()
Description of all of the operations available on the MBean.- Returns:
 - full description of each operation on the MBean
 
 
- 
describeOperation
public List<String> 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.- Parameters:
 operationName- the name of the operation to describe- Returns:
 - Collection of operation description
 
 
- 
describeOperation
protected String describeOperation(MBeanOperationInfo operation)
Description of the operation.- Parameters:
 operation- the operation to describe- Returns:
 - pretty-printed description
 
 
 - 
 
 -