com.ibm.as400.access
Class HistoryLog

java.lang.Object
  extended by com.ibm.as400.access.HistoryLog

public class HistoryLog
extends Object

Represents a history log on the system. This class is used to get a list of messages in a history log. The close() 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 theses 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:

See Also:
QueuedMessage

Field Summary
Modifier and Type Field and Description
static String AVAIL
          Constant indicating that any logged data that is available for the specified dates should be listed.
static String BEGIN
          Constant indicating to list data logged from the beginning of the log.
static String CURRENT_DATE
          Constant indicating the current date.
static 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 String TYPE_COMPLETION
          Message type for completion messages.
static String TYPE_COPY
          Message type for copy messages.
static String TYPE_DIAGNOSTIC
          Message type for diagnostic messages.
static String TYPE_ESCAPE
          Message type for escape messages.
static String TYPE_INFORMATIONAL
          Message type for informational messages.
static String TYPE_INQUIRY
          Message type for inquiry messages.
static String TYPE_NOTIFY
          Message type for notify messages.
static String TYPE_REPLY
          Message type for reply messages.
static String TYPE_REQUEST
          Message type for request messages.
 
Constructor Summary
Constructor and Description
HistoryLog(AS400 system)
          Constructs a HistoryLog object for the specified system.
 
Method Summary
Modifier and Type Method and Description
 void close()
          Closes the message list on the system.
 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.
 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.
 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.
 String[] getMessageTypes()
          Returns the message types to be selected or omitted from the list.
 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(Date date)
          Specifies the end date and time for messages and jobs to be listed.
 void setEndingDate(String date, 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(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(String[] types)
          Specifies the specific message types to be retrieved or omitted.
 void setStartingDate(Date date)
          Specifies the starting date and time for messages and jobs to be listed.
 void setStartingDate(String date, String time)
          Specifies the starting date and time for messages and jobs to be listed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_DATE

public static final String CURRENT_DATE
Constant indicating the current date. The value of this constant is "*CURRENT".

See Also:
Constant Field Values

BEGIN

public static final 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 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 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 String TYPE_COMPLETION
Message type for completion messages.

See Also:
Constant Field Values

TYPE_COPY

public static final String TYPE_COPY
Message type for copy messages.

See Also:
Constant Field Values

TYPE_DIAGNOSTIC

public static final String TYPE_DIAGNOSTIC
Message type for diagnostic messages.

See Also:
Constant Field Values

TYPE_ESCAPE

public static final String TYPE_ESCAPE
Message type for escape messages.

See Also:
Constant Field Values

TYPE_INFORMATIONAL

public static final String TYPE_INFORMATIONAL
Message type for informational messages.

See Also:
Constant Field Values

TYPE_INQUIRY

public static final 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 String TYPE_NOTIFY
Message type for notify messages.

See Also:
Constant Field Values

TYPE_REPLY

public static final String TYPE_REPLY
Message type for reply messages.

See Also:
Constant Field Values

TYPE_REQUEST

public static final 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,
                  InterruptedException,
                  IOException,
                  ObjectDoesNotExistException
Closes the message list on the system. This releases any system resources previously in use by this message list.

Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
InterruptedException - If this thread is interrupted.
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,
                     InterruptedException,
                     IOException,
                     ObjectDoesNotExistException
Returns the number of messages in the history log. This method implicitly calls load().

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.
InterruptedException - If this thread is interrupted.
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 Enumeration getMessages()
                        throws AS400SecurityException,
                               ErrorCompletingRequestException,
                               InterruptedException,
                               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.
InterruptedException - If this thread is interrupted.
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,
                                   InterruptedException,
                                   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 to load() is made (either implicitly or explicitly), then the messages at a given 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 offset into the list of messages. This value must be greater than 0 and less than the list length, or specify -1 to retrieve all of the messages.
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.
InterruptedException - If this thread is interrupted.
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,
                 InterruptedException,
                 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 to getMessages() 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.
InterruptedException - If this thread is interrupted.
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(String date,
                            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(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 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(String date,
                          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(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 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(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 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

getMessageIDsListIndicator

public int getMessageIDsListIndicator()
Returns the list indicator indicating if the message ids in the list are omitted or selected.

Returns:
The list indicator. Possible values are:

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

getMessageTypeListIndicator

public int getMessageTypeListIndicator()
Returns the list indicator indicating if the message types in the list should be omitted or selected.

Returns:
The list indicator. Possibe values are:

setMessageTypes

public void setMessageTypes(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

getMessageTypes

public 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

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.