org.ow2.jonas.cluster.daemon.mbean
Class JMXRemoteHelper

java.lang.Object
  extended by org.ow2.jonas.cluster.daemon.mbean.JMXRemoteHelper

public final class JMXRemoteHelper
extends 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 MBeanServerConnection connect(String url)
          Connect to a JMX Remote connector by calling connect(String, String, String)(url, null, null).
static MBeanServerConnection connect(String url, String username, String password)
          Connect to a JMX Remote connector.
static ObjectInstance getInstance(MBeanServerConnection cnx, String pattern)
          Get ObjectInstance
static void startConnector(String url, String connectorName)
          Calls startConnector(String, String, Map)(url, connectorName, null).
static JMXConnectorServer startConnector(String url, String connectorName, Map<String,String> 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 MBeanServerConnection connect(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 MBeanServerConnection connect(String url,
                                            String username,
                                            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(String url,
                                  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 JMXConnectorServer startConnector(String url,
                                                String connectorName,
                                                Map<String,String> 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 ObjectInstance getInstance(MBeanServerConnection cnx,
                                         String pattern)
Get ObjectInstance

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


Copyright © 2010 OW2 Consortium. All Rights Reserved.