org.objectweb.jonas.webapp.jonasadmin
Class JonasManagementRepr

java.lang.Object
  extended by org.objectweb.jonas.webapp.jonasadmin.JonasManagementRepr

public class JonasManagementRepr
extends Object

Wrapper class allowing to apply a management operations (getAttribute, setAttribute, invoke, etc.) on the corresponding to managed server's connection. The managed server is identified by a name (serverName parameter). The corresponding connection is kept in the serverConnections table.

Author:
Adriana Danes

Constructor Summary
JonasManagementRepr()
           
 
Method Summary
static Object getAttribute(ObjectName on, String attribute, String serverName)
          Gets the value of a specific attribute of a named MBean.
static AttributeList getAttributes(ObjectName on, String[] attributes, String serverName)
          Gets the values of several attributes of a named MBean.
static MBeanInfo getMBeanInfo(ObjectName on, String serverName)
           
static Object invoke(ObjectName on, String operation, Object[] param, String[] signature, String serverName)
          Invokes an operation on an MBean.
static boolean isRegistered(ObjectName on, String serverName)
           
static Set queryNames(ObjectName on, String serverName)
           
static void setAttribute(ObjectName on, String attribute, Object value, String serverName)
          Sets the value of a specific attribute of a named MBean.
static void setAttributes(ObjectName on, AttributeList attributes, String serverName)
           
static void unregisterMBean(ObjectName on, String serverName)
          Unregisters an MBean from the managed server's MBean server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JonasManagementRepr

public JonasManagementRepr()
Method Detail

isRegistered

public static boolean isRegistered(ObjectName on,
                                   String serverName)
                            throws ManagementException
Parameters:
on - ObjectName of the MBean we are looking for
serverName - The server name
Returns:
True if the MBean is already registered in the MBean server, false otherwise or if an exception is catched.
Throws:
ManagementException - management operation failed

getAttribute

public static Object getAttribute(ObjectName on,
                                  String attribute,
                                  String serverName)
                           throws ManagementException
Gets the value of a specific attribute of a named MBean.

Parameters:
on - The ObjectName of the MBean.
attribute - A String specifying the name of the attribute to be retrieved.
serverName - The server name
Returns:
The value of the attribute.
Throws:
ManagementException - management operation failed

getAttributes

public static AttributeList getAttributes(ObjectName on,
                                          String[] attributes,
                                          String serverName)
                                   throws ManagementException
Gets the values of several attributes of a named MBean.

Parameters:
on - The ObjectName of the MBean.
attributes - Array of attribute names to be retrieved.
serverName - The server name
Returns:
The value of the attribute.
Throws:
ManagementException - management operation failed

setAttribute

public static void setAttribute(ObjectName on,
                                String attribute,
                                Object value,
                                String serverName)
                         throws ManagementException
Sets the value of a specific attribute of a named MBean.

Parameters:
on - The ObjectName of the MBean.
serverName - The server name
attribute - A String specifying the name of the attribute to be set.
value - The value to set to the attribute.
Throws:
ManagementException - management operation failed

setAttributes

public static void setAttributes(ObjectName on,
                                 AttributeList attributes,
                                 String serverName)
                          throws ManagementException
Parameters:
on - The ObjectName of the MBean within which the attribute is to be set.
serverName - The server name
attributes - A list of attributes: The identification of the attribute to be set and the value it is to be set to
Throws:
ManagementException - management operation failed

invoke

public static Object invoke(ObjectName on,
                            String operation,
                            Object[] param,
                            String[] signature,
                            String serverName)
                     throws ManagementException
Invokes an operation on an MBean.

Parameters:
on - MBean name
operation - operation to invoke
param - invoke parameters
signature - invoke parameters signature
serverName - The server name
Returns:
The object returned by the operation
Throws:
ManagementException - management operation failed

queryNames

public static Set queryNames(ObjectName on,
                             String serverName)
                      throws ManagementException
Parameters:
on - MBean name
serverName - The server name
Returns:
A set containing the ObjectNames for the MBeans selected.
Throws:
ManagementException - management operation failed

getMBeanInfo

public static MBeanInfo getMBeanInfo(ObjectName on,
                                     String serverName)
                              throws ManagementException
Parameters:
name - MBean's ObjectName
serverName - The server name
Returns:
An instance of MBeanInfo allowing the retrieval of all attributes and operations of this MBean.
Throws:
ManagementException - management operation failed

unregisterMBean

public static void unregisterMBean(ObjectName on,
                                   String serverName)
                            throws ManagementException
Unregisters an MBean from the managed server's MBean server.

Parameters:
on - The object name of the MBean.
serverName - The server name
Throws:
ManagementException - wraps exception thrown by the called management operation


Copyright © 2007 OW2 Consortium. All Rights Reserved.