|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.access.EnvironmentVariable
The EnvironmentVariable class represents an AS/400 system-level environment variable. An AS/400 environment variable is uniquely identified by the AS/400 system and the environment variable name. Environment variable names are case sensitive and cannot contain spaces or equals signs (=).
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.
Every environment variable has a CCSID associated with it which describes the CCSID in which its contents are stored. The default CCSID is that of the current job.
Note that environment variables are different than system values, although they are often used for the same purpose. See SystemValue for more information on how to access system values.
The environment variable value and CCSID are cached after being read once. Call refreshValue() to force the value and CCSID to be refreshed.
The following example creates two EnvironmentVariables and sets and gets their values.
AS400 system = new AS400("mysystem"); EnvironmentVariable fg = new EnvironmentVariable(system, "FOREGROUND"); fg.setValue("RED");
EnvironmentVariable bg = new EnvironmentVariable(system, "BACKGROUND"); String background = bg.getValue();
EnvironmentVariableList
, Serialized FormConstructor Summary | |
EnvironmentVariable()
Constructs an EnvironmentVariable object. |
|
EnvironmentVariable(AS400 system)
Constructs an EnvironmentVariable object. |
|
EnvironmentVariable(AS400 system,
java.lang.String name)
Constructs an EnvironmentVariable object. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. |
void |
delete()
Deletes the environment variable. |
int |
getCCSID()
Returns the environment variable CCSID. |
java.lang.String |
getName()
Returns the environment variable name. |
java.lang.String |
getName(int type)
Returns the environment variable name. |
AS400 |
getSystem()
Returns the system. |
java.lang.String |
getValue()
Returns the value of the environment variable. |
java.lang.String |
getValue(int type)
Returns the value of the environment variable. |
void |
refreshValue()
Refreshes the environment variable value and CCSID. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener. |
void |
setName(java.lang.String name)
Sets the environment variable name. |
void |
setName(java.lang.String name,
int type)
Sets the environment variable name. |
void |
setSystem(AS400 system)
Sets the system. |
void |
setValue(java.lang.String value)
Sets the value of the environment variable. |
void |
setValue(java.lang.String value,
int ccsid)
Sets the value of the environment variable. |
void |
setValue(java.lang.String value,
int ccsid,
int type)
Sets the value of the environment variable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EnvironmentVariable()
public EnvironmentVariable(AS400 system)
system
- The system.public EnvironmentVariable(AS400 system, java.lang.String name)
system
- The system.name
- The environment variable name.Method Detail |
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void delete() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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.public int getCCSID() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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.public java.lang.String getName()
public java.lang.String getName(int type)
type
- The environment variable bidi string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.public AS400 getSystem()
public java.lang.String getValue() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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.public java.lang.String getValue(int type) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
type
- The environment variable bidi string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.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.public void refreshValue() throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void setName(java.lang.String name)
Environment variable names are case sensitive and cannot contain spaces or equals signs (=).
name
- The environment variable name.public void setName(java.lang.String name, int type)
Environment variable names are case sensitive and cannot contain spaces or equals signs (=).
name
- The environment variable name.type
- The environment variable bidi string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.public void setSystem(AS400 system)
system
- The system.public void setValue(java.lang.String value) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
value
- The value.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.public void setValue(java.lang.String value, int ccsid) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
value
- The value.ccsid
- The CCSID. Possible values are:
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.public void setValue(java.lang.String value, int ccsid, int type) throws AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
value
- The value.ccsid
- The CCSID. Possible values are:
type
- The environment variable bidi string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |