Savarese.Org

org.savarese.unicorn.ui
Class MBeanPanelModel

java.lang.Object
  extended by org.savarese.unicorn.ui.AbstractObjectPanelModel<javax.management.ObjectName>
      extended by org.savarese.unicorn.ui.MBeanPanelModel
All Implemented Interfaces:
ObjectPanelModel<javax.management.ObjectName>

public class MBeanPanelModel
extends AbstractObjectPanelModel<javax.management.ObjectName>

An ObjectPanelModel implementation for JMX MBeans.


Field Summary
 
Fields inherited from class org.savarese.unicorn.ui.AbstractObjectPanelModel
_listeners_, _object_
 
Constructor Summary
MBeanPanelModel(javax.management.ObjectName mbean, javax.management.MBeanServerConnection conn)
          Instantiates an MBeanPanelModel that wraps the provided MBean, accessed via the provided MBeanServerConnection.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attribute)
          Retrieves a named attribute from the adapted object.
 javax.management.MBeanInfo getObjectInfo()
          Returns a description of the object.
 java.lang.Object invoke(java.lang.String operation, java.lang.Object[] params, java.lang.Class[] types, java.lang.String[] signature)
          Invokes an operation of the adapted object and returns its result, if any.
 boolean isValid()
          Determines if the model is in a valid state.
 void setAttribute(java.lang.String attribute, java.lang.Object value)
          Sets the value of a named attribute of the adapted object.
 void setConnection(javax.management.MBeanServerConnection conn)
          Sets the MBeanServerConnection via which the MBean can be accessed.
 void setObject(javax.management.ObjectName mbean)
          Sets the object to be adapted to the interface.
 
Methods inherited from class org.savarese.unicorn.ui.AbstractObjectPanelModel
_notifyListeners_, addObjectPanelModelListener, getObject, getObjectName, removeObjectPanelModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanPanelModel

public MBeanPanelModel(javax.management.ObjectName mbean,
                       javax.management.MBeanServerConnection conn)
Instantiates an MBeanPanelModel that wraps the provided MBean, accessed via the provided MBeanServerConnection.

Parameters:
mbean - The ObjectName of the MBean to wrap.
conn - The MBeanServerConnection via which the MBean can be accessed.
Method Detail

setAttribute

public void setAttribute(java.lang.String attribute,
                         java.lang.Object value)
                  throws javax.management.JMException,
                         java.io.IOException
Description copied from interface: ObjectPanelModel
Sets the value of a named attribute of the adapted object.

Parameters:
attribute - The name of the attribute to set.
value - The new value of the attribute.
Throws:
javax.management.AttributeNotFoundException - If the attribute does not exist.
javax.management.JMException
java.io.IOException

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              throws javax.management.JMException,
                                     java.io.IOException
Description copied from interface: ObjectPanelModel
Retrieves a named attribute from the adapted object.

Parameters:
attribute - The name of the attribute to retrieve.
Returns:
The attribute corresponding to the provided name.
Throws:
javax.management.AttributeNotFoundException - If the attribute does not exist.
javax.management.JMException
java.io.IOException

setConnection

public void setConnection(javax.management.MBeanServerConnection conn)
Sets the MBeanServerConnection via which the MBean can be accessed.


setObject

public void setObject(javax.management.ObjectName mbean)
Description copied from interface: ObjectPanelModel
Sets the object to be adapted to the interface.

Specified by:
setObject in interface ObjectPanelModel<javax.management.ObjectName>
Overrides:
setObject in class AbstractObjectPanelModel<javax.management.ObjectName>
Parameters:
mbean - The object to be adapted.

invoke

public java.lang.Object invoke(java.lang.String operation,
                               java.lang.Object[] params,
                               java.lang.Class[] types,
                               java.lang.String[] signature)
                        throws javax.management.JMException,
                               java.io.IOException
Description copied from interface: ObjectPanelModel
Invokes an operation of the adapted object and returns its result, if any.

Parameters:
operation - The name of the operation to invoke.
params - An array of parameters for the operation.
types - An array containing the types of the operation parameters.
signature - A string representation of the types (i.e., the fully qualified class names) of the operation parameters.
Returns:
The result of the operation, if any.
Throws:
javax.management.JMException
java.io.IOException

getObjectInfo

public javax.management.MBeanInfo getObjectInfo()
Description copied from interface: ObjectPanelModel
Returns a description of the object.

Returns:
The a description of the object.

isValid

public boolean isValid()
Description copied from interface: ObjectPanelModel
Determines if the model is in a valid state. A model may be rendered invalid if it has no object, if an exception is occurs during a remote invocation operation, or any number of reasons specific to the model implementation.

Specified by:
isValid in interface ObjectPanelModel<javax.management.ObjectName>
Overrides:
isValid in class AbstractObjectPanelModel<javax.management.ObjectName>
Returns:
True if the model is in a valid state, false if not.

Savarese.Org

Copyright © 2006 Daniel F. Savarese. All Rights Reserved.