com.ibm.as400.access
Class HistoryLog
- java.lang.Object
-
- com.ibm.as400.access.HistoryLog
-
public class HistoryLog extends java.lang.Object
Represents a history log on the system. This class is used to get a list of messages in a history log. Theclose()
method should be called when you are finished retrieving messages from the list.Note: The System API this class uses is NOT available when connecting to V5R4 or earlier systems.
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 are set on QueuedMessage objects returned in a list of history log messages:
- date sent
- message file name
- message file library
- message ID
- message severity
- message text
- message type
- sending job name
- sending job number
- sending job user name
- sending current user
- See Also:
QueuedMessage
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
AVAIL
Constant indicating that any logged data that is available for the specified dates should be listed.static java.lang.String
BEGIN
Constant indicating to list data logged from the beginning of the log.static java.lang.String
CURRENT_DATE
Constant indicating the current date.static java.lang.String
END
Constant indicating the last day on which data was logged is the last day for which logged data is listed.static int
OMIT
Constant indicating that the message IDs in the list are to be omitted.static int
SELECT
Constant indicating that the message IDs in the list are to be selected.static java.lang.String
TYPE_COMPLETION
Message type for completion messages.static java.lang.String
TYPE_COPY
Message type for copy messages.static java.lang.String
TYPE_DIAGNOSTIC
Message type for diagnostic messages.static java.lang.String
TYPE_ESCAPE
Message type for escape messages.static java.lang.String
TYPE_INFORMATIONAL
Message type for informational messages.static java.lang.String
TYPE_INQUIRY
Message type for inquiry messages.static java.lang.String
TYPE_NOTIFY
Message type for notify messages.static java.lang.String
TYPE_REPLY
Message type for reply messages.static java.lang.String
TYPE_REQUEST
Message type for request messages.
-
Constructor Summary
Constructors Constructor and Description HistoryLog(AS400 system)
Constructs a HistoryLog object for the specified system.
-
Method Summary
Methods Modifier and Type Method and Description void
close()
Closes the message list on the system.protected void
finalize()
Closes the list on the system when this object is garbage collected.java.util.Date
getEndingDate()
Returns the ending date for messages and jobs to be listed.Job[]
getJobs()
Returns the list of jobs used to filter which messages in the log are listed.int
getLength()
Returns the number of messages in the history log.java.lang.String[]
getMessageIDs()
Returns the list of message ids used to filter which messages in the log are listed.int
getMessageIDsListIndicator()
Returns the list indicator indicating if the message ids in the list are omitted or selected.java.util.Enumeration
getMessages()
Returns the list of messages in the history log.QueuedMessage[]
getMessages(int listOffset, int number)
Returns a subset of the list of messages in the history log.int
getMessageSeverity()
Returns the minimum severity of the messages to be listed.int
getMessageTypeListIndicator()
Returns the list indicator indicating if the message types in the list should be omitted or selected.java.lang.String[]
getMessageTypes()
Returns the message types to be selected or omitted from the list.java.util.Date
getStartingDate()
Returns the starting date for messages and jobs to be listed.AS400
getSystem()
Returns the system object representing the system on which the history log exists.void
load()
Loads the list of messages on the system.void
setEndingDate(java.util.Date date)
Specifies the end date and time for messages and jobs to be listed.void
setEndingDate(java.lang.String date, java.lang.String time)
Specifies the ending date and time for messages and jobs to be listed.void
setJobs(Job[] jobs)
Specifies the specific jobs (if any) for which messages in the log are listed.void
setMessageIDs(java.lang.String[] ids)
Specifies the specific messaged IDs to be retrieved or omitted.void
setMessageIDsListIndicator(int indicator)
Specifies if the message IDs in the list are to be omitted or selected.void
setMessageSeverity(int severity)
The minimum severity of the messages to be listed.void
setMessageTypeListIndicator(int indicator)
Specifies if the message types in the list are to be omitted or selected.void
setMessageTypes(java.lang.String[] types)
Specifies the specific message types to be retrieved or omitted.void
setStartingDate(java.util.Date date)
Specifies the starting date and time for messages and jobs to be listed.void
setStartingDate(java.lang.String date, java.lang.String time)
Specifies the starting date and time for messages and jobs to be listed.
-
-
-
Field Detail
-
CURRENT_DATE
public static final java.lang.String CURRENT_DATE
Constant indicating the current date. The value of this constant is "*CURRENT".- See Also:
- Constant Field Values
-
BEGIN
public static final java.lang.String BEGIN
Constant indicating to list data logged from the beginning of the log. The value of this constant is "*BEGIN".- See Also:
- Constant Field Values
-
END
public static final java.lang.String END
Constant indicating the last day on which data was logged is the last day for which logged data is listed. The value of this constant is "*END".- See Also:
- Constant Field Values
-
AVAIL
public static final java.lang.String AVAIL
Constant indicating that any logged data that is available for the specified dates should be listed. The value of this constant is "*AVAIL".- See Also:
- Constant Field Values
-
OMIT
public static final int OMIT
Constant indicating that the message IDs in the list are to be omitted.- See Also:
- Constant Field Values
-
SELECT
public static final int SELECT
Constant indicating that the message IDs in the list are to be selected.- See Also:
- Constant Field Values
-
TYPE_COMPLETION
public static final java.lang.String TYPE_COMPLETION
Message type for completion messages.- See Also:
- Constant Field Values
-
TYPE_COPY
public static final java.lang.String TYPE_COPY
Message type for copy messages.- See Also:
- Constant Field Values
-
TYPE_DIAGNOSTIC
public static final java.lang.String TYPE_DIAGNOSTIC
Message type for diagnostic messages.- See Also:
- Constant Field Values
-
TYPE_ESCAPE
public static final java.lang.String TYPE_ESCAPE
Message type for escape messages.- See Also:
- Constant Field Values
-
TYPE_INFORMATIONAL
public static final java.lang.String TYPE_INFORMATIONAL
Message type for informational messages.- See Also:
- Constant Field Values
-
TYPE_INQUIRY
public static final java.lang.String TYPE_INQUIRY
Message type for inquiry messages. You can send inquiry messages only to the external message queue.- See Also:
- Constant Field Values
-
TYPE_NOTIFY
public static final java.lang.String TYPE_NOTIFY
Message type for notify messages.- See Also:
- Constant Field Values
-
TYPE_REPLY
public static final java.lang.String TYPE_REPLY
Message type for reply messages.- See Also:
- Constant Field Values
-
TYPE_REQUEST
public static final java.lang.String TYPE_REQUEST
Message type for request messages.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HistoryLog
public HistoryLog(AS400 system)
Constructs a HistoryLog object for the specified system.- Parameters:
system
- The system object representing the system on which the history log exists.
-
-
Method Detail
-
close
public void close() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Closes the message list on the system. This releases any system resources previously in use by this message list. This will not close the connection to the Host Server job held by the associated AS400 object.- Throws:
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 int getLength() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of messages in the history log. This method implicitly callsload()
.- Returns:
- The number of messages, or 0 if no list was retrieved.
- Throws:
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 or when running to V5R4 or an earlier release.- See Also:
load()
-
getMessages
public java.util.Enumeration getMessages() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the list of messages in the history log. The messages are listed from oldest to newest.- Returns:
- An Enumeration of QueuedMessage objects.
- Throws:
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 or when running to V5R4 or an earlier release.
-
getMessages
public QueuedMessage[] getMessages(int listOffset, int number) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns a subset of the list of messages in the history log. This method allows the user to retrieve the message list from the system in pieces. If a call toload()
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.- Parameters:
listOffset
- The starting 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.- Returns:
- The array of retrieved
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. - Throws:
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, or when running to V5R4 or an earlier release.- See Also:
QueuedMessage
-
getSystem
public AS400 getSystem()
Returns the system object representing the system on which the history log exists.- Returns:
- The system object representing the system on which the history log exists. If the system has not been set, null is returned.
-
load
public void load() throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Loads the list of messages on the system. This method informs the system to build a list of messages. This method blocks until the system returns the total number of messages it has compiled. A subsequent call togetMessages()
will retrieve the actual message information and attributes for each message in the list from the system.This method updates the list length.
- Throws:
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 or when running to V5R4 or an earlier release.- See Also:
getLength()
-
setStartingDate
public void setStartingDate(java.lang.String date, java.lang.String time) throws ExtendedIllegalArgumentException
Specifies the starting date and time for messages and jobs to be listed.- Parameters:
date
- The starting date. Valid values include:CURRENT_DATE
(default)BEGIN
- A date in the format CYYMMDD:
- C - Century, where 0 indicates years 19xx and 1 indicates years 20xx
- YY - Year
- MM - Month
- DD - Day
time
- The starting time. Valid values include:AVAIL
(default)- A time specified in the 24 hour format HHMMSS:
- HH - Hour
- MM - Minute
- SS - Second
- Throws:
ExtendedIllegalArgumentException
- if the date is not in a valid format.
-
setStartingDate
public void setStartingDate(java.util.Date date) throws ExtendedIllegalArgumentException
Specifies the starting date and time for messages and jobs to be listed.- Parameters:
date
- The starting date.- Throws:
ExtendedIllegalArgumentException
- if the date is not valid.
-
getStartingDate
public java.util.Date getStartingDate()
Returns the starting date for messages and jobs to be listed.- Returns:
- The starting date, or null if one of the following values was used to specify the starting date:
-
setEndingDate
public void setEndingDate(java.lang.String date, java.lang.String time) throws ExtendedIllegalArgumentException
Specifies the ending date and time for messages and jobs to be listed.- Parameters:
date
- The ending date. Valid values include:CURRENT_DATE
END
(default)- A date in the format CYYMMDD:
- C - Century, where 0 indicates years 19xx and 1 indicates years 20xx
- YY - Year
- MM - Month
- DD - Day
time
- The ending time. Valid values include:AVAIL
(default)- A time specified in the 24 hour format HHMMSS:
- HH - Hour
- MM - Minute
- SS - Second
- Throws:
ExtendedIllegalArgumentException
- if the date is not in a valid format.
-
setEndingDate
public void setEndingDate(java.util.Date date) throws ExtendedIllegalArgumentException
Specifies the end date and time for messages and jobs to be listed.- Parameters:
date
- The ending date.- Throws:
ExtendedIllegalArgumentException
- if the date is not valid.
-
getEndingDate
public java.util.Date getEndingDate()
Returns the ending date for messages and jobs to be listed.- Returns:
- The ending date, or null if one of the following special values were used for the date:
-
setMessageIDs
public void setMessageIDs(java.lang.String[] ids) throws ExtendedIllegalArgumentException
Specifies the specific messaged IDs to be retrieved or omitted. Each message id should be 7 characters. Up to 100 message IDs are supported. If not specified, all of the messages will be listed for the jobs and times specified. To select specific generic types of messages, specify the 3 character code that identifies the message file followed by all zeros. If the message ID is less than 7 characters, 0's will be appended to the ID.- Parameters:
ids
- The message IDs.- Throws:
ExtendedIllegalArgumentException
- if more than 100 message IDs are specified, or if a message ID is more than 7 characters.
-
getMessageIDs
public java.lang.String[] getMessageIDs()
Returns the list of message ids used to filter which messages in the log are listed.- Returns:
- The list of message ids or an empty array if no message ids were specified.
-
setMessageIDsListIndicator
public void setMessageIDsListIndicator(int indicator) throws ExtendedIllegalArgumentException
Specifies if the message IDs in the list are to be omitted or selected.- Parameters:
indicator
- The indicator. Valid values are:- Throws:
ExtendedIllegalArgumentException
- If an argument is illegal.
-
getMessageIDsListIndicator
public int getMessageIDsListIndicator()
Returns the list indicator indicating if the message ids in the list are omitted or selected.
-
setMessageTypeListIndicator
public void setMessageTypeListIndicator(int indicator) throws ExtendedIllegalArgumentException
Specifies if the message types in the list are to be omitted or selected.- Parameters:
indicator
- The indicator. Valid values are:- Throws:
ExtendedIllegalArgumentException
- If an argument is illegal.
-
getMessageTypeListIndicator
public int getMessageTypeListIndicator()
Returns the list indicator indicating if the message types in the list should be omitted or selected.
-
setMessageTypes
public void setMessageTypes(java.lang.String[] types) throws ExtendedIllegalArgumentException
Specifies the specific message types to be retrieved or omitted. Up to 10 message types are supported. If not specified, all of the messages will be listed for the jobs, message severity and times specified.- Parameters:
types
- The message types to be retrieved or omitted. Valid values are:- Throws:
ExtendedIllegalArgumentException
- If an argument is illegal.
-
getMessageTypes
public java.lang.String[] getMessageTypes()
Returns the message types to be selected or omitted from the list.- Returns:
- The message types. Valid values are:
-
setMessageSeverity
public void setMessageSeverity(int severity) throws ExtendedIllegalArgumentException
The minimum severity of the messages to be listed. Possible values are 0 through 99. Specify 0 to list all messages for the jobs, times, message types, and message IDs specified.- Parameters:
severity
- The minumum severity of the messages to be listed. The default is zero.- Throws:
ExtendedIllegalArgumentException
- If an argument is illegal.
-
getMessageSeverity
public int getMessageSeverity()
Returns the minimum severity of the messages to be listed.- Returns:
- The minumum severity. Possible values are 0 through 99. 0 indicates all messages for the jobs, times, message types, and message ids specified should be listed.
-
setJobs
public void setJobs(Job[] jobs) throws ExtendedIllegalArgumentException
Specifies the specific jobs (if any) for which messages in the log are listed. The messages for the specified jobs are retrieved only if they are logged in the period of time, message severity, and messages specified on the call. Up to 5 jobs are supported.- Parameters:
jobs
- The list of jobs.- Throws:
ExtendedIllegalArgumentException
- if the number of jobs is greater than five
-
getJobs
public Job[] getJobs()
Returns the list of jobs used to filter which messages in the log are listed.- Returns:
- The list of jobs or null if no jobs were specified.
-
finalize
protected void finalize() throws java.lang.Throwable
Closes the list on the system when this object is garbage collected.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-