| org.apache.catalina.ant.BaseRedirectorHelperTask org.apache.catalina.ant.jmx.JMXAccessorTask
All known Subclasses: org.apache.catalina.ant.jmx.JMXAccessorCreateTask, org.apache.catalina.ant.jmx.JMXAccessorUnregisterTask, org.apache.catalina.ant.jmx.JMXAccessorGetTask, org.apache.catalina.ant.jmx.JMXAccessorSetTask, org.apache.catalina.ant.jmx.JMXAccessorInvokeTask, org.apache.catalina.ant.jmx.JMXAccessorQueryTask,
JMXAccessorTask | public class JMXAccessorTask extends BaseRedirectorHelperTask (Code) | | Access JMX JSR 160 MBeans Server.
- open more then one JSR 160 rmi connection
- Get/Set Mbeans attributes
- Call Mbean Operation with arguments
- Argument values can be converted from string to
int,long,float,double,boolean,ObjectName or InetAddress
- Query Mbeans
- Show Get, Call, Query result at Ant console log
- Bind Get, Call, Query result at Ant properties
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.
author: Peter Rossbach version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $ since: 5.5.10 |
Method Summary | |
public static MBeanServerConnection | accessJMXConnection(Project project, String url, String host, String port, String username, String password, String refId) | protected Object | convertStringToType(String value, String valueType) | public static MBeanServerConnection | createJMXConnection(String url, String host, String port, String username, String password) create a new JMX Connection with auth when username and password is set. | protected void | createProperty(Object result) | 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 . | protected void | echoResult(String name, Object result) | public void | execute() Execute the specified command. | 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() | public String | getName() | 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() | public String | getProperty(String property) | 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) Execute the specified command, based on the configured properties. | 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() | protected boolean | testUnlessCondition() |
JMX_SERVICE_PREFIX | public static String JMX_SERVICE_PREFIX(Code) | | |
JMX_SERVICE_SUFFIX | public static String JMX_SERVICE_SUFFIX(Code) | | |
convertStringToType | protected Object convertStringToType(String value, String valueType)(Code) | | Convert string to datatype FIXME How we can transfer values from ant
project reference store (ref)?
Parameters: value - The value Parameters: valueType - The type The converted object |
createProperty | protected void createProperty(String propertyPrefix, Object result)(Code) | | 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).
Parameters: propertyPrefix - Parameters: result - |
echoResult | protected void echoResult(String name, Object result)(Code) | | Parameters: name - context of result Parameters: result - |
execute | public void execute() throws BuildException(Code) | | 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 |
getDelimiter | public String getDelimiter()(Code) | | Returns the delimiter. |
getHost | public String getHost()(Code) | | The Host of the JMX JSR 160 MBeanServer to be used.
|
getInfo | public String getInfo()(Code) | | Return descriptive information about this implementation and the
corresponding version number, in the format
<description>/<version> .
|
getName | public String getName()(Code) | | The name used at remote MbeanServer
|
getPassword | public String getPassword()(Code) | | The login password for the Manager application.
|
getPort | public String getPort()(Code) | | The Port of the JMX JSR 160 MBeanServer to be used.
|
getProperties | public Map getProperties()(Code) | | get all properties, when project is there got all project Properties
properties |
getProperty | public String getProperty(String property)(Code) | | get all Properties
Parameters: property - The property |
getResultproperty | public String getResultproperty()(Code) | | Returns the resultproperty. |
getUnless | public String getUnless()(Code) | | Returns the unlessCondition. |
getUrl | public String getUrl()(Code) | | The URL of the JMX JSR 160 MBeanServer to be used.
|
getUsername | public String getUsername()(Code) | | The login username for the JMX MBeanServer.
|
isEcho | public boolean isEcho()(Code) | | Returns the echo. |
isSeparatearrayresults | public boolean isSeparatearrayresults()(Code) | | Returns the separatearrayresults. |
isUseRef | public boolean isUseRef()(Code) | | Returns the useRef. |
jmxExecute | public String jmxExecute(MBeanServerConnection jmxServerConnection) throws Exception(Code) | | 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: Exception - if an error occurs |
setDelimiter | public void setDelimiter(String separator)(Code) | | Parameters: separator - The delimiter to set. |
setEcho | public void setEcho(boolean echo)(Code) | | Parameters: echo - The echo to set. |
setIf | public void setIf(String c)(Code) | | Only execute if a property of the given name exists in the current
project.
Parameters: c - property name |
setProperty | public boolean setProperty(String property, Object value)(Code) | | Parameters: property - The property Parameters: value - The value True if successful |
setRef | public void setRef(String refId)(Code) | | Parameters: refId - The ref to set. |
setResultproperty | public void setResultproperty(String propertyName)(Code) | | Parameters: propertyName - The resultproperty to set. |
setSeparatearrayresults | public void setSeparatearrayresults(boolean separateArrayResults)(Code) | | Parameters: separateArrayResults - The separatearrayresults to set. |
setUnless | public void setUnless(String c)(Code) | | Only execute if a property of the given name does not exist in the
current project.
Parameters: c - property name |
testIfCondition | protected boolean testIfCondition()(Code) | | test the if condition
true if there is no if condition, or the named property exists |
testUnlessCondition | protected boolean testUnlessCondition()(Code) | | test the unless condition
true if there is no unless condition, or there is a namedproperty but it doesn't exist |
|
|