All Packages Class Hierarchy This Package Previous Next Index
Class semper.util.system.Env
java.lang.Object
|
+----semper.util.system.Env
- public class Env
- extends Object
This class acts as a front-end for interaction with the system environment.
- Version:
- $Revision: 1.6 $ $Date: 1997/09/26 11:03:44 $
- Author:
- N. Asokan ([email protected])
-
Env()
-
-
getEnvVarsTable()
- Dump the list of known environment variables and their values
-
getLocalEnvVar(String)
- Get the local value of an environment variable; for variables
that were set via this front end, this must be the same as the
actual value in the environment
-
getSystemEnvVar(String)
- Get the value of a variable from the system environment; for
variables that were set via this front end, this must be the same
as the local value maintained in the front-end.
-
init()
- Initialise the environment interaction front-end.
-
initEnv()
- Initialise the environment by setting all known variables to the
values according to the local table
-
isInitialised()
- Check if the environment interaction front-end has been
initialised
-
removeEnvVar(String, String)
- Remove an environment variable.
-
setEnvVar(String, String, String)
- Set the specified environment variable.
Env
public Env()
init
public static void init() throws EnvException
- Initialise the environment interaction front-end.
- Throws: EnvException
- if initialisation failed
isInitialised
public static boolean isInitialised()
- Check if the environment interaction front-end has been
initialised
- Returns:
- true/false
setEnvVar
public static void setEnvVar(String name,
String value,
String creator) throws EnvException
- Set the specified environment variable. Once set, only the
creator of the environment variable can reset or remove that
variable. Currently, no access control checks are done though.
- Parameters:
- name - name of the variable
- value - the proposed new value
- creator - identity of the creator (for now, it can be any
string; eventually it must be a name that can be authenticated
by external means)
- Throws: EnvException
- if the variable cannot be set
removeEnvVar
public static void removeEnvVar(String name,
String creator) throws EnvException
- Remove an environment variable. Only the creator of a variable
can remove it. The variable is removed from the local table but
NOT from the environment itself. To unset an environment variable
from the environment, the process must be restarted.
- Parameters:
- name - name of the variable
- creator - identity of the creator
- Throws: EnvException
- if removal didn't succeed
getLocalEnvVar
public static String getLocalEnvVar(String name)
- Get the local value of an environment variable; for variables
that were set via this front end, this must be the same as the
actual value in the environment
- Parameters:
- name - name of the variable
- Returns:
- (local) value of the variable
- See Also:
- getSystemEnvVar
getSystemEnvVar
public static String getSystemEnvVar(String name)
- Get the value of a variable from the system environment; for
variables that were set via this front end, this must be the same
as the local value maintained in the front-end.
Be very careful when using this function: on some platforms (windows,
linux,...), if the environment variable was not already set, java
seg faults. If the variable is already set, there is no problem.
- Parameters:
- name - name of the variable
- Returns:
- value of the variable in the environment
- See Also:
- getLocalEnvVar
getEnvVarsTable
public static Enumeration getEnvVarsTable()
- Dump the list of known environment variables and their values
- Returns:
- Enumeration containing the environment variables
- See Also:
- EnvVar
initEnv
public static void initEnv() throws EnvException
- Initialise the environment by setting all known variables to the
values according to the local table
- Throws: EnvException
- when initialisation has failed
All Packages Class Hierarchy This Package Previous Next Index