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])

Constructor Index

 o Env()

Method Index

 o getEnvVarsTable()
Dump the list of known environment variables and their values
 o 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
 o 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.
 o init()
Initialise the environment interaction front-end.
 o initEnv()
Initialise the environment by setting all known variables to the values according to the local table
 o isInitialised()
Check if the environment interaction front-end has been initialised
 o removeEnvVar(String, String)
Remove an environment variable.
 o setEnvVar(String, String, String)
Set the specified environment variable.

Constructors

 o Env
 public Env()

Methods

 o init
 public static void init() throws EnvException
Initialise the environment interaction front-end.

Throws: EnvException
if initialisation failed
 o isInitialised
 public static boolean isInitialised()
Check if the environment interaction front-end has been initialised

Returns:
true/false
 o 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
 o 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
 o 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
 o 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
 o getEnvVarsTable
 public static Enumeration getEnvVarsTable()
Dump the list of known environment variables and their values

Returns:
Enumeration containing the environment variables
See Also:
EnvVar
 o 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