com.ibm.as400.access
Class EnvironmentVariableList

java.lang.Object
  |
  +--com.ibm.as400.access.EnvironmentVariableList
All Implemented Interfaces:
java.io.Serializable

public class EnvironmentVariableList
extends java.lang.Object
implements java.io.Serializable

The EnvironmentVariableList class represents a list of system-level AS/400 environment variables.

This class can only access system-level environment variables on V4R4 or later AS/400s. You must have *JOBCTL special authority to access 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 enum = evList.getEnvironmentVariables();
while(enum.hasMoreElements())
{
EnvironmentVariable ev = (EnvironmentVariable)enum.nextElement();
System.out.println(ev.getName() + "=" + ev.getValue());
}

See Also:
EnvironmentVariable, Serialized Form

Constructor Summary
EnvironmentVariableList()
          Constructs a EnvironmentVariableList object.
EnvironmentVariableList(AS400 system)
          Constructs a EnvironmentVariableList object.
 
Method Summary
 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.
 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 type)
          Sets the value of each environment variable defined in a Properties object.
 void setSystem(AS400 system)
          Sets the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentVariableList

public EnvironmentVariableList()
Constructs a EnvironmentVariableList object.

EnvironmentVariableList

public EnvironmentVariableList(AS400 system)
Constructs a EnvironmentVariableList object.
Parameters:
system - The system.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed.
Parameters:
listener - The listener.

getEnvironmentVariables

public java.util.Enumeration getEnvironmentVariables()
                                              throws AS400SecurityException,
                                                     ConnectionDroppedException,
                                                     ErrorCompletingRequestException,
                                                     java.lang.InterruptedException,
                                                     java.io.IOException,
                                                     ObjectDoesNotExistException
Returns an enumeration that contains an EnvironmentVariable object for each environment variable on the system.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
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 AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.

getProperties

public java.util.Properties getProperties()
                                   throws AS400SecurityException,
                                          ConnectionDroppedException,
                                          ErrorCompletingRequestException,
                                          java.lang.InterruptedException,
                                          java.io.IOException,
                                          ObjectDoesNotExistException
Returns a new Properties object which contains an entry for each environment variable in the list.
Returns:
The new Properties object.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
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 AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.

getSystem

public AS400 getSystem()
Returns the system.
Returns:
The system.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.
Parameters:
listener - The listener.

setProperties

public void setProperties(java.util.Properties properties)
                   throws AS400SecurityException,
                          ConnectionDroppedException,
                          ErrorCompletingRequestException,
                          java.lang.InterruptedException,
                          java.io.IOException,
                          ObjectDoesNotExistException
Sets the value of each environment variable defined in a Properties object.
Parameters:
properties - The Properties object.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
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 AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.

setProperties

public void setProperties(java.util.Properties properties,
                          int type)
                   throws AS400SecurityException,
                          ConnectionDroppedException,
                          ErrorCompletingRequestException,
                          java.lang.InterruptedException,
                          java.io.IOException,
                          ObjectDoesNotExistException
Sets the value of each environment variable defined in a Properties object.
Parameters:
properties - The Properties object.
type - The environment variable bidi string type, as defined by the CDRA (Character Data Representataion Architecture). See BidiStringType for more information and valid values.
Throws:
AS400Exception - If the AS/400 system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
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 AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.

setSystem

public void setSystem(AS400 system)
Sets the system. This cannot be changed if the object has established a connection to the AS/400.
Parameters:
system - The system.