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

SetenvCmd

public class SetenvCmd extends JMXCmd

Fields Summary
public static final String
NAME
private static final String
OPTIONS_INFO
public static final char
DELIM
Constructors Summary
public SetenvCmd(CmdEnv env)

		super( env );
	
Methods Summary
voiddisplayEnv()

		final Iterator	iter	= getEnvKeys().iterator();
		
		while ( iter.hasNext() )
		{
			final String name	= (String)iter.next();
			
			final Object value	= envGet( name );
			
			if ( value instanceof String )
			{
				println( name + "=" + value );
			}
		}
	
voidexecuteInternal()

	
		
	
		 
	
		final String []	operands	= getOperands();
		
		if ( operands.length == 0 )
		{
			displayEnv();
		}
		else if ( operands.length == 1 )
		{
			final String oper	= operands[ 0 ];
			final int			delimIndex	= oper.indexOf( DELIM );
			
				
			if ( delimIndex > 0 )
			{
				final String	name	= oper.substring( 0, delimIndex );
				final String	value	= oper.substring( delimIndex + 1, oper.length() );
				
				envPut( name, value, true );
			}
			else
			{
				if ( envGet( oper ) != null )
				{
					envRemove( oper );
					println( "Variable " + oper + " removed." );
				}
				else
				{
					println( "Variable " + oper + " does not exist." );
				}
			}
		}
		else
		{
			printUsage();
		}
	
public static java.lang.String[]getNames()

	
		   
	 
	
		return( new String [] { NAME } );
	
intgetNumRequiredOperands()

		return( 0 );
	
ArgHelper.OptionsInfogetOptionInfo()

		
	
		
	
		 
	
		return( new ArgHelperOptionsInfo( OPTIONS_INFO ) );
	
java.lang.StringgetUsage()

		return( CmdStrings.SETENV_HELP.toString() );
		//return( CmdStrings.SETENV_HELP.toString() );