org.objectweb.jonas.management.monitoring.proxy
Class JMXProxy

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

public abstract class JMXProxy
extends Object

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

Author:
durieuxp

Field Summary
protected  MBeanServerConnection connection
          JMX connection
protected  JMXConnector connector
          JMX Connector
protected  DomainMonitor dm
          ref on the DomainMonitor
protected  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  JmxService jmx
           
protected static org.objectweb.util.monolog.api.Logger logger
          logger for traces.
protected  String name
          Unique name of the remote object
protected  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  ObjectName serverOn
          The server's ObjectName (this corresponds to the J2EEServer MBean registered in the represented server's MBean server)
static int STARTING
          Server is starting (temporary state)
protected  int state
          State of the remote object (as seen from the proxy)
static int STOPPED
          Server is stopped
static int STOPPING
          Server is stopping (temporary state)
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  ArrayList urls
          List of urls that can be used for connection
 
Constructor Summary
JMXProxy(DomainMonitor dm, String name, Collection urls)
          Constructor
 
Method Summary
protected  boolean checkConnection()
          Check the established connection to the remote object, or try to establish a connection if the connection object is null.
 boolean connect(Collection urls)
          Try to connect this Proxy to its Server
 void disconnect()
          Disconnect the proxy
 Object getAttribute(ObjectName on, String attribute)
          Get an MBean Attribute on the remote server
 AttributeList getAttributes(ObjectName on, String[] attributes)
          Get a group of MBean Attributes on the remote server
 MBeanServerConnection getConnection()
           
 String getConnectionUrl()
           
 String getDomain()
           
 String getName()
           
 String getObjectName()
          Return this MBean's name
 int getServerState()
          Return the int giving the server state
 String getState()
          MBean method returning the state as a String Return the String form of the server state
 ArrayList getUrls()
           
 boolean isRegistered(ObjectName on)
          Check if an ObjectName is registered on the remote server
 Set queryNames(ObjectName on)
           
 void setObjectName(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 String name
Unique name of the remote object


objectName

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


urls

protected ArrayList urls
List of urls that can be used for connection


connection

protected MBeanServerConnection connection
JMX connection


connector

protected JMXConnector connector
JMX Connector


env

protected Map env
Environment used to get the connection


jmx

protected JmxService jmx

serverOn

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


dm

protected DomainMonitor dm
ref on the DomainMonitor


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

STARTING

public static final int STARTING
Server is starting (temporary state)

See Also:
Constant Field Values

STOPPING

public static final int STOPPING
Server is stopping (temporary state)

See Also:
Constant Field Values
Constructor Detail

JMXProxy

public JMXProxy(DomainMonitor dm,
                String name,
                Collection urls)
Constructor

Parameters:
name - the proxy name
urls - the urls that can be used to establish connection
dm - reference to the domain monitor
Method Detail

getServerState

public int getServerState()
Return the int giving the server state

Returns:
the state value as an int

getState

public String getState()
MBean method returning the state as a String Return the String form of the server state

Returns:
the state value

disconnect

public void disconnect()
Disconnect the proxy


connect

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

Parameters:
urls - the urls that can be used to establish connection
Returns:
True if connected

checkConnection

protected boolean checkConnection()
Check the established connection to the remote object, or try to establish a connection if the connection object is null.

Returns:
true if connection is ok.

getName

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

getObjectName

public String getObjectName()
Return this MBean's name

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

setObjectName

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

Parameters:
on - OBJECT_NAME

getConnection

public MBeanServerConnection getConnection()
Returns:
the connection to the remote MBean server

isRegistered

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

Parameters:
on - the ObjectName to be checked
Returns:
true if registered

getAttribute

public Object getAttribute(ObjectName on,
                           String attribute)
Get an MBean Attribute on the remote server

Parameters:
on - the MBean's ObjectName
attribute - the attribute name
Returns:
the attribute value

getAttributes

public AttributeList getAttributes(ObjectName on,
                                   String[] attributes)
Get a group of MBean Attributes on the remote server

Parameters:
on - the MBean's ObjectName
attributes - the attributes names
Returns:
a list of Attribute objects containing for each attribute its name and value

queryNames

public Set queryNames(ObjectName on)
Parameters:
on - the MBean's ObjectName
Returns:
A set containing the ObjectNames for the MBeans selected.

getDomain

public String getDomain()
Returns:
the current domain name

getConnectionUrl

public String getConnectionUrl()
Returns:
the URL of the current connection

getUrls

public ArrayList getUrls()
Returns:
the urls that can be used for connection


Copyright © 2007 OW2 Consortium. All Rights Reserved.