A list of MBeans and methods for each bean can be seen here:
Invoke
Invokes the object operation by conforming the parameter list to the
signature. Returns the result of the invocation.
Parameters: name -- java.lang.String; operationName -- java.lang.String;
params -- java.lang.String; sigs -- java.lang.String
Return Type: java.lang.String
The params input parameters for the MBean method, when using the
AdminControl invoke method, cast all inputs as a String when the MBean
method expected a complex Java object.
Review the AdminControl
command from the Information Center.
The invoke_jmx function accomplishes the goal:
invoke_jmx
Invokes the object operation by conforming the parameter list to the
signature. Returns the result of the invocation.
Parameters: name -- ObjectName; operationName -- java.lang.String; params
-- java.lang.Object[]; signature -- java.lang.String[];
Return Type: java.lang.Object
This function accepts and returns the complexJava objects required for
wsadmin to invoke some of the MBean methods.
Below is an example command to get the Enterprise Application information
using JACL with wsadmin:
set a [$AdminControl queryNames type=AppManagement,*]
set objName [java::new javax.management.ObjectName $a]
set perfs [java::new java.util.Hashtable]
set l [list adminconsole $perfs ""]
set params [java::new {Object[]} 3 $l]
set signature [java::new {java.lang.String[]} 3 {java.lang.String
java.util.Hashtable java.lang.String}]
set out [$AdminControl invoke_jmx $objName getApplicationInfo $params
$signature]
set vec [java::cast java.util.Vector $out]
set e0 [$vec elementAt 0]
set roles [java::cast
com.ibm.ws.management.application.client.MapRolesToUsers $e0]
set rolesMatrix [$roles getTaskData]
set l1 [$rolesMatrix length]
for {set x 0} {$x<$l1} {incr x} {
puts $x
set rolesString [$rolesMatrix get $x]
puts $rolesString
set l2 [$rolesString length]
for {set y 0} {$y<$l2} {incr y} {
set outputString [$rolesString get 1]
puts $outputString
}
}
You must use the JACL java::cast command to properly set the return
information to a Java object that can be manipulated.
|