public class JMXAccessorCondition
extends org.apache.tools.ant.ProjectComponent
implements org.apache.tools.ant.taskdefs.condition.Condition
<path id="catalina_ant"> <fileset dir="${catalina.home}/server/lib"> <include name="catalina-ant.jar"/> </fileset> </path> <typedef name="jmxCondition" classname="org.apache.catalina.ant.jmx.JMXAccessorCondition" classpathref="catalina_ant"/> <taskdef name="jmxOpen" classname="org.apache.catalina.ant.jmx.JMXAccessorTask" classpathref="catalina_ant"/>Usage: Wait for start backup node
<target name="wait"> <jmxOpen host="${jmx.host}" port="${jmx.port}" username="${jmx.username}" password="${jmx.password}" /> <waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" > <and> <socket server="${server.name}" port="${server.port}"/> <http url="${url}"/> <jmxCondition name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025" operation="==" attribute="connected" value="true" /> <jmxCondition operation="<" name="Catalina:j2eeType=WebModule,name=//${tomcat.application.host}${tomcat.application.path},J2EEApplication=none,J2EEServer=none" attribute="startupTime" value="250" /> </and> </waitfor> <fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" /> <echo message="Server ${url} alive" /> </target>Allowed operation between jmx attribute and reference value:
Constructor and Description |
---|
JMXAccessorCondition() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
accessJMXValue()
Get value from MBeans attribute
|
boolean |
eval()
This method evaluates the condition
It support for operation ">,>=,<,<=" the types
long and double . |
java.lang.String |
getAttribute() |
java.lang.String |
getHost() |
java.lang.String |
getIf() |
java.lang.String |
getInfo()
Return descriptive information about this implementation and the
corresponding version number, in the format
<description>/<version> . |
protected javax.management.MBeanServerConnection |
getJMXConnection()
Get JMXConnection (default look at jmx.server project reference from jmxOpen Task)
|
java.lang.String |
getName() |
java.lang.String |
getOperation() |
java.lang.String |
getPassword() |
java.lang.String |
getPort() |
java.lang.String |
getRef() |
java.lang.String |
getType() |
java.lang.String |
getUnless() |
java.lang.String |
getUrl() |
java.lang.String |
getUsername() |
java.lang.String |
getValue() |
void |
setAttribute(java.lang.String attribute) |
void |
setHost(java.lang.String host) |
void |
setIf(java.lang.String c)
Only execute if a property of the given name exists in the current project.
|
void |
setName(java.lang.String objectName) |
void |
setOperation(java.lang.String operation) |
void |
setPassword(java.lang.String password) |
void |
setPort(java.lang.String port) |
void |
setRef(java.lang.String refId) |
void |
setType(java.lang.String type) |
void |
setUnless(java.lang.String c)
Only execute if a property of the given name does not
exist in the current project.
|
void |
setUrl(java.lang.String url) |
void |
setUsername(java.lang.String username) |
void |
setValue(java.lang.String value) |
protected boolean |
testIfCondition()
test the if condition
|
protected boolean |
testUnlessCondition()
test the unless condition
|
public java.lang.String getInfo()
<description>/<version>
.public java.lang.String getOperation()
public void setOperation(java.lang.String operation)
operation
- The operation to set.public java.lang.String getType()
public void setType(java.lang.String type)
type
- The type to set.public java.lang.String getAttribute()
public void setAttribute(java.lang.String attribute)
attribute
- The attribute to set.public java.lang.String getHost()
public void setHost(java.lang.String host)
host
- The host to set.public java.lang.String getName()
public void setName(java.lang.String objectName)
objectName
- The name to set.public java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- The password to set.public java.lang.String getPort()
public void setPort(java.lang.String port)
port
- The port to set.public java.lang.String getUrl()
public void setUrl(java.lang.String url)
url
- The url to set.public java.lang.String getUsername()
public void setUsername(java.lang.String username)
username
- The username to set.public java.lang.String getValue()
public void setValue(java.lang.String value)
public java.lang.String getRef()
public void setRef(java.lang.String refId)
refId
- The ref to set.public java.lang.String getIf()
public void setIf(java.lang.String c)
c
- property namepublic java.lang.String getUnless()
public void setUnless(java.lang.String c)
c
- property nameprotected javax.management.MBeanServerConnection getJMXConnection() throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLException
java.io.IOException
protected java.lang.String accessJMXValue()
protected boolean testIfCondition()
protected boolean testUnlessCondition()
public boolean eval()
long
and double
.eval
in interface org.apache.tools.ant.taskdefs.condition.Condition
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.