org.ow2.jasmine.monitoring.mbeancmd
Class JmxAP

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.JmxAP

public class JmxAP
extends java.lang.Object

A JMX Access Point.


Field Summary
static java.lang.String DEFAULT_FILE
          Default name of the properties file.
static java.lang.String DEFAULT_URL
          Default JMX URL.
private static java.lang.String defaultTarget
          Default JMX target.
private  java.lang.String j2eeJmxUrl
          Current JMX URL.
private  javax.management.MBeanServerConnection jmxCnx
          Current JMX connection.
private static java.util.Map<java.lang.String,java.lang.String> jmxTargets
          Map of JMX targets.
 
Constructor Summary
JmxAP()
          Creates a JmxAP that connects to the default URL.
JmxAP(java.lang.String url)
          Creates a JmxAP that connects to a URL.
 
Method Summary
static java.lang.String getDefaultTarget()
           
static java.lang.String[] getJmxTargets()
           
static java.lang.String[] getJmxTargets(java.lang.String[] proposed)
          Gets the names of all JMX targets matching a certain criteria.
static java.lang.String getJmxUrl(java.lang.String name)
          Gets the JMX URL for a given server name.
 java.lang.String getJmxUrlASString()
           
 javax.management.MBeanServerConnection getMBeanServerConnection()
           
private static java.util.Properties getProperties(java.io.File propertyFile)
           
private static void load(java.io.File file)
          Loads all JMX connection properties from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jmxCnx

private javax.management.MBeanServerConnection jmxCnx
Current JMX connection.


j2eeJmxUrl

private java.lang.String j2eeJmxUrl
Current JMX URL.


defaultTarget

private static java.lang.String defaultTarget
Default JMX target.


DEFAULT_URL

public static final java.lang.String DEFAULT_URL
Default JMX URL.

See Also:
Constant Field Values

DEFAULT_FILE

public static final java.lang.String DEFAULT_FILE
Default name of the properties file.

See Also:
Constant Field Values

jmxTargets

private static java.util.Map<java.lang.String,java.lang.String> jmxTargets
Map of JMX targets.

Constructor Detail

JmxAP

public JmxAP(java.lang.String url)
Creates a JmxAP that connects to a URL.

Parameters:
url - URL to connect to.

JmxAP

public JmxAP()
Creates a JmxAP that connects to the default URL.

Method Detail

getJmxUrlASString

public java.lang.String getJmxUrlASString()
Returns:
The String version of the JMX URL connected to.

getMBeanServerConnection

public javax.management.MBeanServerConnection getMBeanServerConnection()
Returns:
The MBeanServerConnection instance used to connect to the J2EE server via JMX.

getProperties

private static java.util.Properties getProperties(java.io.File propertyFile)
                                           throws java.io.IOException
Parameters:
propertyFile - File name of the properties file.
Returns:
Parsed version of the propertyFile file.
Throws:
java.io.IOException - If propertyFile cannot be read.

getJmxUrl

public static java.lang.String getJmxUrl(java.lang.String name)
Gets the JMX URL for a given server name.

Parameters:
name - Name of the server.
Returns:
JMX URL corresponding to that server name.

getJmxTargets

public static java.lang.String[] getJmxTargets()
Returns:
An array containing the names of all current JMX targets.

getJmxTargets

public static java.lang.String[] getJmxTargets(java.lang.String[] proposed)
Gets the names of all JMX targets matching a certain criteria.

Parameters:
proposed - Criteria.
Returns:
An array containing the names of all current JMX targets.

getDefaultTarget

public static java.lang.String getDefaultTarget()
Returns:
Default target.

load

private static void load(java.io.File file)
Loads all JMX connection properties from a file.

Parameters:
file - File to load JMX properties from.