org.jboss.on.common.jbossas
Class JmxConnectionHelper

java.lang.Object
  extended by org.jboss.on.common.jbossas.JmxConnectionHelper

public class JmxConnectionHelper
extends Object

Shared helper class to connect to a remote JMX server.

Author:
Heiko W. Rupp

Field Summary
static String CONNECTOR_ADDRESS
           
static String CONNECTOR_CREDENTIALS
           
static String CONNECTOR_DESCRIPTOR_TYPE
           
static String CONNECTOR_PRINCIPAL
           
static String JBOSS_HOME_DIR
           
 
Constructor Summary
JmxConnectionHelper(boolean copyConnectionLibraries, File tmpDir)
          Constructs a new connection helper.
 
Method Summary
 void closeConnection()
          If necessary attempt to close the EMS connection, then set this.connection null.
 org.mc4j.ems.connection.EmsConnection getEmsConnection()
          Obtain an EmsConnection.
 org.mc4j.ems.connection.EmsConnection getEmsConnection(org.rhq.core.domain.configuration.Configuration config)
          Obtain an EmsConnection for the passed connection properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTOR_DESCRIPTOR_TYPE

public static final String CONNECTOR_DESCRIPTOR_TYPE
See Also:
Constant Field Values

CONNECTOR_ADDRESS

public static final String CONNECTOR_ADDRESS
See Also:
Constant Field Values

CONNECTOR_PRINCIPAL

public static final String CONNECTOR_PRINCIPAL
See Also:
Constant Field Values

CONNECTOR_CREDENTIALS

public static final String CONNECTOR_CREDENTIALS
See Also:
Constant Field Values

JBOSS_HOME_DIR

public static final String JBOSS_HOME_DIR
See Also:
Constant Field Values
Constructor Detail

JmxConnectionHelper

public JmxConnectionHelper(boolean copyConnectionLibraries,
                           File tmpDir)
Constructs a new connection helper.

Parameters:
copyConnectionLibraries - whether to copy the libraries need for the connection so that the ems classloader doesn't block the application access to them.
tmpDir - the temporary directory to use when copying the libraries
Method Detail

getEmsConnection

public org.mc4j.ems.connection.EmsConnection getEmsConnection(org.rhq.core.domain.configuration.Configuration config)
Obtain an EmsConnection for the passed connection properties. The properties will be retained. To create a connection with different properties, use this method again with a different set of properties.

Parameters:
config - Configuration properties for this connection
Returns:
an EmsConnection or null in case of failure
See Also:
getEmsConnection()

getEmsConnection

public org.mc4j.ems.connection.EmsConnection getEmsConnection()
Obtain an EmsConnection. This will only work if the connection properties have passed before via a call to getEmsConnection(Configuration)

Returns:
an EmsConnection or null in case of failure
See Also:
getEmsConnection(org.rhq.core.domain.configuration.Configuration)

closeConnection

public void closeConnection()
If necessary attempt to close the EMS connection, then set this.connection null. Synchronized ensure we play well with loadConnection.



Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.