Package com.sun.enterprise.admin.cli
Class Environment
java.lang.Object
com.sun.enterprise.admin.cli.Environment
The environment variables for CLI commands. An instance of this class is passed to each command to give it access to
environment variables. Command implementations should access environment information from this class rather than
using System.getenv. In multimode, the export command may change environment variables in the instance of this class
that is shared by all commands.
- Author:
- Bill Shannon
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize the enviroment with all relevant system environment entries.Environment(boolean ignoreEnvironment) Constructor that ignores the system environment, mostly used to enable repeatable tests. -
Method Summary
Modifier and TypeMethodDescriptionbooleandebug()entrySet()Return a set of all the entries, just like a Map does.Get the named environment entry.booleangetBooleanOption(String name) Return the value of the environment entry corresponding to the named option.static StringGet the name of the environment variable used to set debugging onstatic StringGet the prefix for environment variables referenced from the system environment by Environment objects.getStringOption(String name) Return the value of the environment entry corresponding to the named option.booleanIs there an environment entry corresponding to the named option?Set the named environment entry to the specified value.Set the environment entry corresponding to the named option to the specified value.voidRemove the name environment entry.static voidSet the prefix for environment variables referenced from the system environment by Environment objects.static voidSet the short prefix for environment variables referenced from the system enviornment by Environment objects.booleantrace()
-
Constructor Details
-
Environment
public Environment()Initialize the enviroment with all relevant system environment entries. -
Environment
public Environment(boolean ignoreEnvironment) Constructor that ignores the system environment, mostly used to enable repeatable tests.
-
-
Method Details
-
setPrefix
Set the prefix for environment variables referenced from the system environment by Environment objects.- Parameters:
p- the new prefix
-
getPrefix
Get the prefix for environment variables referenced from the system environment by Environment objects. -
setShortPrefix
Set the short prefix for environment variables referenced from the system enviornment by Environment objects. This effects methods such as debug(), trace(), etc. -
getDebugVar
Get the name of the environment variable used to set debugging on -
getBooleanOption
Return the value of the environment entry corresponding to the named option.- Parameters:
name- the option name- Returns:
- the value of the corresponding environment entry
-
getStringOption
Return the value of the environment entry corresponding to the named option.- Parameters:
name- the option name- Returns:
- the value of the corresponding environment entry
-
hasOption
Is there an environment entry corresponding to the named option?- Parameters:
name- the option name- Returns:
- true if there's a corresponding environment entry
-
get
Get the named environment entry.- Parameters:
name- the name of the environment entry- Returns:
- the value of the entry, or null if no such entry
-
put
Set the named environment entry to the specified value.- Parameters:
name- the environment entry namevalue- the value- Returns:
- the previous value of the entry
-
remove
Remove the name environment entry.- Parameters:
name- the environment entry name
-
putOption
Set the environment entry corresponding to the named option to the specified value.- Parameters:
name- the option namevalue- the value- Returns:
- the previous value of the entry
-
entrySet
Return a set of all the entries, just like a Map does. -
debug
public boolean debug() -
trace
public boolean trace() -
getDebugLogfile
-
getLogFormatter
-