Methods Summary |
---|
private java.lang.String | checkForPrefix(java.lang.String name)this method check for prefix AS_ADMIN
returns the name without the prefix AS_ADMIN
String envName = null;
//check for prefix AS_ADMIN
if (name.regionMatches(true, 0, ENVIRONMENT_PREFIX, 0,
ENVIRONMENT_PREFIX.length()))
{
//extract AS_ADMIN from sOperandName
envName = name.substring(ENVIRONMENT_PREFIX.length());
}
else
{
throw new CommandException(getLocalizedString("CouldNotUnsetVariable",
new Object[] {name}));
}
return envName.toLowerCase();
|
private void | removeAllEnvironments()this method is called when AS_ADMIN_* is encountered.
The wildcard means to remove all variables set in the environment.
// remove the Local environments
MultiProcessCommand.removeAllEnvironments();
final java.util.HashMap envMap = new
java.util.HashMap(commandEnvironment.getEnvironments());
final java.util.Iterator envIter = envMap.keySet().iterator();
while (envIter.hasNext())
{
final String envName = (String)envIter.next();
if (commandEnvironment.removeEnvironment(envName) == null)
CLILogger.getInstance().printWarning(getLocalizedString(
"UnableToRemoveEnv",
new Object[] {envName}));
}
|
public void | runCommand()Executes the command
validateOptions();
for (int ii = 0; ii < operands.size(); ii++)
{
updateEnvironment((String)operands.elementAt(ii));
}
|
private void | updateEnvironment(java.lang.String nameStr)this method updates the variables by removing them from the
command environment (local and global).
final String envName = checkForPrefix(nameStr);
if (envName.equals("*"))
{
// Remove both the local and global environment variables
removeAllEnvironments();
}
else
{
if (MultiProcessCommand.removeLocalEnvironment(envName) != null)
{
// Also remove the global environment if exists
commandEnvironment.removeEnvironment(envName);
}
else if (commandEnvironment.removeEnvironment(envName) == null)
{
throw new CommandException(getLocalizedString("UnableToRemoveEnv",
new Object[] {nameStr}));
}
}
|
public boolean | validateOptions()Validates the Options for correctness
return super.validateOptions();
|