FileDocCategorySizeDatePackage
TargetCmd.javaAPI DocGlassfish v2 API3634Fri May 04 22:24:50 BST 2007com.sun.cli.jmx.cmd

TargetCmd

public class TargetCmd extends JMXCmd

Fields Summary
Constructors Summary
public TargetCmd(CmdEnv env)

		super( env );
	
Methods Summary
voiddisplayExistingTarget()

		println( "Targets:\n" +  envGet( ENV_TARGET ) );
	
voidexecuteInternal()

		final String [] operands	= getOperands();
		
		assert( operands != null );
		
		if ( operands.length == 0 )
		{
			displayExistingTarget();
		}
		else
		{
			establishProxy();
			setTargets( operands );
		}
	
public static java.lang.String[]getNames()

		return( new String [] { "target", "t" } );
	
intgetNumRequiredOperands()

		// require 1, by default
		return( 0 );
	
public java.lang.StringgetUsage()

		return( CmdStrings.TARGET_HELP.toString() );
	
voidsetTargets(java.lang.String[] targets)

		putEnvTargets( targets );
		warnEmptyTargets( targets );
	
voidwarnEmptyTargets(java.lang.String[] targets)

		// issue warning if some targets could not be resolved to anything
		for ( int i = 0; i < targets.length; ++i )
		{
			final String	target	= targets[ i ];
			
			final ObjectName []	objects	=
				getProxy().resolveTargets( new String [] { target } );
				
			if ( objects.length == 0 )
			{
				println( "WARNING: target " +
					target + " does not resolve to any objects" );
			}
		}