groovy.util
Class GroovyMBean

java.lang.Object
  extended bygroovy.lang.GroovyObjectSupport
      extended bygroovy.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.

Version:
$Revision: 3747 $
Author:
James Strachan, Steve Button

Constructor Summary
GroovyMBean(javax.management.MBeanServerConnection server, javax.management.ObjectName name)
           
 
Method Summary
protected  String createOperationKey(String operation, int params)
          Construct a simple key based on the method name and the number of parameters
protected  String[] createSignature(javax.management.MBeanOperationInfo info)
           
protected  String describeAttribute(javax.management.MBeanAttributeInfo attr)
          Description of the specified attribute name.
 String describeAttribute(String attributeName)
          Description of the specified attribute name.
protected  String describeOperation(javax.management.MBeanOperationInfo operation)
          Dessciption of the named operation.
 List describeOperation(String operationName)
          Get the dessciptions of the named operation.
 Object getProperty(String property)
           
 javax.management.MBeanInfo info()
           
 Object invokeMethod(String method, Object arguments)
          Invokes the given method
 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.
 javax.management.ObjectName name()
           
 javax.management.MBeanServerConnection server()
           
 void setProperty(String property, Object value)
          Sets the given property to the new value
 String toString()
          Return an end user readable representation of the underlying MBean
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroovyMBean

public GroovyMBean(javax.management.MBeanServerConnection server,
                   javax.management.ObjectName name)
            throws javax.management.JMException,
                   IOException
Method Detail

server

public javax.management.MBeanServerConnection server()

name

public javax.management.ObjectName name()

info

public javax.management.MBeanInfo info()

getProperty

public Object getProperty(String property)
Specified by:
getProperty in interface GroovyObject
Overrides:
getProperty in class GroovyObjectSupport

setProperty

public void setProperty(String property,
                        Object value)
Description copied from interface: GroovyObject
Sets the given property to the new value

Specified by:
setProperty in interface GroovyObject
Overrides:
setProperty in class GroovyObjectSupport

invokeMethod

public Object invokeMethod(String method,
                           Object arguments)
Description copied from interface: GroovyObject
Invokes the given method

Specified by:
invokeMethod in interface GroovyObject
Overrides:
invokeMethod in class GroovyObjectSupport

createSignature

protected String[] createSignature(javax.management.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 name
params - - the number of parameters the operation supports
Returns:
simple unique identifier for a method

listAttributeNames

public Collection listAttributeNames()
List of the names of each of the attributes on the MBean

Returns:
list of attribute names

listAttributeValues

public List listAttributeValues()
The values of each of the attributes on the MBean

Returns:
list of values of each attribute

listAttributeDescriptions

public Collection 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(javax.management.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 listOperationNames()
Names of all the operations available on the MBean.

Returns:
all the operations on the MBean

listOperationDescriptions

public Collection listOperationDescriptions()
Description of all of the operations available on the MBean.

Returns:
full description of each operation on the MBean

describeOperation

public List describeOperation(String operationName)
Get the dessciptions of the named operation. This returns a Collection since operations can be overloaded and one operationName can have multiple forms.

Parameters:
operationName -
Returns:
Collection of operation description

describeOperation

protected String describeOperation(javax.management.MBeanOperationInfo operation)
Dessciption of the named operation.

Parameters:
operation -
Returns:
description

toString

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

Returns:
the user readable description


Copyright © 2003-2007 The Codehaus. All Rights Reserved.