InvokeCmdpublic class InvokeCmd extends JMXCmd
Fields Summary |
---|
public static String | FORMAL_NAME |
Constructors Summary |
---|
public InvokeCmd(CmdEnv env)
super( env );
|
Methods Summary |
---|
void | displayResults(com.sun.cli.jmx.support.InvokeResult[] results)
println( new SmartStringifier( "\n", false ).stringify( results ) );
| void | executeInternal()
final String cmdString = getCmdNameAsInvoked();
String [] targets = getTargets();
final int colonPos = cmdString.indexOf( ":" );
if ( cmdString.equals( FORMAL_NAME ) )
{
printUsage();
return;
}
else if ( colonPos < 0 )
{
printError( CmdStrings.NO_SUCH_COMMAND + cmdString );
return;
}
String argList = null;
String methodName = null;
final int dotIndex = cmdString.indexOf( '." );
if ( dotIndex > 0 && dotIndex < colonPos )
{
requireNumOperands( 0 );
targets = new String [] { cmdString.substring( 0, dotIndex ) };
methodName = cmdString.substring( dotIndex + 1, colonPos );
}
else
{
methodName = cmdString.substring( 0, colonPos );
}
if ( colonPos + 1 != cmdString.length() )
{
argList = cmdString.substring( colonPos + 1, cmdString.length() );
}
else
{
argList = null;
}
//p( "INVOKE: " + methodName + "(" + argList + ") on " + ArrayStringifier.stringify( targets, " " ) );
establishProxy();
final InvokeResult [] results = invoke( methodName, argList, targets );
getProxy().mbeanInvoke( methodName, argList, targets );
if ( results.length == 0 )
{
println( "Invocation failed: no targets found that match the expression" );
}
else
{
displayResults( results );
}
| public static java.lang.String[] | getNames()
return( new String [] { FORMAL_NAME, CmdFactory.DEFAULT_CMD_NAME} );
| int | getNumRequiredOperands()
// require 1, by default
return( 0 );
| public java.lang.String | getUsage()
return( CmdStrings.INVOKE_HELP.toString() );
| com.sun.cli.jmx.support.InvokeResult[] | invoke(java.lang.String operationName, java.lang.String argList, java.lang.String[] targets)
final InvokeResult [] results = getProxy().mbeanInvoke( operationName, argList, targets );
return( results );
|
|