org.apache.catalina.ant.jmx
public class JMXAccessorCondition extends ProjectComponent implements 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:
Since: 5.5.10
Version: $Revision: 612599 $ $Date: 2008-01-16 23:37:36 +0100 (Wed, 16 Jan 2008) $
Method Summary | |
---|---|
protected String | accessJMXValue()
Get value from MBeans attribute |
boolean | eval()
This method evaluates the condition
It support for operation ">,>=,<,<=" the types long and double . |
String | getAttribute() |
String | getHost() |
String | getIf() |
String | getInfo()
Return descriptive information about this implementation and the
corresponding version number, in the format
<description>/<version> . |
protected MBeanServerConnection | getJMXConnection()
Get JMXConnection (default look at jmx.server project reference from jmxOpen Task) |
String | getName() |
String | getOperation() |
String | getPassword() |
String | getPort() |
String | getRef() |
String | getType() |
String | getUnless() |
String | getUrl() |
String | getUsername() |
String | getValue() |
void | setAttribute(String attribute) |
void | setHost(String host) |
void | setIf(String c)
Only execute if a property of the given name exists in the current project. |
void | setName(String objectName) |
void | setOperation(String operation) |
void | setPassword(String password) |
void | setPort(String port) |
void | setRef(String refId) |
void | setType(String type) |
void | setUnless(String c)
Only execute if a property of the given name does not
exist in the current project. |
void | setUrl(String url) |
void | setUsername(String username) |
void | setValue(String value) |
protected boolean | testIfCondition()
test the if condition |
protected boolean | testUnlessCondition()
test the unless condition |
Returns: The value
long
and double
.Returns: expression jmxValue operation value
Returns: Returns the attribute.
Returns: Returns the host.
Returns: Returns the ifCondition.
<description>/<version>
.Returns: active JMXConnection
Throws: MalformedURLException IOException
Returns: Returns the name.
Returns: Returns the operation.
Returns: Returns the password.
Returns: Returns the port.
Returns: Returns the ref.
Returns: Returns the type.
Returns: Returns the unlessCondition.
Returns: Returns the url.
Returns: Returns the username.
Returns: Returns the value.
Parameters: attribute The attribute to set.
Parameters: host The host to set.
Parameters: c property name
Parameters: objectName The name to set.
Parameters: operation The operation to set.
Parameters: password The password to set.
Parameters: port The port to set.
Parameters: refId The ref to set.
Parameters: type The type to set.
Parameters: c property name
Parameters: url The url to set.
Parameters: username The username to set.
Returns: true if there is no if condition, or the named property exists
Returns: true if there is no unless condition, or there is a named property but it doesn't exist