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

All Implemented Interfaces:
    Cloneable

Direct Known Subclasses:
    JMXAccessorSetTask, JMXAccessorCreateTask, JMXAccessorUnregisterTask, JMXAccessorQueryTask, JMXAccessorGetTask, JMXAccessorInvokeTask

Access JMX JSR 160 MBeans Server. Examples: open server with reference and autorisation

   <jmxOpen
           host="127.0.0.1"
           port="9014"
           username="monitorRole"
           password="mysecret"
           ref="jmx.myserver" 
       />
 
All calls after opening with same refid reuse the connection.

First call to a remote MBeanserver save the JMXConnection a referenz jmx.server

All JMXAccessorXXXTask support the attribute if and unless. With if the task is only execute when property exist and with unless when property not exists.
NOTE : These tasks require Ant 1.6 or later interface.
Field Summary
public static  String JMX_SERVICE_PREFIX     
public static  String JMX_SERVICE_SUFFIX     
Fields inherited from org.apache.catalina.ant.BaseRedirectorHelperTask:
redirector,  redirectorElement,  redirectOutStream,  redirectErrStream,  redirectOutPrintStream,  redirectErrPrintStream,  failOnError,  redirectOutput,  redirectorConfigured,  alwaysLog
Fields inherited from org.apache.tools.ant.Task:
target,  taskName,  taskType,  wrapper
Fields inherited from org.apache.tools.ant.ProjectComponent:
project,  location,  description
Method from org.apache.catalina.ant.jmx.JMXAccessorTask Summary:
accessJMXConnection,   convertStringToType,   createJMXConnection,   createProperty,   createProperty,   echoResult,   execute,   getDelimiter,   getHost,   getIf,   getInfo,   getJMXConnection,   getName,   getPassword,   getPort,   getProperties,   getProperty,   getRef,   getResultproperty,   getUnless,   getUrl,   getUsername,   isEcho,   isSeparatearrayresults,   isUseRef,   jmxExecute,   setDelimiter,   setEcho,   setHost,   setIf,   setName,   setPassword,   setPort,   setProperty,   setRef,   setResultproperty,   setSeparatearrayresults,   setUnless,   setUrl,   setUsername,   testIfCondition,   testUnlessCondition
Methods from org.apache.catalina.ant.BaseRedirectorHelperTask:
addConfiguredRedirector,   closeRedirector,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleFlush,   handleOutput,   handleOutput,   isFailOnError,   openRedirector,   setAlwaysLog,   setAppend,   setCreateEmptyFiles,   setError,   setErrorProperty,   setFailonerror,   setLogError,   setOutput,   setOutputproperty
Methods from org.apache.tools.ant.Task:
bindToOwner,   execute,   getOwningTarget,   getRuntimeConfigurableWrapper,   getTaskName,   getTaskType,   getWrapper,   handleErrorFlush,   handleErrorOutput,   handleFlush,   handleInput,   handleOutput,   init,   isInvalid,   log,   log,   log,   log,   markInvalid,   maybeConfigure,   perform,   reconfigure,   setOwningTarget,   setRuntimeConfigurableWrapper,   setTaskName,   setTaskType
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.JMXAccessorTask Detail:
 public static MBeanServerConnection accessJMXConnection(Project project,
    String url,
    String host,
    String port,
    String username,
    String password,
    String refId) throws MalformedURLException, IOException 
    Get Current Connection from ref parameter or create a new one!
 protected Object convertStringToType(String value,
    String valueType) 
    Convert string to datatype FIXME How we can transfer values from ant project reference store (ref)?
 public static MBeanServerConnection createJMXConnection(String url,
    String host,
    String port,
    String username,
    String password) throws MalformedURLException, IOException 
    create a new JMX Connection with auth when username and password is set.
 protected  void createProperty(Object result) 
    create result as property with name from attribute resultproperty
 protected  void createProperty(String propertyPrefix,
    Object result) 
    create result as property with name from property prefix When result is an array and isSeparateArrayResults is true, resultproperty used as prefix (resultproperty.0-array.length and store the result array length at resultproperty.length. Other option is that you delemit your result with a delimiter (java.util.StringTokenizer is used).
 protected  void echoResult(String name,
    Object result) 
 public  void execute() throws BuildException 
    Execute the specified command. This logic only performs the common attribute validation required by all subclasses; it does not perform any functional logic directly.
 public String getDelimiter() 
 public String getHost() 
    The Host of the JMX JSR 160 MBeanServer to be used.
 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
 public String getName() 
    The name used at remote MbeanServer
 public String getPassword() 
    The login password for the Manager application.
 public String getPort() 
    The Port of the JMX JSR 160 MBeanServer to be used.
 public Map getProperties() 
    get all properties, when project is there got all project Properties
 public String getProperty(String property) 
    get all Properties
 public String getRef() 
 public String getResultproperty() 
 public String getUnless() 
 public String getUrl() 
    The URL of the JMX JSR 160 MBeanServer to be used.
 public String getUsername() 
    The login username for the JMX MBeanServer.
 public boolean isEcho() 
 public boolean isSeparatearrayresults() 
 public boolean isUseRef() 
 public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception 
    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.
 public  void setDelimiter(String separator) 
 public  void setEcho(boolean echo) 
 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 setPassword(String password) 
 public  void setPort(String port) 
 public boolean setProperty(String property,
    Object value) 
 public  void setRef(String refId) 
 public  void setResultproperty(String propertyName) 
 public  void setSeparatearrayresults(boolean separateArrayResults) 
 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) 
 protected boolean testIfCondition() 
    test the if condition
 protected boolean testUnlessCondition() 
    test the unless condition