com.maxiq.tools.jboss
Class JMXProxy

java.lang.Object
  |
  +--com.maxiq.tools.jboss.JMXProxy

public class JMXProxy
extends java.lang.Object

Wraps the JMXRMIAdaptor in proper classloading to remove completely any dependency on JBoss (and management) classes. For best performance, create one instance then repeatedly call "invoke" with proper arguments.
Note that the system property com.maxiq.tools.jboss.home" should be properly set to the home of a running JBoss installation.

Author:
Florin Vancea

Constructor Summary
JMXProxy()
          Plain constructor.
JMXProxy(java.lang.String serverName)
          Constructor from server name.
JMXProxy(java.lang.String jndiURL, java.lang.String rmiJndiName)
          Constructor from JNDI URL of target server and JNDI name of RMI adapter.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String objectName, java.lang.String attrName)
          Obtains the value of an attribute on a remote MBean.
 java.lang.Object invoke(java.lang.String objectName, java.lang.String methodName, java.lang.Object[] args)
          Invokes a method on a remote MBean.
 java.lang.Object invoke(java.lang.String objectName, java.lang.String methodName, java.lang.Object[] args, java.lang.String[] typeName)
          Invokes a method on a remote MBean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMXProxy

public JMXProxy()
         throws JBossNotAvailable
Plain constructor. The server name is auto-determined.
Throws:
JBossNotAvailable - when we suspect there's no JBoss in the backend

JMXProxy

public JMXProxy(java.lang.String serverName)
         throws JBossNotAvailable
Constructor from server name.
Parameters:
serverName - The name of the server machine.
Throws:
JBossNotAvailable - when we suspect there's no JBoss in the backend

JMXProxy

public JMXProxy(java.lang.String jndiURL,
                java.lang.String rmiJndiName)
         throws JBossNotAvailable
Constructor from JNDI URL of target server and JNDI name of RMI adapter.
Parameters:
jndiURL - Seed URL of target server JNDI system
rmiJndiName - JNDI name of RMI adaptor.
Throws:
JBossNotAvailable - when we suspect there's no JBoss in the backend
Method Detail

invoke

public java.lang.Object invoke(java.lang.String objectName,
                               java.lang.String methodName,
                               java.lang.Object[] args,
                               java.lang.String[] typeName)
Invokes a method on a remote MBean. It's similar to the invoke(...) method of the RMIAdaptor from the JBoss kit. No need to worry about classloading issues; they are handled internally.
Parameters:
objectName - Name of the MBean. (Note: in RMIAdaptor this is a ObjectName)
methodName - Method name.
args - Array of arguments passed as plain Object(s)
typeName - Array of type names passed as String(s).
Returns:
The result (if any)

invoke

public java.lang.Object invoke(java.lang.String objectName,
                               java.lang.String methodName,
                               java.lang.Object[] args)
Invokes a method on a remote MBean. Similar with invoke(String, String, Object[], String[]) but auto-determines the type names. If one of the args is null, assumes String type.
Parameters:
objectName - Name of the MBean. (Note: in RMIAdaptor this is a ObjectName)
methodName - Method name.
args - An array of Objects to be used as params.
Returns:
The result (if any)

getAttribute

public java.lang.Object getAttribute(java.lang.String objectName,
                                     java.lang.String attrName)
Obtains the value of an attribute on a remote MBean. It's similar to getAttribute(...) method of the RMIAdaptor from the JBoss kit. No need to worry about classloading issues; they are handled internally.
Parameters:
objectName - Name of the MBean. (Note: in RMIAdaptor this is a ObjectName)
attrName - The name of the attribute.
Returns:
The attribute value


Copyright © 2003 MaxIQ. All Rights Reserved.