hudson.plugins.jboss
Class JMXUtils

java.lang.Object
  extended by hudson.plugins.jboss.JMXUtils

public class JMXUtils
extends java.lang.Object

This utility class contains static methods to help dealing with JBoss Managed Beans.

Author:
Juliusz Brzostek

Method Summary
static boolean checkDeploy(java.lang.String hostName, int jndiPort, hudson.model.BuildListener listener, int timeout, java.lang.String[] modules)
          Checks if given modules have been correctly deployed.
static boolean checkEARDeploymentState(hudson.model.BuildListener listener, javax.management.MBeanServerConnection server, java.lang.String earName)
          Checks if single EAR is deployed with no problems.
static boolean checkEJBDeploymentState(hudson.model.BuildListener listener, javax.management.MBeanServerConnection server, java.lang.String ejbName)
          Checks if single EJB module is deployed with no problems.
static boolean checkServerStatus(java.lang.String hostName, int jndiPort, hudson.model.BuildListener listener, int timeout, boolean ignoreErrors)
          Waits for server status.
static boolean checkWARDeploymentState(hudson.model.BuildListener listener, javax.management.MBeanServerConnection server, java.lang.String warName)
          Checks if single WAR is deployed with no problems.
static javax.naming.InitialContext getInitialContext(java.lang.String hostName, int jndiPort)
          Gets InitialContext from given server and port.
static javax.management.MBeanServerConnection getMBeanServer(javax.naming.InitialContext ctx, hudson.model.BuildListener listener, int timeout)
          Gets Managed Beans server for given naming context.
static boolean isServerStarted(javax.management.MBeanServerConnection server)
          Checks if Server is up using given MBean server connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInitialContext

public static javax.naming.InitialContext getInitialContext(java.lang.String hostName,
                                                            int jndiPort)
Gets InitialContext from given server and port.

Parameters:
hostName - Name of the server connect to
jndiPort - Port number of naming service
Returns:
Obtained InitialContext, or RuntimeException will thrown.

getMBeanServer

public static javax.management.MBeanServerConnection getMBeanServer(javax.naming.InitialContext ctx,
                                                                    hudson.model.BuildListener listener,
                                                                    int timeout)
Gets Managed Beans server for given naming context.

Parameters:
ctx - InitialContext used to lookup.
listener - used only for logging purpose
timeout - timeout of connection in seconds
Returns:
server connection or exception will thrown if failed

isServerStarted

public static boolean isServerStarted(javax.management.MBeanServerConnection server)
                               throws java.lang.Exception
Checks if Server is up using given MBean server connection.

Parameters:
server - given MBeanServerConnection
Returns:
true if server is up, false otherwise
Throws:
java.lang.Exception - A few types of exception can be thrown.

checkServerStatus

public static boolean checkServerStatus(java.lang.String hostName,
                                        int jndiPort,
                                        hudson.model.BuildListener listener,
                                        int timeout,
                                        boolean ignoreErrors)
Waits for server status. If server is not started checks status every second for 'timeout'.

Parameters:
hostName - name of the server connect to
jndiPort - port number of naming service
listener - BuildListener for logging purpose
timeout - how long will we wait for server start
ignoreErrors - if true any connection problems will be ignored
Returns:
true if server is up, false otherwise

checkDeploy

public static boolean checkDeploy(java.lang.String hostName,
                                  int jndiPort,
                                  hudson.model.BuildListener listener,
                                  int timeout,
                                  java.lang.String[] modules)
Checks if given modules have been correctly deployed.

Parameters:
hostName - name of the server connect to
jndiPort - port number of naming service
listener - BuildListener for logging purpose
timeout - how long will we wait for server start
Returns:
true if gone fine, false if any module have deployment problem

checkWARDeploymentState

public static boolean checkWARDeploymentState(hudson.model.BuildListener listener,
                                              javax.management.MBeanServerConnection server,
                                              java.lang.String warName)
Checks if single WAR is deployed with no problems. To check other states take a look on ServiceMBean.

Parameters:
listener - for logging purpose
server - given MBeanServerConnection
warName - the name of the WAR to be checked
Returns:
true if started, false otherwise

checkEARDeploymentState

public static boolean checkEARDeploymentState(hudson.model.BuildListener listener,
                                              javax.management.MBeanServerConnection server,
                                              java.lang.String earName)
Checks if single EAR is deployed with no problems. To check other states take a look on ServiceMBean.

Parameters:
listener - for logging purpose
server - given MBeanServerConnection
earName - the name of the EAR to be checked
Returns:
true if started, false otherwise

checkEJBDeploymentState

public static boolean checkEJBDeploymentState(hudson.model.BuildListener listener,
                                              javax.management.MBeanServerConnection server,
                                              java.lang.String ejbName)
Checks if single EJB module is deployed with no problems. To check other states take a look on ServiceMBean.

Parameters:
listener - for logging purpose
server - given MBeanServerConnection
ejbName - the name of the EJB module to be checked
Returns:
true if started, false otherwise


Copyright © 2004-2011. All Rights Reserved.