com.maxiq.tools.jboss
Class JMXDeploymentMonitor

java.lang.Object
  |
  +--com.maxiq.tools.jboss.JMXBean
        |
        +--com.maxiq.tools.jboss.JMXDeploymentMonitor

public class JMXDeploymentMonitor
extends JMXBean

Bean capable of monitoring the deployment status of a particular artifact into the JBoss environment. Upon a call to execute() a polled wait is performed until the specified condition is met or timeout occurs.
Note that the system property com.maxiq.tools.jboss.home" should be properly set to the home of a running JBoss installation.

Author:
Florin Vancea

Constructor Summary
JMXDeploymentMonitor()
           
 
Method Summary
 void execute()
          "execute" method allows using this as Ant task via Ant's proxy.
 java.lang.String getFile()
          Get the artifact as a file path.
 long getTimeout()
          Get timeout (msec).
 java.lang.String getUrl()
          Get the URL of the artifact as a String.
 boolean getWantedStatus()
          Get wanted deployment status.
 boolean isDeployed()
          Checks the deployment status of the specified artifact.
 void setFile(java.lang.String file)
          Set the artifact as a file path.
 void setTimeout(long msec)
          Set timeout (msec).
 void setUrl(java.lang.String url)
          Set the URL of the artifact as a String.
 void setWantedStatus(boolean wantedStatus)
          Set wanted deployment status.
 boolean waitForDeploy(boolean expectedStatus)
          Convenience method for "bean mode".
Waits for the deployment status to be expectedStatus.
 boolean waitForStatus(java.net.URL artifact, boolean wantedDepStatus, long timeout)
          Waits for the specified goal to be attained or for timeout to occur.
 
Methods inherited from class com.maxiq.tools.jboss.JMXBean
addArgument, addArgument, clearArguments, doExecute, getJbhome, getJndiurl, getLastReturnValue, getMbean, getMethod, getRmijndiname, getServerName, isServerAlive, setetRmijndiname, setJbhome, setJndiurl, setMbean, setMethod, setServerName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMXDeploymentMonitor

public JMXDeploymentMonitor()
Method Detail

setUrl

public void setUrl(java.lang.String url)
            throws java.net.MalformedURLException
Set the URL of the artifact as a String. Optional, alternative for "file".
Parameters:
url - A String representing an URL in external form
Throws:
java.net.MalformedURLException - when the String-URL is not OK

getUrl

public java.lang.String getUrl()
Get the URL of the artifact as a String.
Returns:
the String representation of the work URL.

setFile

public void setFile(java.lang.String file)
Set the artifact as a file path. Optional, alternative for "url". If the path is relative, it is interpreted relative to the "standard" deploy dir under the running config.
Parameters:
file - String path

getFile

public java.lang.String getFile()
Get the artifact as a file path. Works only if "file" was set.
Returns:
Filepath as string (if set previously through "file"

setTimeout

public void setTimeout(long msec)
Set timeout (msec). Optional. Implicit 10000.
Parameters:
msec - Timeout in msec.

getTimeout

public long getTimeout()
Get timeout (msec).
Returns:
Timeout in msec

setWantedStatus

public void setWantedStatus(boolean wantedStatus)
Set wanted deployment status.
Parameters:
wantedStatus - true if we wait for the artifact to be deployed, false if we wait for the artifact to be undeployed.

getWantedStatus

public boolean getWantedStatus()
Get wanted deployment status.
Returns:
See above

execute

public void execute()
             throws JBossNotAvailable
"execute" method allows using this as Ant task via Ant's proxy. It actually performs waitForStatus(wantedStatus). If timeout occurs, throws WaitTimeoutException (unchecked)
Overrides:
execute in class JMXBean
Throws:
JBossNotAvailable - when it seems there's no JBoss to talk with

isDeployed

public boolean isDeployed()
                   throws JBossNotAvailable
Checks the deployment status of the specified artifact. Used in "bean mode".
Returns:
The deployment status. true if currently deployed.

waitForDeploy

public boolean waitForDeploy(boolean expectedStatus)
                      throws JBossNotAvailable
Convenience method for "bean mode".
Waits for the deployment status to be expectedStatus.
Returns:
true when successful

waitForStatus

public boolean waitForStatus(java.net.URL artifact,
                             boolean wantedDepStatus,
                             long timeout)
                      throws JBossNotAvailable
Waits for the specified goal to be attained or for timeout to occur.
Parameters:
artifact - URL of the artifact to be monitored
wantedDepStatus - The wanted deployment status
timeout - Timeout value (msec)
Returns:
true if the wait succeeded
Throws:
JBossNotAvailable - when there's no JBoss to wait for


Copyright © 2003 MaxIQ. All Rights Reserved.