org.ow2.jonas.lib.management.domain.proxy
Class JMXProxy

java.lang.Object
  extended by org.ow2.jonas.lib.management.domain.proxy.JMXProxy
Direct Known Subclasses:
ClusterDaemonProxy, ServerProxy

public class JMXProxy
extends Object

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

Author:
durieuxp, S. Ali Tokmen

Field Summary
protected static org.objectweb.util.monolog.api.Logger logger
          logger for traces.
 
Constructor Summary
JMXProxy(DomainMonitor dm, String name, Collection urls)
          Constructor.
 
Method Summary
protected  boolean checkConnection()
          Check the established connection to the remote server, 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()
           
 DomainMonitor getDm()
           
 String getDomain()
           
 J2EEServerState getJ2EEServerState()
          Only used by ServerProxy.
 String getName()
           
 String getObjectName()
          Return this MBean's name.
 String getState()
          MBean method returning the state.
 ArrayList getUrls()
           
 boolean isRegistered(ObjectName on)
          Check if an ObjectName is registered on the remote server.
 Set queryNames(ObjectName on)
           
 void setAttribute(ObjectName on, String attribute, Object value)
          Set an MBean Attribute on the remote server.
 void setConnection(MBeanServerConnection connection)
          Set connection to the managed server's MBeanServer.
 void setObjectName(String on)
          Set its OBJECT_NAME and register the MBean.
protected  void setState(J2EEServerState state)
          Change state.
 
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.

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

getState

public String getState()
MBean method returning the state.

Returns:
the state value

getJ2EEServerState

public J2EEServerState getJ2EEServerState()
Only used by ServerProxy.

Returns:
state

setState

protected void setState(J2EEServerState state)
Change state.

Parameters:
state - new state

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 server, or try to establish a connection if the connection object is null.

Returns:
true if connection is ok. false otherwise.

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

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

setConnection

public void setConnection(MBeanServerConnection connection)
Set connection to the managed server's MBeanServer. Currently this method is called only in the case of a master server which creates its own ServerProxy.

Parameters:
connection - connection to the managed MBeanServer.

getDm

public DomainMonitor getDm()
Returns:
reference of DomainMonitor

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

setAttribute

public void setAttribute(ObjectName on,
                         String attribute,
                         Object value)
Set an MBean Attribute on the remote server.

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

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.


Copyright © 2010 OW2 Consortium. All Rights Reserved.