org.objectweb.jonas.jmx.commons
Class JMXRemoteHelper

java.lang.Object
  extended by org.objectweb.jonas.jmx.commons.JMXRemoteHelper

public final class JMXRemoteHelper
extends java.lang.Object

This helper class allow to start a JMX remote connector allowing to connect remote applications. This could be for example a JSR88 provider.

Author:
Florent Benoit, S. Ali Tokmen

Method Summary
static javax.management.MBeanServerConnection connect(java.lang.String url)
          Connect to a JMX Remote connector by calling connect(String, String, String)(url, null, null).
static javax.management.MBeanServerConnection connect(java.lang.String url, java.lang.String username, java.lang.String password)
          Connect to a JMX Remote connector.
static javax.management.ObjectInstance getInstance(javax.management.MBeanServerConnection cnx, java.lang.String pattern)
          Get ObjectInstance
static void startConnector(java.lang.String url, java.lang.String connectorName)
          Calls startConnector(String, String, Map)(url, connectorName, null).
static javax.management.remote.JMXConnectorServer startConnector(java.lang.String url, java.lang.String connectorName, java.util.Map env)
          Start a JMX connector (used to do remote administration).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

connect

public static javax.management.MBeanServerConnection connect(java.lang.String url)
                                                      throws JMXRemoteException
Connect to a JMX Remote connector by calling connect(String, String, String)(url, null, null).

Parameters:
url - JMX remote url.
Returns:
MBeanServerConnection MBean server connection
Throws:
JMXRemoteException - if jmx connector can't be connected.

connect

public static javax.management.MBeanServerConnection connect(java.lang.String url,
                                                             java.lang.String username,
                                                             java.lang.String password)
                                                      throws JMXRemoteException
Connect to a JMX Remote connector. If either username or password (or both) is null, no credentials are provided for connection.

Parameters:
url - JMX remote url.
username - User name to use, can be null.
password - Password to use, can be null.
Returns:
MBeanServerConnection MBean server connection
Throws:
JMXRemoteException - if jmx connector can't be connected.

startConnector

public static void startConnector(java.lang.String url,
                                  java.lang.String connectorName)
                           throws JMXRemoteException
Calls startConnector(String, String, Map)(url, connectorName, null).

Parameters:
url - JMX remote url
connectorName - connector name
Throws:
JMXRemoteException - if the connector can't be started.

startConnector

public static javax.management.remote.JMXConnectorServer startConnector(java.lang.String url,
                                                                        java.lang.String connectorName,
                                                                        java.util.Map env)
                                                                 throws JMXRemoteException
Start a JMX connector (used to do remote administration).

Parameters:
url - JMX remote url
connectorName - connector name
env - Environment to use as base when creating the connector, used to provide security. Can be null.
Returns:
The created JMX connector server.
Throws:
JMXRemoteException - if the connector can't be started.

getInstance

public static javax.management.ObjectInstance getInstance(javax.management.MBeanServerConnection cnx,
                                                          java.lang.String pattern)
Get ObjectInstance

Parameters:
cnx - MBean server connection
pattern - MBean name
Returns:
ObjectInstance