|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.admin.cli.Environment
public final class 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.
| Field Summary | |
|---|---|
static String |
AS_ADMIN_ENV_PREFIX
|
private Map<String,String> |
env
|
| Constructor Summary | |
|---|---|
Environment()
Initialize 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 | |
|---|---|
Set<Map.Entry<String,String>> |
entrySet()
Return a set of all the entries, just like a Map does. |
String |
get(String name)
Get the named environment entry. |
boolean |
getBooleanOption(String name)
Return the value of the environment entry corresponding to the named option. |
String |
getStringOption(String name)
Return the value of the environment entry corresponding to the named option. |
boolean |
hasOption(String name)
Is there an environment entry corresponding to the named option? |
private String |
optionToEnv(String name)
Convert an option name (e.g., "host") to an environment variable name (e.g., AS_ADMIN_HOST). |
String |
put(String name,
String value)
Set the named environment entry to the specified value. |
String |
putOption(String name,
String value)
Set the environment entry corresponding to the named option to the specified value. |
void |
remove(String name)
Remove the name environment entry. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String AS_ADMIN_ENV_PREFIX
private Map<String,String> env
| Constructor Detail |
|---|
public Environment()
public Environment(boolean ignoreEnvironment)
| Method Detail |
|---|
public boolean getBooleanOption(String name)
name - the option name
public String getStringOption(String name)
name - the option name
public boolean hasOption(String name)
name - the option name
public String get(String name)
name - the name of the environment entry
public String put(String name,
String value)
name - the environment entry namevalue - the value
public void remove(String name)
name - the environment entry name
public String putOption(String name,
String value)
name - the option namevalue - the value
public Set<Map.Entry<String,String>> entrySet()
private String optionToEnv(String name)
name - the option name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||