Package groovy.jmx
Class GroovyMBean
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.jmx.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 SummaryConstructors Constructor Description GroovyMBean(javax.management.MBeanServerConnection server, java.lang.String objectName)GroovyMBean(javax.management.MBeanServerConnection server, java.lang.String objectName, boolean ignoreErrors)GroovyMBean(javax.management.MBeanServerConnection server, javax.management.ObjectName name)GroovyMBean(javax.management.MBeanServerConnection server, javax.management.ObjectName name, boolean ignoreErrors)
- 
Method SummaryModifier and Type Method Description protected java.lang.StringcreateOperationKey(java.lang.String operation, int params)Construct a simple key based on the method name and the number of parametersprotected java.lang.String[]createSignature(javax.management.MBeanOperationInfo info)java.lang.StringdescribeAttribute(java.lang.String attributeName)Description of the specified attribute name.protected java.lang.StringdescribeAttribute(javax.management.MBeanAttributeInfo attr)Description of the specified attribute name.java.util.List<java.lang.String>describeOperation(java.lang.String operationName)Get the description of the specified operation.protected java.lang.StringdescribeOperation(javax.management.MBeanOperationInfo operation)Description of the operation.java.lang.ObjectgetProperty(java.lang.String property)Retrieves a property value.javax.management.MBeanInfoinfo()java.lang.ObjectinvokeMethod(java.lang.String method, java.lang.Object arguments)Invokes the given method.java.util.Collection<java.lang.String>listAttributeDescriptions()List of string representations of all of the attributes on the MBean.java.util.Collection<java.lang.String>listAttributeNames()List of the names of each of the attributes on the MBeanjava.util.List<java.lang.String>listAttributeValues()The values of each of the attributes on the MBeanjava.util.Collection<java.lang.String>listOperationDescriptions()Description of all of the operations available on the MBean.java.util.Collection<java.lang.String>listOperationNames()Names of all the operations available on the MBean.javax.management.ObjectNamename()javax.management.MBeanServerConnectionserver()voidsetProperty(java.lang.String property, java.lang.Object value)Sets the given property to the new value.java.lang.StringtoString()Return an end user readable representation of the underlying MBeanMethods inherited from class groovy.lang.GroovyObjectSupportgetMetaClass, setMetaClassMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
- 
Constructor Details- 
GroovyMBeanpublic GroovyMBean(javax.management.MBeanServerConnection server, java.lang.String objectName) throws javax.management.JMException, java.io.IOException- Throws:
- javax.management.JMException
- java.io.IOException
 
- 
GroovyMBeanpublic GroovyMBean(javax.management.MBeanServerConnection server, java.lang.String objectName, boolean ignoreErrors) throws javax.management.JMException, java.io.IOException- Throws:
- javax.management.JMException
- java.io.IOException
 
- 
GroovyMBeanpublic GroovyMBean(javax.management.MBeanServerConnection server, javax.management.ObjectName name) throws javax.management.JMException, java.io.IOException- Throws:
- javax.management.JMException
- java.io.IOException
 
- 
GroovyMBeanpublic GroovyMBean(javax.management.MBeanServerConnection server, javax.management.ObjectName name, boolean ignoreErrors) throws javax.management.JMException, java.io.IOException- Throws:
- javax.management.JMException
- java.io.IOException
 
 
- 
- 
Method Details- 
serverpublic javax.management.MBeanServerConnection server()
- 
namepublic javax.management.ObjectName name()
- 
infopublic javax.management.MBeanInfo info()
- 
getPropertypublic java.lang.Object getProperty(java.lang.String property)Description copied from interface:GroovyObjectRetrieves a property value.- Parameters:
- property- the name of the property of interest
- Returns:
- the given property
 
- 
setPropertypublic void setProperty(java.lang.String property, java.lang.Object value)Description copied from interface:GroovyObjectSets the given property to the new value.- Parameters:
- property- the name of the property of interest
- value- the new value for the property
 
- 
invokeMethodpublic java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)Description copied from interface:GroovyObjectInvokes the given method.- Parameters:
- method- the name of the method to call
- arguments- the arguments to use for the method call
- Returns:
- the result of invoking the method
 
- 
createSignatureprotected java.lang.String[] createSignature(javax.management.MBeanOperationInfo info)
- 
createOperationKeyprotected java.lang.String createOperationKey(java.lang.String operation, int params)Construct a simple key based on the method name and the number of parameters- Parameters:
- operation- - the mbean operation name
- params- - the number of parameters the operation supports
- Returns:
- simple unique identifier for a method
 
- 
listAttributeNamespublic java.util.Collection<java.lang.String> listAttributeNames()List of the names of each of the attributes on the MBean- Returns:
- list of attribute names
 
- 
listAttributeValuespublic java.util.List<java.lang.String> listAttributeValues()The values of each of the attributes on the MBean- Returns:
- list of values of each attribute
 
- 
listAttributeDescriptionspublic java.util.Collection<java.lang.String> listAttributeDescriptions()List of string representations of all of the attributes on the MBean.- Returns:
- list of descriptions of each attribute on the mbean
 
- 
describeAttributeprotected java.lang.String describeAttribute(javax.management.MBeanAttributeInfo attr)Description of the specified attribute name.- Parameters:
- attr- - the attribute
- Returns:
- String the description
 
- 
describeAttributepublic java.lang.String describeAttribute(java.lang.String attributeName)Description of the specified attribute name.- Parameters:
- attributeName- - stringified name of the attribute
- Returns:
- the description
 
- 
listOperationNamespublic java.util.Collection<java.lang.String> listOperationNames()Names of all the operations available on the MBean.- Returns:
- all the operations on the MBean
 
- 
listOperationDescriptionspublic java.util.Collection<java.lang.String> listOperationDescriptions()Description of all of the operations available on the MBean.- Returns:
- full description of each operation on the MBean
 
- 
describeOperationpublic java.util.List<java.lang.String> describeOperation(java.lang.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
 
- 
describeOperationprotected java.lang.String describeOperation(javax.management.MBeanOperationInfo operation)Description of the operation.- Parameters:
- operation- the operation to describe
- Returns:
- pretty-printed description
 
- 
toStringpublic java.lang.String toString()Return an end user readable representation of the underlying MBean- Overrides:
- toStringin class- java.lang.Object
- Returns:
- the user readable description
 
 
-