JMXAccessorInvokeTaskpublic class JMXAccessorInvokeTask extends JMXAccessorTask 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:
First call to a remote MBeanserver save the JMXConnection a referenz jmx.server
These tasks require Ant 1.6 or later interface. |
Fields Summary |
---|
private String | operation | private List | args | private static final String | infoDescriptive information describing this implementation. |
Methods Summary |
---|
public void | addArg(Arg arg)
args.add(arg);
| public java.util.List | getArgs()
return args;
| public java.lang.String | getInfo()Return descriptive information about this implementation and the
corresponding version number, in the format
<description>/<version> .
return (info);
| public java.lang.String | getOperation()
return operation;
| public java.lang.String | jmxExecute(javax.management.MBeanServerConnection 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.
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());
| protected java.lang.String | jmxInvoke(javax.management.MBeanServerConnection jmxServerConnection, java.lang.String name)
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;
| public void | setArgs(java.util.List args)
this.args = args;
| public void | setOperation(java.lang.String operation)
this.operation = operation;
|
|