org.objectweb.petals.tools.webadmin.util
Class JMXUtils

java.lang.Object
  extended by org.objectweb.petals.tools.webadmin.util.JMXUtils

public final class JMXUtils
extends java.lang.Object


Method Summary
 java.util.List<ServerConfiguration> getAllServers(ServerConfiguration serverConf)
          Returns all servers of the domain, started and stopped, via a JMX call to a known server
static JMXUtils getJMXUtils()
          returns the singleton JMXUtils object
 java.lang.String getServerName(ServerConfiguration serverConf)
          Returns a server's name, based on his jmx informations
 java.util.List<ServerConfiguration> getStartedServers(ServerConfiguration serverConf)
          Retrieve all servers actually started on a domain via a JMX call to a server known.
 java.util.Map<java.lang.String,JBIEntity> listComponents(javax.management.MBeanServerConnection connection)
          Return all components installed on a server.
 java.util.Map<java.lang.String,JBIEntity> listComponents(javax.management.MBeanServerConnection connection, java.lang.String type)
          Lists the deployed JBI components of a specified type.
 boolean petalsServerReachable(ServerConfiguration serverConf)
          Indicates if a PEtALS server is accessible via JMX or not by calling a getAttribute on the administration MBean via his connection attribute
 javax.management.remote.JMXConnector retrieveConnector(ServerConfiguration serverConf)
          Retrieve a JMX connector for a given server
 javax.management.remote.JMXConnector retrieveConnector(java.lang.String host, java.lang.String jmxPort, java.lang.String jmxLogin, java.lang.String jmxPassword)
          Retrieve a JMX connector for a server with connection parameters given
 boolean storageServerReachable(ServerConfiguration serverConf)
          Indicates if a storage server is reachable by calling a getAttribute on its administration MBean via his connection attribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getJMXUtils

public static JMXUtils getJMXUtils()
returns the singleton JMXUtils object

Returns:

getAllServers

public java.util.List<ServerConfiguration> getAllServers(ServerConfiguration serverConf)
                                                  throws java.io.IOException,
                                                         javax.management.MBeanException,
                                                         javax.management.AttributeNotFoundException
Returns all servers of the domain, started and stopped, via a JMX call to a known server

Parameters:
serverConf - the ServerConfiguration of a server known on the domain
Returns:
list of server's configurations
Throws:
java.io.IOException - PEtALS server to contact is unreachable
javax.management.MBeanException - a communication occured when getting servers
javax.management.AttributeNotFoundException

getServerName

public java.lang.String getServerName(ServerConfiguration serverConf)
                               throws javax.management.MBeanException,
                                      java.io.IOException,
                                      javax.management.AttributeNotFoundException
Returns a server's name, based on his jmx informations

Parameters:
serverConf - the configuration of the server
Returns:
the name of the server, null if not found
Throws:
java.io.IOException
javax.management.MBeanException
javax.management.AttributeNotFoundException

getStartedServers

public java.util.List<ServerConfiguration> getStartedServers(ServerConfiguration serverConf)
                                                      throws java.io.IOException,
                                                             javax.management.MBeanException,
                                                             javax.management.AttributeNotFoundException
Retrieve all servers actually started on a domain via a JMX call to a server known.

Parameters:
serverConf - the ServerConfiguration of a server known on the domain
Returns:
list of server's configurations
Throws:
java.io.IOException - PEtALS server to contact is unreachable
javax.management.MBeanException - a communication occured when getting servers
javax.management.AttributeNotFoundException

listComponents

public java.util.Map<java.lang.String,JBIEntity> listComponents(javax.management.MBeanServerConnection connection)
                                                         throws javax.management.MBeanException
Return all components installed on a server. Connection must be non null and server must be accessible via this connection.

Parameters:
connection - a MBeanServerConnection to the server
Returns:
a Map of JBIEntity components as
Throws:
javax.management.MBeanException

listComponents

public java.util.Map<java.lang.String,JBIEntity> listComponents(javax.management.MBeanServerConnection connection,
                                                                java.lang.String type)
                                                         throws javax.management.MBeanException
Lists the deployed JBI components of a specified type. Connection must be non null and server must be accessible via this connection.

Parameters:
connection - a MBeanServerConnection to the server
type - type of component : BC for Binding Components, SE for Service Engine, ALL for both BC and SE
Returns:
a Map of JBIEntity components as
Throws:
javax.management.MBeanException
java.lang.Exception

retrieveConnector

public javax.management.remote.JMXConnector retrieveConnector(ServerConfiguration serverConf)
                                                       throws java.io.IOException
Retrieve a JMX connector for a given server

Returns:
a JMXConnector
Throws:
java.io.IOException

retrieveConnector

public javax.management.remote.JMXConnector retrieveConnector(java.lang.String host,
                                                              java.lang.String jmxPort,
                                                              java.lang.String jmxLogin,
                                                              java.lang.String jmxPassword)
                                                       throws java.io.IOException
Retrieve a JMX connector for a server with connection parameters given

Returns:
a JMXConnector
Throws:
java.io.IOException

petalsServerReachable

public boolean petalsServerReachable(ServerConfiguration serverConf)
Indicates if a PEtALS server is accessible via JMX or not by calling a getAttribute on the administration MBean via his connection attribute

Parameters:
serverConf - the server's configuration of the server to test
Returns:
true if server responds, false if not or if an exception occured

storageServerReachable

public boolean storageServerReachable(ServerConfiguration serverConf)
Indicates if a storage server is reachable by calling a getAttribute on its administration MBean via his connection attribute

Parameters:
serverConf - the configuration of the server to test
Returns:
true if server replies correctly, false if not or if an exception occured


Copyright © 2005-2007 ObjectWeb Consortium. All Rights Reserved.