public class JobLog
extends java.lang.Object
implements java.io.Serializable
QueuedMessage objects have many attributes. Only some of these attribute values are set, depending on how a QueuedMessage object is created. The following is a list of attributes whose values can be set on QueuedMessage objects returned in a list of job log messages:
QueuedMessage
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
ALERT_OPTION |
static int |
CCSID_CONVERSION_STATUS_DATA |
static int |
CCSID_CONVERSION_STATUS_TEXT |
static int |
CCSID_FOR_DATA |
static int |
CCSID_FOR_TEXT |
static int |
DEFAULT_REPLY |
static int |
MESSAGE |
static int |
MESSAGE_FILE_LIBRARY_USED |
static int |
MESSAGE_HELP |
static int |
MESSAGE_HELP_WITH_FORMATTING_CHARACTERS |
static int |
MESSAGE_HELP_WITH_REPLACEMENT_DATA |
static int |
MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS |
static int |
MESSAGE_WITH_REPLACEMENT_DATA |
static int |
RECEIVING_MODULE_NAME |
static int |
RECEIVING_PROCEDURE_NAME |
static int |
RECEIVING_PROGRAM_NAME |
static int |
RECEIVING_STATEMENT_NUMBERS |
static int |
RECEIVING_TYPE |
static int |
REPLACEMENT_DATA |
static int |
REPLY_STATUS |
static int |
REQUEST_LEVEL |
static int |
REQUEST_STATUS |
static int |
SENDER_TYPE |
static int |
SENDING_MODULE_NAME |
static int |
SENDING_PROCEDURE_NAME |
static int |
SENDING_PROGRAM_NAME |
static int |
SENDING_STATEMENT_NUMBERS |
static int |
SENDING_USER_PROFILE |
Constructor and Description |
---|
JobLog()
Constructs a JobLog object.
|
JobLog(AS400 system)
Constructs a JobLog object.
|
JobLog(AS400 system,
java.lang.String name,
java.lang.String user,
java.lang.String number)
Constructs a JobLog object.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttributeToRetrieve(int attribute)
Adds a message attribute that will be retrieved for each joblog.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.
|
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a VetoableChangeListener.
|
void |
clearAttributesToRetrieve()
Clears the message attributes to be retrieved for a given Joblog.
|
void |
close()
Closes the message list on the system.
|
protected void |
finalize()
Closes the list on the system when this object is garbage collected.
|
int |
getLength()
Returns the number of messages in the job log.
|
boolean |
getListDirection()
Returns the list direction.
|
java.util.Enumeration |
getMessages()
Returns the list of messages in the job log.
|
QueuedMessage[] |
getMessages(int listOffset,
int number)
Returns a subset of the list of messages in the job log.
|
java.lang.String |
getName()
Returns the job name.
|
java.lang.String |
getNumber()
Returns the job number.
|
byte[] |
getStartingMessageKey()
Returns the starting message key.
|
AS400 |
getSystem()
Returns the system object representing the system on which the job log exists.
|
java.lang.String |
getUser()
Returns the job user name.
|
void |
load()
Loads the list of messages on the system.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the PropertyChangeListener.
|
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the VetoableChangeListener.
|
void |
setListDirection(boolean listDirection)
Sets the list direction.
|
void |
setName(java.lang.String name)
Sets the job name.
|
void |
setNumber(java.lang.String number)
Sets the job number.
|
void |
setStartingMessageKey(byte[] startingMessageKey)
Sets the message key used to begin searching for messages to list from the corresponding entry in the job log.
|
void |
setSystem(AS400 system)
Sets the system.
|
void |
setUser(java.lang.String user)
Sets the job user name.
|
static void |
writeMessage(AS400 system,
java.lang.String messageID,
int messageType)
Writes a program message to the job log for the job in which the program is running.
|
static void |
writeMessage(AS400 system,
java.lang.String messageID,
int messageType,
byte[] substitutionData)
Writes a program message to the job log for the job in which the program is running.
|
static void |
writeMessage(AS400 system,
java.lang.String messageID,
int messageType,
java.lang.String messageFile)
Writes a program message to the job log for the job in which the program is running.
|
static void |
writeMessage(AS400 system,
java.lang.String messageID,
int messageType,
java.lang.String messageFile,
byte[] substitutionData)
Writes a program message to the job log for the job in which the program is running.
|
static void |
writeMessage(AS400 system,
java.lang.String messageID,
int messageType,
java.lang.String messageFile,
byte[] substitutionData,
boolean onThread)
Writes a program message to the job log for the job in which the program is running.
|
public static final int ALERT_OPTION
public static final int REPLACEMENT_DATA
public static final int MESSAGE
public static final int MESSAGE_WITH_REPLACEMENT_DATA
public static final int MESSAGE_HELP
public static final int MESSAGE_HELP_WITH_REPLACEMENT_DATA
public static final int MESSAGE_HELP_WITH_FORMATTING_CHARACTERS
public static final int MESSAGE_HELP_WITH_REPLACEMENT_DATA_AND_FORMATTING_CHARACTERS
public static final int DEFAULT_REPLY
public static final int SENDER_TYPE
public static final int SENDING_PROGRAM_NAME
public static final int SENDING_MODULE_NAME
public static final int SENDING_PROCEDURE_NAME
public static final int SENDING_STATEMENT_NUMBERS
public static final int SENDING_USER_PROFILE
public static final int RECEIVING_TYPE
public static final int RECEIVING_PROGRAM_NAME
public static final int RECEIVING_MODULE_NAME
public static final int RECEIVING_PROCEDURE_NAME
public static final int RECEIVING_STATEMENT_NUMBERS
public static final int MESSAGE_FILE_LIBRARY_USED
public static final int REPLY_STATUS
public static final int REQUEST_STATUS
public static final int REQUEST_LEVEL
public static final int CCSID_FOR_TEXT
public static final int CCSID_CONVERSION_STATUS_TEXT
public static final int CCSID_FOR_DATA
public static final int CCSID_CONVERSION_STATUS_DATA
public JobLog()
public JobLog(AS400 system)
system
- The system object representing the system on which the job log exists.public JobLog(AS400 system, java.lang.String name, java.lang.String user, java.lang.String number)
system
- The system object representing the system on which the job log exists.name
- The job name.user
- The job user name.number
- The job number.public void addAttributeToRetrieve(int attribute) throws java.io.IOException
The list of message attributes is maintained internally even when this JobList is closed and re-used.
To start over with a new set of job attributes to retrieve,
call clearAttributesToRetrieve()
. This will set all attributes to null
including the default attributes.
attribute
- The message attribute to retrieve. Possible values are all joblog attributes in the
api document for the Open List of Job Log Messages (QGYOLJBL) API.java.io.IOException
- If an error occurs while communicating with the system.public void clearAttributesToRetrieve()
addAttributeToRetrieve(int)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener.removeVetoableChangeListener(java.beans.VetoableChangeListener)
public void close() 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 int getLength()
load()
.load()
public boolean getListDirection()
public java.util.Enumeration getMessages() 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 QueuedMessage[] getMessages(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
load()
is made (either implicitly or explicitly), then the messages at a given list offset will change, so a subsequent call to getMessages() with the same listOffset and number will most likely not return the same QueuedMessages as the previous call.listOffset
- The offset in the list of messages (0-based). This value must be greater than or equal to 0 and less than the list length; or specify -1 to retrieve all of the messages.
Note: Prior to JTOpen 7.2, this parameter was incorrectly described.number
- The number of messages to retrieve out of the list, starting at the specified listOffset. This value must be greater than or equal to 0 and less than or equal to the list length. If the listOffset is -1, this parameter is ignored.QueuedMessage
objects. The length of this array may not necessarily be equal to number, depending upon the size of the list on the system, and the specified listOffset.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.QueuedMessage
public java.lang.String getName()
setName(java.lang.String)
public java.lang.String getNumber()
setNumber(java.lang.String)
public byte[] getStartingMessageKey()
setStartingMessageKey(byte[])
public AS400 getSystem()
setSystem(com.ibm.as400.access.AS400)
public java.lang.String getUser()
setUser(java.lang.String)
public void load() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
getMessages()
will retrieve the actual message information and attributes for each message in the list from the system.
This method updates the list length.
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.getLength()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener object.public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener object.public void setListDirection(boolean listDirection)
listDirection
- true to sort the messages oldest to newest; false to sort them newest to oldest. The default is true.public void setName(java.lang.String name) throws java.beans.PropertyVetoException
name
- The job name.java.beans.PropertyVetoException
- If any of the registered listeners vetos the property change.public void setNumber(java.lang.String number) throws java.beans.PropertyVetoException
number
- The job number.java.beans.PropertyVetoException
- If any of the registered listeners vetos the property change.public void setStartingMessageKey(byte[] startingMessageKey)
MessageQueue.OLDEST
and MessageQueue#NEWEST
.startingMessageKey
- The key. Specify null to set it back to the default, which will be OLDEST or NEWEST based on the list direction.public void setSystem(AS400 system) throws java.beans.PropertyVetoException
system
- The system object representing the system on which the job log exists.java.beans.PropertyVetoException
- If any of the registered listeners vetos the property change.public void setUser(java.lang.String user) throws java.beans.PropertyVetoException
user
- The job user name.java.beans.PropertyVetoException
- If any of the registered listeners vetos the property change.public static void writeMessage(AS400 system, java.lang.String messageID, int messageType) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
system
- The system object representing the system on which the job log exists. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.messageID
- The message ID. The message must be in the default message file /QSYS.LIB/QCPFMSG.MSGF.messageType
- The message type. Possible values are:
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.ProgramCall.isStayOnThread()
public static void writeMessage(AS400 system, java.lang.String messageID, int messageType, byte[] substitutionData) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
system
- The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.messageID
- The message ID. The message must be in the default message file /QSYS.LIB/QCPFMSG.MSGF.messageType
- The message type. Possible values are:
substitutionData
- The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message.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.ProgramCall.isStayOnThread()
public static void writeMessage(AS400 system, java.lang.String messageID, int messageType, java.lang.String messageFile) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
system
- The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.messageID
- The message ID.messageType
- The message type. Possible values are:
messageFile
- The integrated file system path name of the message file.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.ProgramCall.isStayOnThread()
public static void writeMessage(AS400 system, java.lang.String messageID, int messageType, java.lang.String messageFile, byte[] substitutionData) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
system
- The system. If the system specifies localhost, the message is written to the job log of the process from which this method is called. Otherwise the message is written to the QZRCSRVS job.messageID
- The message ID.messageType
- The message type. Possible values are:
messageFile
- The integrated file system path name of the message file.substitutionData
- The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message.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.ProgramCall.isStayOnThread()
public static void writeMessage(AS400 system, java.lang.String messageID, int messageType, java.lang.String messageFile, byte[] substitutionData, boolean onThread) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
system
- The system. The system cannot be null.messageID
- The message ID. The message ID cannot be null.messageType
- The message type. Possible values are:
messageFile
- The integrated file system path name of the message file. If null is specified, the message file used is /QSYS.LIB/QCPFMSG.MSGF.substitutionData
- The substitution data. The substitution data can be from 0-32767 bytes for a conventional message and from 1-6000 bytes for an immediate message. If null is specified, no substitution data is used.onThread
- Whether or not to stay on thread when calling the API to write the message to the job log. true to write the message to the current job's job log, false to write the message to the Remote Command Host Server job's job log. Note that this parameter is meaningless unless this Java program is running on the system and the system object is using native optimizations.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.ProgramCall.isStayOnThread()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable