Home » apache-tomcat-6.0.26-src » org.apache » catalina » ant » jmx » [javadoc | source]
org.apache.catalina.ant.jmx
public class: JMXAccessorCondition [javadoc | source]
java.lang.Object
   org.apache.tools.ant.ProjectComponent
      org.apache.catalina.ant.jmx.JMXAccessorCondition

All Implemented Interfaces:
    Condition, Cloneable

Definition:
 
  <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="&lt;"
                  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: NOTE: For numeric expressions the type must be set and use xml entities as operations.
As type we currently support long and double.
Fields inherited from org.apache.tools.ant.ProjectComponent:
project,  location,  description
Method from org.apache.catalina.ant.jmx.JMXAccessorCondition Summary:
accessJMXValue,   eval,   getAttribute,   getHost,   getIf,   getInfo,   getJMXConnection,   getName,   getOperation,   getPassword,   getPort,   getRef,   getType,   getUnless,   getUrl,   getUsername,   getValue,   setAttribute,   setHost,   setIf,   setName,   setOperation,   setPassword,   setPort,   setRef,   setType,   setUnless,   setUrl,   setUsername,   setValue,   testIfCondition,   testUnlessCondition
Methods from org.apache.tools.ant.ProjectComponent:
clone,   getDescription,   getLocation,   getProject,   log,   log,   setDescription,   setLocation,   setProject
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.ant.jmx.JMXAccessorCondition Detail:
 protected String accessJMXValue() 
    Get value from MBeans attribute
 public boolean eval() 
    This method evaluates the condition It support for operation ">,>=,<,<=" the types long and double.
 public String getAttribute() 
 public String getHost() 
 public String getIf() 
 public String getInfo() 
    Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version>.
 protected MBeanServerConnection getJMXConnection() throws MalformedURLException, IOException 
    Get JMXConnection (default look at jmx.server project reference from jmxOpen Task)
 public String getName() 
 public String getOperation() 
 public String getPassword() 
 public String getPort() 
 public String getRef() 
 public String getType() 
 public String getUnless() 
 public String getUrl() 
 public String getUsername() 
 public String getValue() 
 public  void setAttribute(String attribute) 
 public  void setHost(String host) 
 public  void setIf(String c) 
    Only execute if a property of the given name exists in the current project.
 public  void setName(String objectName) 
 public  void setOperation(String operation) 
 public  void setPassword(String password) 
 public  void setPort(String port) 
 public  void setRef(String refId) 
 public  void setType(String type) 
 public  void setUnless(String c) 
    Only execute if a property of the given name does not exist in the current project.
 public  void setUrl(String url) 
 public  void setUsername(String username) 
 public  void setValue(String value) 
 protected boolean testIfCondition() 
    test the if condition
 protected boolean testUnlessCondition() 
    test the unless condition