public class EnvironmentVariableList
extends java.lang.Object
implements java.io.Serializable
This class can only access system-level environment variables. You must have *JOBCTL special authority to add, change, or delete system-level environment variables.
This example gets the list of environment variables as a java.util.Properties object:
AS400 system = new AS400("mysystem");
EnvironmentVariableList evList = new EnvironmentVariableList(system);
Properties p = evList.getProperties();
This example uses an Enumeration to print the list of environment variable names and values:
AS400 system = new AS400("mysystem");
EnvironmentVariableList evList = new EnvironmentVariableList(system);
Enumeration list = evList.getEnvironmentVariables();
while (list.hasMoreElements())
{
EnvironmentVariable ev = (EnvironmentVariable)list.nextElement();
System.out.println(ev.getName() + "=" + ev.getValue());
}
EnvironmentVariable,
Serialized Form| Constructor and Description |
|---|
EnvironmentVariableList()
Constructs a EnvironmentVariableList object.
|
EnvironmentVariableList(AS400 system)
Constructs a EnvironmentVariableList object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.
|
java.util.Enumeration |
getEnvironmentVariables()
Returns an enumeration that contains an EnvironmentVariable object for each environment variable on the system.
|
java.util.Properties |
getProperties()
Returns a new Properties object which contains an entry for each environment variable in the list.
|
AS400 |
getSystem()
Returns the system on which the environment variable list exists.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.
|
void |
setProperties(java.util.Properties properties)
Sets the value of each environment variable defined in a Properties object.
|
void |
setProperties(java.util.Properties properties,
int stringType)
Sets the value of each environment variable defined in a Properties object.
|
void |
setSystem(AS400 system)
Sets the system for the environment variable list.
|
public EnvironmentVariableList()
public EnvironmentVariableList(AS400 system)
system - The system.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener object.public java.util.Enumeration getEnvironmentVariables()
throws AS400SecurityException,
ErrorCompletingRequestException,
java.lang.InterruptedException,
java.io.IOException,
ObjectDoesNotExistException
AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.public java.util.Properties getProperties()
throws AS400SecurityException,
ErrorCompletingRequestException,
java.lang.InterruptedException,
java.io.IOException,
ObjectDoesNotExistException
AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.public AS400 getSystem()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener object.public void setProperties(java.util.Properties properties)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.lang.InterruptedException,
java.io.IOException,
ObjectDoesNotExistException
properties - The Properties object.AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.public void setProperties(java.util.Properties properties,
int stringType)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.lang.InterruptedException,
java.io.IOException,
ObjectDoesNotExistException
properties - The Properties object.stringType - The environment variable bidi string type, as defined by the CDRA (Character Data Representation Architecture). See BidiStringType for more information and valid values.AS400SecurityException - If a security or authority error occurs.ErrorCompletingRequestException - If an error occurs before the request is completed.java.lang.InterruptedException - If this thread is interrupted.java.io.IOException - If an error occurs while communicating with the system.ObjectDoesNotExistException - If the object does not exist on the system.public void setSystem(AS400 system)
system - The system on which the environment variable list exists.