com.ibm.as400.access

Class 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 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 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

      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.
      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.
    • 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_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
    • 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

      • 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 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.
        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.
      • 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.
      • 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.
      • 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.
      • 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:
      • 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:
      • 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.
      • finalize

        protected void finalize()
                         throws Throwable
        Closes the list on the system when this object is garbage collected.
        Overrides:
        finalize in class Object
        Throws:
        Throwable