Methods Summary |
---|
private java.lang.String | checkForPrefix(java.lang.String name)this method check for prefix AS_ADMIN
retursn 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("CouldNotSetVariable",
new Object[] {name}));
}
return envName.toLowerCase();
|
private void | printAllEnvValues()this method prints the environment variable.
if ((commandEnvironment.getNumEnvironments() == 0) &&
(MultiProcessCommand.getNumLocalEnvironments() == 0))
{
CLILogger.getInstance().printDetailMessage(
getLocalizedString("NoEnvironment"));
}
else
{
HashMap allEnvironments = commandEnvironment.getEnvironments();
// Add Local Environment values (Will contain only for passwords)
allEnvironments.putAll(MultiProcessCommand.getLocalEnvironments());
printEnvValues(allEnvironments);
}
|
private void | printEnvValue(java.lang.String name, java.lang.Object value)print one environment
final String displayName = ENVIRONMENT_PREFIX.concat(name.toUpperCase());
//Do not display the password value in clear text
if (name.endsWith(PASSWORD_STRING))
{
CLILogger.getInstance().printMessage(displayName + " = ********");
}
else
{
CLILogger.getInstance().printMessage(displayName + " = " + value);
}
|
private void | printEnvValues(java.util.HashMap allEnvironments)Prints the name,value pairs of the local or global environments
final Iterator envIterator = allEnvironments.keySet().iterator();
while (envIterator.hasNext())
{
final String name = (String) envIterator.next();
CLILogger.getInstance().printDebugMessage(
commandEnvironment.toString());
final Object value = allEnvironments.get(name);
printEnvValue(name, value);
}
|
public void | runCommand()Executes the command
validateOptions();
Vector operands = getOperands();
if (operands.size() == 0)
{
printAllEnvValues();
return;
}
for (int ii = 0; ii < operands.size(); ii++)
{
updateEnvironment((String)operands.elementAt(ii));
}
|
private void | updateEnvironment(java.lang.String nameStr)this method updates the variable in the CommandEnvironment object.
final int nameend = nameStr.indexOf(ENVIRONMENT_DELIMITER);
//remove the environment if command is "export AS_ADMIN_<name>="
if (nameend == nameStr.length()-1)
{
final String envName = checkForPrefix(nameStr.substring(0, nameend));
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.subSequence(0, nameend)}));
}
}
//print the value if the command is "export AS_ADMIN_<name>"
else if (nameend == -1)
{
final String name = checkForPrefix(nameStr);
if (MultiProcessCommand.getLocalEnvironmentValue(name) != null)
printEnvValue(name,
MultiProcessCommand.getLocalEnvironmentValue(name));
else
printEnvValue(name,
commandEnvironment.getEnvironmentValue(name));
}
//set the environment if the command is "export AS_ADMIN_<name>=<value>"
else
{
final String envName = checkForPrefix(nameStr.substring(0, nameend));
//Set only the password options in local environment
//to avoid printing the password warning message when in multimode
if (envName.matches(NOT_DEPRECATED_PASSWORDFILE_OPTIONS))
MultiProcessCommand.setLocalEnvironment(envName,
nameStr.substring(nameend+1));
else
commandEnvironment.setEnvironment(envName,
nameStr.substring(nameend+1));
}
|
public boolean | validateOptions()Validates the Options for correctness
return super.validateOptions();
|