org.objectweb.jonas.management.monitoring
Class JMXProxy

java.lang.Object
  extended byorg.objectweb.jonas.management.monitoring.JMXProxy
Direct Known Subclasses:
ClusterDaemonProxy, ServerProxy

public abstract class JMXProxy
extends java.lang.Object

Abstract class acting as a JMXConnector client It is implemented by ServerProxy or ClusterDaemonProxy

Author:
durieuxp

Field Summary
protected  javax.management.MBeanServerConnection connection
          JMX connection
protected  javax.management.remote.JMXConnector connector
          JMX Connector
protected  java.lang.String domain
          Domain Name
protected  java.util.Map env
          Environment used to get the connection
static int FAILED
          Server which can't be reached after a several number of retries
static int INITIAL
          This is the initial state
protected  JmxServiceImpl jmx
           
protected static org.objectweb.util.monolog.api.Logger logger
          logger for traces.
protected  java.lang.String name
          Unique name of the remote object
protected  java.lang.String objectName
          The OBJECT_NAME of this Proxy MBean Must be initialized before checking connection.
static int RUNNING
          Server is RUNNING and its reacheable
protected  javax.management.ObjectName serverOn
          The server's ObjectName (this corresponds to the J2EEServer MBean registered in the represented server's MBean server)
protected  int state
          State of the remote object (as seen from the proxy)
static int STOPPED
          Server is stopped
static int UNKNOWN
          Server which started without the discovery and can't be reached after a several number of retries
static int UNREACHABLE
          This state is corresponding to the situation when the JMX connection is broken - maybe temporary.
protected  javax.management.remote.JMXServiceURL url
          Current URL used to contact the remote object
protected  java.util.ArrayList urls
          List of urls that can be used for connection
 
Constructor Summary
JMXProxy(DomainMonitor dm, java.lang.String name, java.util.Collection urls)
          Constructor
 
Method Summary
protected  boolean checkConnection()
          Check the connection to the remote object
 boolean connect(java.util.Collection urls)
          Try to connect this Proxy to its Server
 void disconnect()
          Disconnect the proxy
 java.lang.Object getAttribute(javax.management.ObjectName on, java.lang.String attribute)
          Get an MBean Attribute on the remote server
 javax.management.MBeanServerConnection getConnection()
           
 java.lang.String getName()
           
 java.lang.String getObjectName()
          Return this MBean's name
 int getServerState()
           
 java.lang.String getState()
          MBean method Return the String form of the server state
 boolean isRegistered(javax.management.ObjectName on)
          Check if an ObjectName is registered on the remote server
 java.util.Set queryNames(javax.management.ObjectName on)
           
 void setObjectName(java.lang.String on)
          Set its OBJECT_NAME and register the MBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.objectweb.util.monolog.api.Logger logger
logger for traces.


name

protected java.lang.String name
Unique name of the remote object


domain

protected java.lang.String domain
Domain Name


objectName

protected java.lang.String objectName
The OBJECT_NAME of this Proxy MBean Must be initialized before checking connection.


urls

protected java.util.ArrayList urls
List of urls that can be used for connection


connection

protected javax.management.MBeanServerConnection connection
JMX connection


connector

protected javax.management.remote.JMXConnector connector
JMX Connector


url

protected javax.management.remote.JMXServiceURL url
Current URL used to contact the remote object


env

protected java.util.Map env
Environment used to get the connection


jmx

protected JmxServiceImpl jmx

serverOn

protected javax.management.ObjectName serverOn
The server's ObjectName (this corresponds to the J2EEServer MBean registered in the represented server's MBean server)


state

protected int state
State of the remote object (as seen from the proxy)


INITIAL

public static final int INITIAL
This is the initial state

See Also:
Constant Field Values

UNREACHABLE

public static final int UNREACHABLE
This state is corresponding to the situation when the JMX connection is broken - maybe temporary.

See Also:
Constant Field Values

RUNNING

public static final int RUNNING
Server is RUNNING and its reacheable

See Also:
Constant Field Values

STOPPED

public static final int STOPPED
Server is stopped

See Also:
Constant Field Values

FAILED

public static final int FAILED
Server which can't be reached after a several number of retries

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
Server which started without the discovery and can't be reached after a several number of retries

See Also:
Constant Field Values
Constructor Detail

JMXProxy

public JMXProxy(DomainMonitor dm,
                java.lang.String name,
                java.util.Collection urls)
Constructor

Parameters:
name -
Method Detail

getServerState

public int getServerState()

getState

public java.lang.String getState()
MBean method Return the String form of the server state

Returns:

disconnect

public void disconnect()
Disconnect the proxy


connect

public boolean connect(java.util.Collection urls)
Try to connect this Proxy to its Server

Parameters:
urls -
Returns:
True if connected

checkConnection

protected boolean checkConnection()
Check the connection to the remote object

Returns:
true if connection is ok.

getName

public java.lang.String getName()
Returns:
The name of the remote object

getObjectName

public java.lang.String getObjectName()
Return this MBean's name

Returns:
The name of the MBean (see OBJECT_NAME in the JSR77)

setObjectName

public void setObjectName(java.lang.String on)
Set its OBJECT_NAME and register the MBean

Parameters:
on - OBJECT_NAME

getConnection

public javax.management.MBeanServerConnection getConnection()

isRegistered

public boolean isRegistered(javax.management.ObjectName on)
Check if an ObjectName is registered on the remote server

Parameters:
on -
Returns:
true if registered

getAttribute

public java.lang.Object getAttribute(javax.management.ObjectName on,
                                     java.lang.String attribute)
Get an MBean Attribute on the remote server


queryNames

public java.util.Set queryNames(javax.management.ObjectName on)
Returns:
A set containing the ObjectNames for the MBeans selected.