tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx Arg.java JMXAccessorEqualsCondition.java JMXAccessorGetTask.java JMXAccessorInvokeTask.java JMXAccessorQueryTask.java JMXAccessorSetTask.java JMXAccessorTask.java antlib.xml jmxaccessor.tasks package.html
Date Fri, 24 Jun 2005 11:52:51 GMT
pero        2005/06/24 04:52:51

  Modified:    catalina/src/share/org/apache/catalina/ant catalina.tasks
                        package.html
  Added:       catalina/src/share/org/apache/catalina/ant antlib.xml
               catalina/src/share/org/apache/catalina/ant/jmx Arg.java
                        JMXAccessorEqualsCondition.java
                        JMXAccessorGetTask.java JMXAccessorInvokeTask.java
                        JMXAccessorQueryTask.java JMXAccessorSetTask.java
                        JMXAccessorTask.java antlib.xml jmxaccessor.tasks
                        package.html
  Log:
  Add new jmx remote ant support
  
  Revision  Changes    Path
  1.3       +7 -2      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/catalina.tasks
  
  Index: catalina.tasks
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/catalina.tasks,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- catalina.tasks	13 Mar 2005 06:39:16 -0000	1.2
  +++ catalina.tasks	24 Jun 2005 11:52:51 -0000	1.3
  @@ -2,13 +2,18 @@
   deploy=org.apache.catalina.ant.DeployTask
   list=org.apache.catalina.ant.ListTask
   reload=org.apache.catalina.ant.ReloadTask
  +sessions=org.apache.catalina.ant.SessionsTask
   resources=org.apache.catalina.ant.ResourcesTask
   roles=org.apache.catalina.ant.RolesTask
   start=org.apache.catalina.ant.StartTask
   stop=org.apache.catalina.ant.StopTask
   undeploy=org.apache.catalina.ant.UndeployTask
   validator=org.apache.catalina.ant.ValidatorTask
  +#Jk Task
   jkstatus=org.apache.catalina.ant.JKStatusUpdateTask
   
  -# Jasper tasks
  -jasper2=org.apache.jasper.JspC
  +# Manager JMX
  +jmxManagerSet=org.apache.catalina.ant.JMXSetTask
  +jmxManagerGet=org.apache.catalina.ant.JMXGetTask
  +jmxManagerQuery=org.apache.catalina.ant.JMXQueryTask
  +
  
  
  
  1.3       +5 -5      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/package.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- package.html	30 Jul 2002 03:58:27 -0000	1.2
  +++ package.html	24 Jun 2005 11:52:51 -0000	1.3
  @@ -1,11 +1,11 @@
   <body>
   
   <p>This package contains a set of <code>Task</code> implementations for
  -<em>Ant (version 1.4 or later)</em> that can be used to interact with the
  -Manager application to install, reload, and remove web applications from
  -a running instance of Tomcat.  For more information, see
  -<a href="http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html">
  -http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html</a>.</p>
  +<em>Ant (version 1.6.x or later)</em> that can be used to interact with the
  +Manager application to deploy, undeploy, list, reload, start and stop web applications 
  +from a running instance of Tomcat.  For more information, see
  +<a href="http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html">
  +http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html</a>.</p>
   
   <p>The attributes of each task element correspond
   exactly to the request parameters that are included with an HTTP request
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/antlib.xml
  
  Index: antlib.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <antlib>
    <typedef
          name="list"
          classname="org.apache.catalina.ant.ListTask" />
    <typedef
          name="deploy"
          classname="org.apache.catalina.ant.DeployTask" />
    <typedef
          name="start"
          classname="org.apache.catalina.ant.StartTask" />
    <typedef
          name="reload"
          classname="org.apache.catalina.ant.ReloadTask" />
    <typedef
          name="stop"
          classname="org.apache.catalina.ant.StopTask" />        
    <typedef
          name="undeploy"
          classname="org.apache.catalina.ant.UndeployTask" />
    <typedef
          name="roles"
          classname="org.apache.catalina.ant.RolesTask" />
    <typedef
          name="resources"
          classname="org.apache.catalina.ant.ResourcesTask" />
    <typedef
          name="sessions"
          classname="org.apache.catalina.ant.SessionsTask" />
    <typedef
          name="jkupdate"
          classname="org.apache.catalina.ant.JkStatusUpdateTask" />
    <typedef
          name="jmxManagerSet"
          classname="org.apache.catalina.ant.JMXSetTask" />
    <typedef
          name="jmxManagerGet"
          classname="org.apache.catalina.ant.JMXGetTask" />
    <typedef
          name="jmxManagerQuery"
          classname="org.apache.catalina.ant.JMXQueryTask" />
  </antlib>
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/Arg.java
  
  Index: Arg.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.catalina.ant.jmx;
  
  /**
   *
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   */
  public class Arg {
      String type;
      String value;
  
      public void setType( String type) {
          this.type=type;
      }
      public void setValue( String value ) {
          this.value=value;
      }
      public void addText( String text ) {
          this.value=text;
      }
  
      public String getValue() {
          return value;
      }
  
      public String getType() {
          return type;
      }
  }
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/JMXAccessorEqualsCondition.java
  
  Index: JMXAccessorEqualsCondition.java
  ===================================================================
  package org.apache.catalina.ant.jmx;
  
  import java.io.IOException;
  import java.net.MalformedURLException;
  
  import javax.management.MBeanServerConnection;
  import javax.management.ObjectName;
  
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.taskdefs.condition.Condition;
  
  /**
   *
   * Definition
   * <code> 
   *   <path id="catalina_ant">
   *       <fileset dir="${catalina.home}/server/lib">
   *           <include name="catalina-ant.jar"/>
   *           <include name="catalina-ant-jmx.jar"/>
   *       </fileset>
   *   </path>
   *
   *   <typedef
   *       name="jmxEquals"
   *       classname="org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition"
   *       classpathref="catalina_ant"/>
   * </code>
   * 
   * usage: Wait for start backup node
   * <code>
   *     &lt;target name="wait"&gt;
   *        &lt;waitfor maxwait="${maxwait}" maxwaitunit="second" timeoutproperty="server.timeout" &gt;
   *           &lt;and&gt;
   *               &lt;socket server="${server.name}" port="${server.port}"/&gt;
   *               &lt;http url="${url}"/&gt;
   *               &lt;jmxEquals 
   *                   host="localhost" port="9014" username="controlRole" password="tomcat"
   *                   name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.111.1,senderPort=9025"
   *                   attribute="connected" value="true"
   *               /&gt;
   *           &lt;/and&gt;
   *       &lt;/waitfor&gt;
   *       &lt;fail if="server.timeout" message="Server ${url} don't answer inside ${maxwait} sec" /&gt;
   *       &lt;echo message="Server ${url} alive" /&gt;
   *   &lt;/target&gt;
   *
   * </code>
   * 
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   *
   */
  public class JMXAccessorEqualsCondition implements Condition {
  
      // ----------------------------------------------------- Instance Variables
  
      private String url = null;
      private String host = "localhost";
      private String port = "8050";
      private String password = null;
      private String username = null;
      private String name = null;
      private String attribute;
      private String value;
  
      // ----------------------------------------------------- Instance Info
  
      /**
       * Descriptive information describing this implementation.
       */
      private static final String info = "org.apache.catalina.ant.JMXAccessorEqualsCondition/1.0";
  
      /**
       * Return descriptive information about this implementation and the
       * corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
          return (info);
  
      }
      // ----------------------------------------------------- Properties
  
      /**
       * @return Returns the attribute.
       */
      public String getAttribute() {
          return attribute;
      }
      /**
       * @param attribute The attribute to set.
       */
      public void setAttribute(String attribute) {
          this.attribute = attribute;
      }
      /**
       * @return Returns the host.
       */
      public String getHost() {
          return host;
      }
      /**
       * @param host The host to set.
       */
      public void setHost(String host) {
          this.host = host;
      }
      /**
       * @return Returns the name.
       */
      public String getName() {
          return name;
      }
      /**
       * @param name The name to set.
       */
      public void setName(String objectName) {
          this.name = objectName;
      }
      /**
       * @return Returns the password.
       */
      public String getPassword() {
          return password;
      }
      /**
       * @param password The password to set.
       */
      public void setPassword(String password) {
          this.password = password;
      }
      /**
       * @return Returns the port.
       */
      public String getPort() {
          return port;
      }
      /**
       * @param port The port to set.
       */
      public void setPort(String port) {
          this.port = port;
      }
      /**
       * @return Returns the url.
       */
      public String getUrl() {
          return url;
      }
      /**
       * @param url The url to set.
       */
      public void setUrl(String url) {
          this.url = url;
      }
      /**
       * @return Returns the username.
       */
      public String getUsername() {
          return username;
      }
      /**
       * @param username The username to set.
       */
      public void setUsername(String username) {
          this.username = username;
      }
      /**
       * @return Returns the value.
       */
      public String getValue() {
          return value;
      }
      // The setter for the "value" attribute
      public void setValue(String value) {
          this.value = value;
      }
  
      protected MBeanServerConnection getJMXConnection()
              throws MalformedURLException, IOException {
          return JMXAccessorTask.createJMXConnection(getUrl(), getHost(),
                  getPort(), getUsername(), getPassword());
      }
  
      /**
       * @return
       */
      protected String accessJMXValue() {
          try {
              Object result = getJMXConnection().getAttribute(
                      new ObjectName(name), attribute);
              if(result != null)
                  return result.toString();
          } catch (Exception e) {
              // ignore access or connection open errors
          }
          return null;
      }
  
      // This method evaluates the condition
      public boolean eval() {
          if (value == null) {
              throw new BuildException("value attribute is not set");
          }
          if ((name == null || attribute == null)) {
              throw new BuildException(
                      "Must specify a 'attribute', name for equals condition");
          }
          //FIXME check url or host/parameter
          String jmxValue = accessJMXValue();
          if(jmxValue != null)
              return jmxValue.equals(value);
          return false;
      }
  }
  
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/JMXAccessorGetTask.java
  
  Index: JMXAccessorGetTask.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.ant.jmx;
  
  
  import javax.management.MBeanServerConnection;
  import javax.management.ObjectName;
  
  import org.apache.tools.ant.BuildException;
  
  
  /**
   * Access <em>JMX</em> JSR 160 MBeans Server. 
   * <ul>
   * <li>Get Mbeans attributes</li>
   * <li>Show Get result as Ant console log</li>
   * <li>Bind Get result as Ant properties</li>
   * </ul>
   * <p>
   * Examples:
   * <li>
   * Get a Mbean IDataSender attribute nrOfRequests and create a new ant property <em>IDataSender.9025.nrOfRequests</em> 
   * <code>
   *   &lt;jmx:get
   *           ref="jmx.server"
   *           name="Catalina:type=IDataSender,host=localhost,senderAddress=192.168.1.2,senderPort=9025" 
   *           attribute="nrOfRequests"
   *           resultproperty="IDataSender.9025.nrOfRequests"
   *           echo="false"&gt;
   *       /&gt;
   * </code>
   * </p>
   * <p>
   * First call to a remote MBeanserver save the JMXConnection a referenz <em>jmx.server</em>
   * </p>
   * These tasks require Ant 1.6 or later interface.
   *
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   */
  
  public class JMXAccessorGetTask extends JMXAccessorTask {
  
  
      // ----------------------------------------------------- Instance Variables
  
      private String attribute;
  
      // ----------------------------------------------------- Instance Info
  
      /**
       * Descriptive information describing this implementation.
       */
      private static final String info = "org.apache.catalina.ant.JMXAccessorGetTask/1.0";
  
      /**
       * Return descriptive information about this implementation and the
       * corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
          return (info);
  
      }
  
      // ------------------------------------------------------------- Properties
      
      /**
       * @return Returns the attribute.
       */
      public String getAttribute() {
          return attribute;
      }
      
      /**
       * @param attribute The attribute to set.
       */
      public void setAttribute(String attribute) {
          this.attribute = attribute;
      }
      
    
      // ------------------------------------------------------ protected Methods
      
      /**
       * Execute the specified command, based on the configured properties. The
       * input stream will be closed upon completion of this task, whether it was
       * executed successfully or not.
       * 
       * @exception BuildException
       *                if an error occurs
       */
      protected String jmxExecute(MBeanServerConnection jmxServerConnection)
          throws Exception {
  
          if (getName() == null) {
              throw new BuildException("Must specify a 'name'");
          }
          if ((attribute == null)) {
              throw new BuildException(
                      "Must specify a 'attribute' for get");
          }
          return  jmxGet(jmxServerConnection, getName());
       }
  
  
      /**
       * @param jmxServerConnection
       * @param name
       * @return
       * @throws Exception
       */
      protected String jmxGet(MBeanServerConnection jmxServerConnection,String name) throws Exception {
          String error = null;
          if(isEcho()) {
              handleOutput("MBean " + name + " get attribute " + attribute );
          }
          Object result = jmxServerConnection.getAttribute(
                  new ObjectName(name), attribute);
          if (result != null) {
              echoResult(attribute,result);
              createProperty(result);
          } else
              error = "Attribute " + attribute + " is empty";
          return error;
      }
  }
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/JMXAccessorInvokeTask.java
  
  Index: JMXAccessorInvokeTask.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.ant.jmx;
  
  
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.management.MBeanServerConnection;
  import javax.management.ObjectName;
  
  import org.apache.tools.ant.BuildException;
  
  
  /**
   * Access <em>JMX</em> JSR 160 MBeans Server. 
   * <ul>
   * <li>open more then one JSR 160 rmi connection</li>
   * <li>Get/Set Mbeans attributes</li>
   * <li>Call Mbean Operation with arguments</li>
   * <li>Argument values can be converted from string to int,long,float,double,boolean,ObjectName or InetAddress </li>
   * <li>Query Mbeans</li>
   * <li>Show Get, Call, Query result at Ant console log</li>
   * <li>Bind Get, Call, Query result at Ant properties</li>
   * </ul>
   *
   * Examples:
   * <ul>
   * <li>
   * Get a session attribute hello from session with ref <em>${sessionid.0}</em> form 
   * app <em>Catalina:type=Manager,path=/ClusterTest,host=localhost</em> 
   * <code>
   *   &lt;jmx:invoke
   *           name="Catalina:type=Manager,path=/ClusterTest,host=localhost" 
   *           operation="getSessionAttribute"
   *           resultproperty="hello"&gt;
   *         &lt;arg value="${sessionid.0}"/&gt;
   *         &lt;arg value="Hello"/&gt;
   *   &lt;/jmx:invoke&gt;
   * </code>
   * </li>
   * <li>
   * Create new AccessLogger at localhost 
   * <code>
   *   &lt;jmx:invoke
   *           name="Catalina:type=MBeanFactory" 
   *           operation="createAcccesLoggerValve"
   *           resultproperty="acccesLoggerObjectName"
   *       &gt;
   *         &lt;arg value="Catalina:type=Host,host=localhost"/&gt;
   *   &lt;/jmx:invoke&gt;
   *
   * </code>
   * </li>
   * <li>
   * Remove existing AccessLogger at localhost 
   * <code>
   *   &lt;jmx:invoke
   *           name="Catalina:type=MBeanFactory" 
   *           operation="removeValve"
   *       &gt;
   *         &lt;arg value="Catalina:type=Valve,name=AccessLogValve,host=localhost"/&gt;
   *   &lt;/jmx:invoke&gt;
   *
   * </code>
   * </li>
   * </ul>
   * <p>
   * First call to a remote MBeanserver save the JMXConnection a referenz <em>jmx.server</em>
   * </p>
   * These tasks require Ant 1.6 or later interface.
   *
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   */
  
  public class JMXAccessorInvokeTask extends JMXAccessorTask {
  
  
      // ----------------------------------------------------- Instance Variables
  
      private String operation ;
      private List args=new ArrayList();
  
      // ----------------------------------------------------- Instance Info
  
      /**
       * Descriptive information describing this implementation.
       */
      private static final String info = "org.apache.catalina.ant.JMXAccessorInvokeTask/1.0";
  
      /**
       * Return descriptive information about this implementation and the
       * corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
          return (info);
  
      }
  
      // ------------------------------------------------------------- Properties
      
      /**
       * @return Returns the operation.
       */
      public String getOperation() {
          return operation;
      }
      /**
       * @param operation The operation to set.
       */
      public void setOperation(String operation) {
          this.operation = operation;
      }
  
      public void addArg(Arg arg ) {
          args.add(arg);
      }
  
      /**
       * @return Returns the args.
       */
      public List getArgs() {
          return args;
      }
      /**
       * @param args The args to set.
       */
      public void setArgs(List args) {
          this.args = args;
      }
      
      // ------------------------------------------------------ protected Methods
      
      /**
       * Execute the specified command, based on the configured properties. The
       * input stream will be closed upon completion of this task, whether it was
       * executed successfully or not.
       * 
       * @exception BuildException
       *                if an error occurs
       */
      protected String jmxExecute(MBeanServerConnection jmxServerConnection)
          throws Exception {
  
          if (getName() == null) {
              throw new BuildException("Must specify a 'name'");
          }
          if ((operation == null)) {
              throw new BuildException(
                      "Must specify a 'operation' for call");
          }
          return  jmxInvoke(jmxServerConnection, getName());
       }
  
      /**
       * @param jmxServerConnection
       * @throws Exception
       */
      protected String jmxInvoke(MBeanServerConnection jmxServerConnection, String name) throws Exception {
          Object result ;
          if (args == null) {
               result = jmxServerConnection.invoke(new ObjectName(name),
                      operation, null, null);
          } else {
              Object argsA[]=new Object[ args.size()];
              String sigA[]=new String[args.size()];
              for( int i=0; i<args.size(); i++ ) {
                  Arg arg=(Arg)args.get(i);
                  if( arg.type==null) {
                      arg.type="java.lang.String";
                      sigA[i]=arg.getType();
                      argsA[i]=arg.getValue();
                  } else {
                      sigA[i]=arg.getType();
                      argsA[i]=convertStringToType(arg.getValue(),arg.getType());
                  }                
              }
              result = jmxServerConnection.invoke(new ObjectName(name), operation, argsA, sigA);
          }
          if(result != null) {
              echoResult(operation,result);
              createProperty(result);
          }
          return null;
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/JMXAccessorQueryTask.java
  
  Index: JMXAccessorQueryTask.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.ant.jmx;
  
  
  import java.util.Iterator;
  import java.util.Set;
  
  import javax.management.MBeanAttributeInfo;
  import javax.management.MBeanInfo;
  import javax.management.MBeanServerConnection;
  import javax.management.ObjectName;
  
  import org.apache.tools.ant.BuildException;
  
  
  /**
   * Query for Mbeans . 
   * <ul>
   * <li>open no existing JSR 160 rmi jmx connection</li>
   * <li>Get all Mbeans attributes</li>
   * <li>Get only the Query Mbeans ObjectNames</li>
   * <li>Show query result as Ant console log</li>
   * <li>Bind query result as Ant properties</li>
   * </ul>
   * <br/>
   * Query a list of Mbean 
   * <code>
   *   &lt;jmxQuery
   *           host="127.0.0.1"
   *           port="9014"
   *           name="Catalina:type=Manager,* 
   *           resultproperty="manager" /&gt;
   * </code>
   * with attribute <em>attributebinding="true"</em> you can get 
   * all attributes also from result objects.<br/>
   * The poperty manager.lenght show the size of the result 
   * and with manager.[0..lenght].name the 
   * resulted ObjectNames are saved. 
   * These tasks require Ant 1.6 or later interface.
   *
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   */
  
  public class JMXAccessorQueryTask extends JMXAccessorTask {
  
      // ----------------------------------------------------- Instance Variables
  
      private boolean attributebinding = false;
  
      // ----------------------------------------------------- Instance Info
  
      /**
       * Descriptive information describing this implementation.
       */
      private static final String info = "org.apache.catalina.ant.JMXAccessorQueryTask/1.0";
  
      /**
       * Return descriptive information about this implementation and the
       * corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
          return (info);
  
      }
  
      // ------------------------------------------------------------- Properties
      
      /**
       * @return Returns the attributebinding.
       */
      public boolean isAttributebinding() {
          return attributebinding;
      }
      /**
       * @param attributebinding The attributebinding to set.
       */
      public void setAttributebinding(boolean attributeBinding) {
          this.attributebinding = attributeBinding;
      }
    
      // ------------------------------------------------------ protected Methods
  
      
      /**
       * Execute the specified command, based on the configured properties. The
       * input stream will be closed upon completion of this task, whether it was
       * executed successfully or not.
       * 
       * @exception BuildException
       *                if an error occurs
       */
      protected String jmxExecute(MBeanServerConnection jmxServerConnection)
          throws Exception {
  
          if (getName() == null) {
              throw new BuildException("Must specify a 'name'");
          }
          return jmxQuery(jmxServerConnection, getName());
  
      }
  
         
      /**
       * Call Mbean server for some mbeans with same domain, attributes.
       *  with <em>attributebindung=true</em> you can save all attributes from all found objects
       * as your ant properties
       * @param jmxServerConnection
       * @param qry
       * @return
       */
      protected String jmxQuery(MBeanServerConnection jmxServerConnection,
              String qry) {
          String isError = null;
          Set names = null;
          String resultproperty = getResultproperty();
          try {
              names = jmxServerConnection.queryNames(new ObjectName(qry), null);
              if (resultproperty != null)
                  getProject().setNewProperty(resultproperty + ".length",
                          Integer.toString(names.size()));
          } catch (Exception e) {
              if (isEcho())
                  handleErrorOutput(e.getMessage());
              return "Can't query mbeans " + qry;
          }
  
          Iterator it = names.iterator();
          int oindex = 0;
          String pname = null;
          while (it.hasNext()) {
              ObjectName oname = (ObjectName) it.next();
              pname = resultproperty + "." + Integer.toString(oindex) + ".";
              oindex++;
              if (isEcho())
                  handleOutput(pname + "name=" + oname.toString());
              if (resultproperty != null) {
                  getProject().setNewProperty(pname + "name",
                          oname.toString());
              }
              if (isAttributebinding()) {
                  bindAttributes(jmxServerConnection, resultproperty, pname, oname);
              }
          }
          return isError;
      }
  
      /**
       * @param jmxServerConnection
       * @param resultproperty
       * @param pname
       * @param oname
       */
      protected void bindAttributes(MBeanServerConnection jmxServerConnection, String resultproperty, String pname, ObjectName oname) {
          try {
              MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
              String code = minfo.getClassName();
              if ("org.apache.commons.modeler.BaseModelMBean"
                      .equals(code)) {
                  code = (String) jmxServerConnection.getAttribute(oname,
                          "modelerType");
              }
              MBeanAttributeInfo attrs[] = minfo.getAttributes();
              Object value = null;
  
              for (int i = 0; i < attrs.length; i++) {
                  if (!attrs[i].isReadable())
                      continue;
                  String attName = attrs[i].getName();
                  if (attName.indexOf("=") >= 0
                          || attName.indexOf(":") >= 0
                          || attName.indexOf(" ") >= 0) {
                      continue;
                  }
  
                  try {
                      value = jmxServerConnection.getAttribute(oname,
                              attName);
                  } catch (Throwable t) {
                      if (isEcho())
                          handleErrorOutput("Error getting attribute "
                                  + oname + " " + pname + attName + " "
                                  + t.toString());
                      continue;
                  }
                  if (value == null)
                      continue;
                  if ("modelerType".equals(attName))
                      continue;
                  String valueString = value.toString();
                  if (isEcho())
                      handleOutput(pname + attName + "=" + valueString);
                  if (resultproperty != null)
                      getProject().setNewProperty(pname + attName,
                              valueString);
              }
          } catch (Exception e) {
              // Ignore
          }
      }
  }
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/JMXAccessorSetTask.java
  
  Index: JMXAccessorSetTask.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.ant.jmx;
  
  
  import javax.management.Attribute;
  import javax.management.MBeanAttributeInfo;
  import javax.management.MBeanInfo;
  import javax.management.MBeanServerConnection;
  import javax.management.ObjectName;
  
  import org.apache.tools.ant.BuildException;
  
  
  /**
   * Access <em>JMX</em> JSR 160 MBeans Server. 
   * <ul>
   * <li>Get Mbeans attributes</li>
   * <li>Show Get result as Ant console log</li>
   * <li>Bind Get result as Ant properties</li>
   * </ul>
   * <p>
   * Examples:
   * Set a Mbean Manager attribute maxActiveSessions.
   * Set this attribute with fresh jmx connection without save reference 
   * <code>
   *   &lt;jmx:set
   *           host="127.0.0.1"
   *           port="9014"
   *           ref=""
   *           name="Catalina:type=Manager,path="/ClusterTest",host=localhost" 
   *           attribute="maxActiveSessions"
   *           value="100"
   *           type="int"
   *           echo="false"&gt;
   *       /&gt;
   * </code>
   * </p>
   * <p>
   * First call to a remote MBeanserver save the JMXConnection a referenz <em>jmx.server</em>
   * </p>
   * These tasks require Ant 1.6 or later interface.
   *
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   */
  
  public class JMXAccessorSetTask extends JMXAccessorTask {
  
      // ----------------------------------------------------- Instance Variables
  
      private String attribute;
      private String value;
      private String type;
      private boolean convert = false ;
      
      // ----------------------------------------------------- Instance Info
  
      /**
       * Descriptive information describing this implementation.
       */
      private static final String info = "org.apache.catalina.ant.JMXAccessorSetTask/1.0";
  
      /**
       * Return descriptive information about this implementation and the
       * corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
          return (info);
  
      }
  
      // ------------------------------------------------------------- Properties
      
      /**
       * @return Returns the attribute.
       */
      public String getAttribute() {
          return attribute;
      }
      
      /**
       * @param attribute The attribute to set.
       */
      public void setAttribute(String attribute) {
          this.attribute = attribute;
      }
      
      /**
       * @return Returns the value.
       */
      public String getValue() {
          return value;
      }
      /**
       * @param value The value to set.
       */
      public void setValue(String value) {
          this.value = value;
      }
      
      
      /**
       * @return Returns the type.
       */
      public String getType() {
          return type;
      }
      
      /**
       * @param type The type to set.
       */
      public void setType(String valueType) {
          this.type = valueType;
      }
   
   
      /**
       * @return Returns the convert.
       */
      public boolean isConvert() {
          return convert;
      }
      /**
       * @param convert The convert to set.
       */
      public void setConvert(boolean convert) {
          this.convert = convert;
      }
      // ------------------------------------------------------ protected Methods
      
      /**
       * Execute the specified command, based on the configured properties. The
       * input stream will be closed upon completion of this task, whether it was
       * executed successfully or not.
       * 
       * @exception BuildException
       *                if an error occurs
       */
      protected String jmxExecute(MBeanServerConnection jmxServerConnection)
          throws Exception {
  
          if (getName() == null) {
              throw new BuildException("Must specify a 'name'");
          }
          if ((attribute == null || value == null)) {
              throw new BuildException(
                      "Must specify a 'attribute' and 'value' for set");
          }
          return  jmxSet(jmxServerConnection, getName());
       }
  
      /**
       * @param jmxServerConnection
       * @param name
       * @throws Exception
       */
      protected String jmxSet(MBeanServerConnection jmxServerConnection,
              String name) throws Exception {
          Object realValue;
          if (type != null) {
              realValue = convertStringToType(value, type);
          } else {
              if (isConvert()) {
                  String mType = getMBeanAttributeType(jmxServerConnection, name,
                          attribute);
                  realValue = convertStringToType(value, mType);
              } else
                  realValue = value;
          }
          jmxServerConnection.setAttribute(new ObjectName(name), new Attribute(
                  attribute, realValue));
          return null;
      }
      
  
  
      /**
       * Get MBean Attriute from Mbean Server
       * @param jmxServerConnection
       * @param name
       * @param attribute
       * @return
       * @throws Exception
       */
      protected String getMBeanAttributeType(
              MBeanServerConnection jmxServerConnection,
              String name,
              String attribute) throws Exception {
          ObjectName oname = new ObjectName(name);
          String mattrType = null;
          MBeanInfo minfo = jmxServerConnection.getMBeanInfo(oname);
          MBeanAttributeInfo attrs[] = minfo.getAttributes();
          if (attrs != null) {
              for (int i = 0; mattrType == null && i < attrs.length; i++) {
                  if (attribute.equals(attrs[i].getName()))
                      mattrType = attrs[i].getType();
              }
          }
          return mattrType;
      }
   }
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/JMXAccessorTask.java
  
  Index: JMXAccessorTask.java
  ===================================================================
  /*
   * Copyright 2002,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.ant.jmx;
  
  
  import java.io.IOException;
  import java.net.InetAddress;
  import java.net.MalformedURLException;
  import java.net.UnknownHostException;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.StringTokenizer;
  
  import javax.management.MBeanServerConnection;
  import javax.management.MalformedObjectNameException;
  import javax.management.ObjectName;
  import javax.management.remote.JMXConnector;
  import javax.management.remote.JMXConnectorFactory;
  import javax.management.remote.JMXServiceURL;
  
  import org.apache.catalina.ant.BaseRedirectorHelperTask;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Project;
  
  
  /**
   * Access <em>JMX</em> JSR 160 MBeans Server. 
   * <ul>
   * <li>open more then one JSR 160 rmi connection</li>
   * <li>Get/Set Mbeans attributes</li>
   * <li>Call Mbean Operation with arguments</li>
   * <li>Argument values can be converted from string to int,long,float,double,boolean,ObjectName or InetAddress </li>
   * <li>Query Mbeans</li>
   * <li>Show Get, Call, Query result at Ant console log</li>
   * <li>Bind Get, Call, Query result at Ant properties</li>
   * </ul>
   *
   * Examples:
   * open server with reference and autorisation 
   * <code>
   *   &lt;jmxOpen
   *           host="127.0.0.1"
   *           port="9014"
   *           username="monitorRole"
   *           password="mysecret"
   *           ref="jmx.myserver" 
   *       /&gt;
   * </code>
   * All calls after opening with same refid reuse the connection.
   * <p>
   * First call to a remote MBeanserver save the JMXConnection a referenz <em>jmx.server</em>
   * </p>
   * These tasks require Ant 1.6 or later interface.
   *
   * @author Peter Rossbach
   * @version $Revision: 1.1 $ $Date: 2005/06/24 11:52:51 $
   * @since 5.5.10
   */
  
  public class JMXAccessorTask extends BaseRedirectorHelperTask {
  
  
      // ----------------------------------------------------- Instance Variables
  
      public static String JMX_SERVICE_PREFIX = "service:jmx:rmi:///jndi/rmi://";
      public static String JMX_SERVICE_SUFFIX = "/jmxrmi";
  
      private String name = null;
      private String resultproperty;
      private String url = null;
      private String host = "localhost";
      private String port = "8050";
      private String password = null;
      private String username = null;
      private String ref = "jmx.server";
      private boolean echo = false;
      private boolean separatearrayresults = true;
      private String delimiter;
  
      // ----------------------------------------------------- Instance Info
  
      /**
       * Descriptive information describing this implementation.
       */
      private static final String info = "org.apache.catalina.ant.JMXAccessorTask/1.0";
  
      /**
       * Return descriptive information about this implementation and the
       * corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
          return (info);
  
      }
  
      // ------------------------------------------------------------- Properties
  
      /**
       * The name used at remote MbeanServer
       */
  
      public String getName() {
          return (this.name);
      }
  
      public void setName(String objectName) {
          this.name = objectName;
      }
      
      /**
       * @return Returns the resultproperty.
       */
      public String getResultproperty() {
          return resultproperty;
      }
      /**
       * @param resultproperty The resultproperty to set.
       */
      public void setResultproperty(String propertyName) {
          this.resultproperty = propertyName;
      }
   
      /**
       * @return Returns the delimiter.
       */
      public String getDelimiter() {
          return delimiter;
      }
      
      /**
       * @param delimiter The delimiter to set.
       */
      public void setDelimiter(String separator) {
          this.delimiter = separator;
      }
  
      /**
       * @return Returns the echo.
       */
      public boolean isEcho() {
          return echo;
      }
      
      /**
       * @param echo The echo to set.
       */
      public void setEcho(boolean echo) {
          this.echo = echo;
      }
      
      /**
       * @return Returns the separatearrayresults.
       */
      public boolean isSeparatearrayresults() {
          return separatearrayresults;
      }
      
      /**
       * @param separatearrayresults The separatearrayresults to set.
       */
      public void setSeparatearrayresults(boolean separateArrayResults) {
          this.separatearrayresults = separateArrayResults;
      }   
      
      /**
       * The login password for the <code>Manager</code> application.
       */
  
      public String getPassword() {
          return (this.password);
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
   
      /**
       * The login username for the <code>JMX</code> MBeanServer.
       */
  
      public String getUsername() {
          return (this.username);
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      /**
       * The URL of the <code>JMX JSR 160</code> MBeanServer to be used.
       */
      
      public String getUrl() {
          return (this.url);
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
      /**
       * The Host of the <code>JMX JSR 160</code> MBeanServer to be used.
       */
      
      public String getHost() {
          return (this.host);
      }
  
      public void setHost(String host) {
          this.host = host;
      }
  
      /**
       * The Port of the <code>JMX JSR 160</code> MBeanServer to be used.
       */
      
      public String getPort() {
          return (this.port);
      }
  
      public void setPort(String port) {
          this.port = port;
      }
  
      /**
       * @return Returns the useRef.
       */
      public boolean isUseRef() {
          return ref != null && !"".equals(ref);
      }
      
      /**
       * @return Returns the ref.
       */
      public String getRef() {
          return ref;
      }
      /**
       * @param ref The ref to set.
       */
      public void setRef(String refId) {
          this.ref = refId;
      }
   
    
      // --------------------------------------------------------- Public Methods
  
      /**
       * Execute the specified command.  This logic only performs the common
       * attribute validation required by all subclasses; it does not perform
       * any functional logic directly.
       *
       * @exception BuildException if a validation error occurs
       */
      public void execute() throws BuildException {
  
          try {
              String error = null;
  
              MBeanServerConnection jmxServerConnection = getJMXConnection();
              error = jmxExecute(jmxServerConnection);
              if (error != null && isFailOnError()) {
                  // exception should be thrown only if failOnError == true
                  // or error line will be logged twice
                  throw new BuildException(error);
              }
          } catch (Throwable t) {
              if (isFailOnError()) {
                  throw new BuildException(t);
              } else {
                  handleErrorOutput(t.getMessage());
              }
          } finally {
              closeRedirector();
          }
      }
        
      /**
       * create a new JMX Connection with auth when username and password is set.
       */
      public static MBeanServerConnection createJMXConnection(String url,
              String host, String port, String username, String password)
              throws MalformedURLException, IOException {
          String urlForJMX;
          if (url != null)
              urlForJMX = url;
          else
              urlForJMX = JMX_SERVICE_PREFIX + host + ":" + port
                      + JMX_SERVICE_SUFFIX;
          Map environment = null;
          if (username != null && password != null) {
              String[] credentials = new String[2];
              credentials[0] = username;
              credentials[1] = password;
              environment = new HashMap();
              environment.put(JMXConnector.CREDENTIALS, credentials);
          }
          return JMXConnectorFactory.connect(new JMXServiceURL(urlForJMX),
                  environment).getMBeanServerConnection();
  
      }
  
      /**
       * Get Current Connection from <em>ref</em> parameter or create a new
       * one!
       * 
       * @return
       * @throws MalformedURLException
       * @throws IOException
       */
      public static MBeanServerConnection accessJMXConnection(Project project,
              String url, String host, String port, String username,
              String password, String refId) throws MalformedURLException,
              IOException {
          MBeanServerConnection jmxServerConnection = null;
          boolean isRef = refId != null;
          if (isRef) {
              Object pref = project.getReference(refId);
              try {
                  jmxServerConnection = (MBeanServerConnection) pref;
              } catch (ClassCastException cce) {
                  project.log("wrong object reference " + refId + " - "
                          + pref.getClass());
                  return null;
              }
          }
          if (jmxServerConnection == null) {
              jmxServerConnection = createJMXConnection(url, host, port,
                      username, password);
          }
          if (isRef && jmxServerConnection != null) {
              project.addReference(refId, jmxServerConnection);
          }
          return jmxServerConnection;
      }
  
      // ------------------------------------------------------ protected Methods
  
      /**
       * get JMXConnection 
       * @return
       * @throws MalformedURLException
       * @throws IOException
       */
      protected MBeanServerConnection getJMXConnection()
              throws MalformedURLException, IOException {
  
          MBeanServerConnection jmxServerConnection = null;
          if (isUseRef()) {
              Object pref = getProject().getReference(getRef());
              try {
                  jmxServerConnection = (MBeanServerConnection) pref;
              } catch (ClassCastException cce) {
                  getProject().log(
                          "Wrong object reference " + getRef() + " - "
                                  + pref.getClass());
                  return null;
              }
             if (jmxServerConnection == null) {
                  jmxServerConnection = accessJMXConnection(getProject(),
                          getUrl(), getHost(), getPort(), getUsername(),
                          getPassword(), getRef());
              }
          } else {
              jmxServerConnection = accessJMXConnection(getProject(), getUrl(),
                      getHost(), getPort(), getUsername(), getPassword(), null);
          }
          return jmxServerConnection;
      }
      
  
      /**
       * Execute the specified command, based on the configured properties. The
       * input stream will be closed upon completion of this task, whether it was
       * executed successfully or not.
       * 
       * @exception BuildException
       *                if an error occurs
       */
      protected String jmxExecute(MBeanServerConnection jmxServerConnection)
              throws Exception {
  
          if ((jmxServerConnection == null)) {
                  throw new BuildException("Must open a connection!");
          }
          return null;
      }
  
      /**
       * Convert string to datatype
       * FIXME How we can transfer values from ant project reference store (ref)?
       * @param value
       * @param type
       * @return
       */
      protected Object convertStringToType(String value, String valueType)
      {
          if ("java.lang.String".equals(valueType))
              return value;
          
          Object convertValue = value ;        
          if ("java.lang.Integer".equals(valueType)
                  || "int".equals(valueType)) {
              try {
                  convertValue = new Integer(value);
              } catch (NumberFormatException ex) {
                  if(isEcho())
                      handleErrorOutput("Unable to convert to integer:" + value);
              }
          }else if ("java.lang.Long".equals(valueType)
                      || "long".equals(valueType)) {
                  try {
                      convertValue = new Long(value);
                  } catch (NumberFormatException ex) {
                      if(isEcho())
                          handleErrorOutput("Unable to convert to long:" + value);
                  }
          } else if ("java.lang.Boolean".equals(valueType)
                  || "boolean".equals(valueType)) {
              convertValue = new Boolean(value);
          }else if ("java.lang.Float".equals(valueType)
                  || "float".equals(valueType)) {
              try {
                  convertValue = new Float(value);
              } catch (NumberFormatException ex) {
                  if(isEcho())
                      handleErrorOutput("Unable to convert to float:" + value);
              }
          }else if ("java.lang.Double".equals(valueType)
                  || "double".equals(valueType)) {
              try {
                  convertValue = new Double(value);
              } catch (NumberFormatException ex) {
                  if(isEcho())
                      handleErrorOutput("Unable to convert to double:" + value);
              }
          }else if ("javax.management.ObjectName".equals(valueType)
                  || "name".equals(valueType)) {
              try {
                  convertValue = new ObjectName(value);
              } catch (MalformedObjectNameException e) {
                  if(isEcho())
                      handleErrorOutput("Unable to convert to ObjectName:" + value);
              }
          } else if ("java.net.InetAddress".equals(valueType)) {
              try {
                  convertValue = InetAddress.getByName(value);
              } catch (UnknownHostException exc) {
                  if(isEcho())
                      handleErrorOutput("Unable to resolve host name:" + value);
              }
          }
          return convertValue;
      }
  
  
      
      /**
       * @param name context of result
       * @param result
       */
      protected void echoResult(String name,Object result ) {
          if(isEcho()) {
              if (result.getClass().isArray()) {
                  Object array[] = (Object[]) result;
                  for (int i = 0; i < array.length; i++) {
                      handleOutput(name + "." + i + "=" + array[i]);
                  }
              } else
                  handleOutput(name + "=" + result);
          }
      }
  
      /**
       * create result as property with name from attribute resultproperty 
       * When result is an array and isSeparateArrayResults is true,
       * resultproperty used as prefix (<code>resultproperty.0-array.length</code> 
       * and store the result array length at <code>resultproperty.length</code>.
       * Other option is that you delemit your result with a delimiter (java.util.StringTokenizer is used).
       * @param result
       */
      protected void createProperty(Object result) {
          if (resultproperty != null) {
              if (result.getClass().isArray()) {
                  if (isSeparatearrayresults()) {
                      Object array[] = (Object[]) result;
                      for (int i = 0; i < array.length; i++) {
                          getProject().setNewProperty(resultproperty + "." + i,
                                  array[i].toString());
                      }
                      getProject().setNewProperty(resultproperty + ".length",
                              Integer.toString(array.length));
                      return ;
                  }
              }
              String delim = getDelimiter();
              if(delim != null) {
                  StringTokenizer tokenizer = new StringTokenizer(result.toString(),delim);
                  int len = 0;
                  for (; tokenizer.hasMoreTokens(); len++) {
                       String token = tokenizer.nextToken();
                       getProject().setNewProperty(resultproperty + "." + len,
                              token);
                  }
                  getProject().setNewProperty(resultproperty + ".length",
                          Integer.toString(len));                
              } else
                  getProject().setNewProperty(resultproperty, result.toString());
          }
      }
      
  }
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/antlib.xml
  
  Index: antlib.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <antlib>
    <typedef
          name="open"
          classname="org.apache.catalina.ant.jmx.JMXAccessorTask" />
    <typedef
          name="set"
          classname="org.apache.catalina.ant.jmx.JMXAccessorSetTask" />
    <typedef
          name="get"
          classname="org.apache.catalina.ant.jmx.JMXAccessorGetTask" />
    <typedef
          name="invoke"
          classname="org.apache.catalina.ant.jmx.JMXAccessorInvokeTask" />
    <typedef
          name="query"
          classname="org.apache.catalina.ant.jmx.JMXAccessorQueryTask" />
    <typedef
          name="equals"
          classname="org.apache.catalina.ant.jmx.JMXAccessorEqualsCondition" />
  </antlib>
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/jmxaccessor.tasks
  
  Index: jmxaccessor.tasks
  ===================================================================
  # JMX
  jmxOpen=org.apache.catalina.ant.jmx.JMXAccessorTask
  jmxSet=org.apache.catalina.ant..jmx.JMXAccessorSetTask
  jmxGet=org.apache.catalina.ant.jmx.JMXAccessorGetTask
  jmxInvoke=org.apache.catalina.ant.jmx.JMXAccessorInvokeTask
  jmxQuery=org.apache.catalina.ant.jmx.JMXAccessorQueryTask
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/jmx/package.html
  
  Index: package.html
  ===================================================================
  <body>
  
  <p>This package contains a set of <code>JMX Task</code> implementations for
  <em>Ant (version 1.6 or later)</em> that can be used to interact with the
  Remote JMX JSR 160 RMI Adaptor to get/set attributes, invoke MBean operations
  and query for Mbeans inside a running instance of Tomcat.  For more information, see
  <a href="http://jakarta.apache.org/tomcat/tomcat-5.5-doc/monitoring.html">
  http://jakarta.apache.org/tomcat/tomcat-5.5-doc/monitoring.html</a>.</p>
  
  <p>Each task element can open a new jmx connection or reference an
  	existing one. The following attribute are exists in every tasks:
  </p>
  
  <table>
    <tr>
      <th align="center" width="15%">Attribute</th>
      <th align="center" width="85%">Description</th>
    </tr>
    <tr>
      <td align="center">url</td>
      <td>
        The JMX Connection URL of the remote Tomcat MBeansServer.
      </td>
    </tr>
    <tr>
      <td align="center">username</td>
      <td>
        The username of a MBeanServer auth, when configured.
      </td>
    </tr>
    <tr>
      <td align="center">password</td>
      <td>
        The password of a MBeanServer auth, when configured.
      </td>
    </tr>
    <tr>
      <td align="center">host</td>
      <td>
        The JMX Connection host.
      </td>
    </tr>
    <tr>
      <td align="center">port</td>
      <td>
        The JMX Connection port.
      </td>
    </tr>
    <tr>
      <td align="center">ref</td>
      <td>
        The name of the ant internal reference for a jmx connection.
      </td>
    </tr>
  
  </table>
  
  <p><strong>NOTE</strong> - This Tasks only work, 
  	when JSR 160 MBean Adaptor as remote jvm is configured.</p>
  
  </body>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message