Class JMXAccessorCondition
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.catalina.ant.jmx.JMXAccessorConditionBase
org.apache.catalina.ant.jmx.JMXAccessorCondition
- All Implemented Interfaces:
Cloneable, org.apache.tools.ant.taskdefs.condition.Condition
Definition:
As type we currently support long and double.
<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:
- == equals
- != not equals
- > greater than (>)
- >= greater than or equals (>=)
- < lesser than (<)
- <= lesser than or equals (<=)
As type we currently support long and double.
- Since:
- 5.5.10
-
Field Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaneval()This method evaluates the condition It support for operation ">,>=,<,<=" the typeslonganddouble.getIf()Get the if condition property name.Get the comparison operation.getType()Get the data type for comparison.Get the unless condition property name.voidOnly execute if a property of the given name exists in the current project.voidsetOperation(String operation) Set the comparison operation.voidSet the data type for comparison.voidOnly execute if a property of the given name does not exist in the current project.protected booleantest the if conditionprotected booleantest the unless conditionMethods inherited from class JMXAccessorConditionBase
accessJMXValue, getAttribute, getHost, getJMXConnection, getName, getPassword, getPort, getRef, getUrl, getUsername, getValue, setAttribute, setHost, setName, setPassword, setPort, setRef, setUrl, setUsername, setValueMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
JMXAccessorCondition
public JMXAccessorCondition()Constructs a new JMXAccessorCondition.
-
-
Method Details
-
getOperation
-
setOperation
Set the comparison operation.- Parameters:
operation- the operation to set
-
getType
-
setType
Set the data type for comparison.- Parameters:
type- the type to set
-
getIf
-
setIf
Only execute if a property of the given name exists in the current project.- Parameters:
c- property name
-
getUnless
Get the unless condition property name.- Returns:
- the unless condition property name
-
setUnless
Only execute if a property of the given name does not exist in the current project.- Parameters:
c- property name
-
testIfCondition
protected boolean testIfCondition()test the if condition- Returns:
- true if there is no if condition, or the named property exists
-
testUnlessCondition
protected boolean testUnlessCondition()test the unless condition- Returns:
- true if there is no unless condition, or there is a named property but it doesn't exist
-
eval
public boolean eval()This method evaluates the condition It support for operation ">,>=,<,<=" the typeslonganddouble.- Returns:
- expression jmxValue operation value
-