com.ibm.as400.access

Class JobList

  • java.lang.Object
    • com.ibm.as400.access.JobList
  • All Implemented Interfaces:
    java.io.Serializable


    public class JobList
    extends java.lang.Object
    implements java.io.Serializable
    Represents a list of jobs on the system. By default, all jobs are selected. To filter the list, use the addJobSelectionCriteria() method.
    See Also:
    Job, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String ALL
      Deprecated. 
      Use the selection constant that corresponds to the particular job selection criteria you are filtering. For example, to select jobs for all job names, do: JobList list = new JobList(system); list.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, JobList.SELECTION_JOB_NAME_ALL); For backwards compatibility, this has the same effect: JobList list = new JobList(system); list.setName(JobList.SELECTION_JOB_NAME_ALL);
      static int SELECTION_ACTIVE_JOB_STATUS
      Selection type used for job selection based on active job status.
      static int SELECTION_INITIAL_USER
      Selection type used for job selection based on the user name for a job's initial thread.
      static int SELECTION_JOB_NAME
      Selection type used for job selection based on job name.
      static java.lang.String SELECTION_JOB_NAME_ALL
      Selection value indicating all jobs will be selected regardless of the job name.
      static java.lang.String SELECTION_JOB_NAME_CURRENT
      Selection value indicating all jobs with the current job's name will be selected.
      static java.lang.String SELECTION_JOB_NAME_ONLY
      Selection value indicating only the job in which this program is running will be selected.
      static int SELECTION_JOB_NUMBER
      Selection type used for job selection based on job number.
      static java.lang.String SELECTION_JOB_NUMBER_ALL
      Selection value indicating all jobs with the specified job name and user name will be selected, regardless of the job number.
      static int SELECTION_JOB_QUEUE
      Selection type used for job selection based on job queue.
      static int SELECTION_JOB_QUEUE_STATUS_HELD
      Selection type used for job selection based on a job's status on the job queue.
      static int SELECTION_JOB_QUEUE_STATUS_READY
      Selection type used for job selection based on a job's status on the job queue.
      static int SELECTION_JOB_QUEUE_STATUS_SCHEDULE
      Selection type used for job selection based on a job's status on the job queue.
      static int SELECTION_JOB_TYPE
      Selection type used for job selection based on job type.
      static java.lang.String SELECTION_JOB_TYPE_ALL
      Selection value indicating all job types will be selected.
      static int SELECTION_JOB_TYPE_ENHANCED
      Selection type used for job selection based on the enhanced job type.
      static java.lang.Integer SELECTION_JOB_TYPE_ENHANCED_ALL_BATCH
      Selection value indicating all the batch job types will be selected.
      static java.lang.Integer SELECTION_JOB_TYPE_ENHANCED_ALL_INTERACTIVE
      Selection value indicating all the interactive job types will be selected.
      static java.lang.Integer SELECTION_JOB_TYPE_ENHANCED_ALL_PRESTART
      Selection value indicating all the prestart job types will be selected.
      static int SELECTION_PRIMARY_JOB_STATUS_ACTIVE
      Selection type used for job selection based on primary job status.
      static int SELECTION_PRIMARY_JOB_STATUS_JOBQ
      Selection type used for job selection based on primary job status.
      static int SELECTION_PRIMARY_JOB_STATUS_OUTQ
      Selection type used for job selection based on primary job status.
      static int SELECTION_SERVER_TYPE
      Selection type used for job selection based on the server type.
      static java.lang.String SELECTION_SERVER_TYPE_ALL
      Selection value indicating all jobs with a server type will be selected.
      static java.lang.String SELECTION_SERVER_TYPE_BLANK
      Selection value indicating all jobs without a server type will be selected.
      static int SELECTION_USER_NAME
      Selection type used for job selection based on user name.
      static java.lang.String SELECTION_USER_NAME_ALL
      Selection value indicating all jobs that use the specified job name will be selected, regardless of the user name.
      static java.lang.String SELECTION_USER_NAME_CURRENT
      Selection value indicating all jobs that use the current job's user profile will be selected.
    • Constructor Summary

      Constructors 
      Constructor and Description
      JobList()
      Constructs a JobList object.
      JobList(AS400 system)
      Constructs a JobList object.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addJobAttributeToRetrieve(int attribute)
      Adds a job attribute that will be retrieved for each job in this job list.
      void addJobAttributeToSortOn(int attribute, boolean sortOrder)
      Adds a job attribute used to sort the list.
      void addJobSelectionCriteria(int selectionType, java.lang.Object selectionValue)
      Adds a selection type and value to be used to filter the list of jobs.
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Adds a PropertyChangeListener.
      void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Adds a VetoableChangeListener.
      void clearJobAttributesToRetrieve()
      Clears the job attributes to be retrieved.
      void clearJobAttributesToSortOn()
      Clears the job attributes used to sort the list.
      void clearJobSelectionCriteria()
      Clears the selection types and values used to filter the list of jobs.
      void close()
      Closes the job list on the system.
      protected void finalize()
      Closes the list on the system when this object is garbage collected.
      java.util.Enumeration getJobs()
      Returns an Enumeration that wraps the list of jobs on the system.
      Job[] getJobs(int listOffset, int number)
      Returns a subset of the list of jobs in the job list.
      int getLength()
      Returns the number of jobs in the list.
      java.lang.String getName()
      Returns the job name that describes which jobs are returned.
      java.lang.String getNumber()
      Returns the job number that describes which jobs are returned.
      AS400 getSystem()
      Returns the system object representing the system on which the jobs exist.
      java.lang.String getUser()
      Returns the user name that describes which jobs are returned.
      void load()
      Loads the list of jobs on the system.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Removes the PropertyChangeListener.
      void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Removes the VetoableChangeListener.
      void setName(java.lang.String name)
      Sets the job name that describes which jobs are returned.
      void setNumber(java.lang.String number)
      Sets the job number that describes which jobs are returned.
      void setSystem(AS400 system)
      Sets the system object representing the system on which the jobs exist.
      void setUser(java.lang.String user)
      Sets the user name value that describes which jobs are returned.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JobList

        public JobList(AS400 system)
        Constructs a JobList object.
        Parameters:
        system - The system object representing the system on which the jobs exist.
    • Method Detail

      • addJobAttributeToRetrieve

        public void addJobAttributeToRetrieve(int attribute)
        Adds a job attribute that will be retrieved for each job in this job list. This method allows the Job objects that are retrieved from this JobList to have some of their attributes already filled in, so that a call to Job.getValue() does not result in another API call back to the system for each job in the list.

        The list of job 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 clearJobAttributesToRetrieve().

        Parameters:
        attribute - The job attribute to retrieve. Possible values are all job attributes contained in the Job class, excluding the following:
        • Job.CLIENT_IP_ADDRESS
        • Job.CURRENT_LIBRARY
        • Job.CURRENT_LIBRARY_EXISTENCE
        • Job.ELAPSED_CPU_PERCENT_USED
        • Job.ELAPSED_CPU_PERCENT_USED_FOR_DATABASE
        • Job.ELAPSED_CPU_TIME_USED
        • Job.ELAPSED_CPU_TIME_USED_FOR_DATABASE
        • Job.ELAPSED_DISK_IO
        • Job.ELAPSED_DISK_IO_ASYNCH
        • Job.ELAPSED_DISK_IO_SYNCH
        • Job.ELAPSED_INTERACTIVE_RESPONSE_TIME
        • Job.ELAPSED_INTERACTIVE_TRANSACTIONS
        • Job.ELAPSED_LOCK_WAIT_TIME
        • Job.ELAPSED_PAGE_FAULTS
        • Job.ELAPSED_TIME
        • Job.PRODUCT_LIBRARIES
        • Job.SUBMITTED_BY_JOB_NUMBER
        • Job.SUBMITTED_BY_USER
        • Job.SYSTEM_LIBRARY_LIST
        • Job.USER_LIBRARY_LIST
        To retrieve any of the ELAPSED statistics, use the Job.resetStatistics() and Job.loadStatistics() methods.
        See Also:
        clearJobAttributesToRetrieve(), Job
      • addJobAttributeToSortOn

        public void addJobAttributeToSortOn(int attribute,
                                   boolean sortOrder)
        Adds a job attribute used to sort the list.

        The list of job attributes to sort on is maintained internally even when this JobList is closed and re-used. To start over with a new set of job attributes to sort on, call clearJobAttributesToSortOn().

        Parameters:
        attribute - The job attribute on which to sort. Possible values are all job attributes contained in the Job class, excluding the following:
        • Job.CLIENT_IP_ADDRESS
        • Job.CURRENT_LIBRARY
        • Job.CURRENT_LIBRARY_EXISTENCE
        • Job.ELAPSED_CPU_PERCENT_USED
        • Job.ELAPSED_CPU_PERCENT_USED_FOR_DATABASE
        • Job.ELAPSED_CPU_TIME_USED
        • Job.ELAPSED_CPU_TIME_USED_FOR_DATABASE
        • Job.ELAPSED_DISK_IO
        • Job.ELAPSED_DISK_IO_ASYNCH
        • Job.ELAPSED_DISK_IO_SYNCH
        • Job.ELAPSED_INTERACTIVE_RESPONSE_TIME
        • Job.ELAPSED_INTERACTIVE_TRANSACTIONS
        • Job.ELAPSED_LOCK_WAIT_TIME
        • Job.ELAPSED_PAGE_FAULTS
        • Job.ELAPSED_TIME
        • Job.PRODUCT_LIBRARIES
        • Job.SUBMITTED_BY_JOB_NUMBER
        • Job.SUBMITTED_BY_USER
        • Job.SYSTEM_LIBRARY_LIST
        • Job.USER_LIBRARY_LIST
        sortOrder - true to sort ascending; false to sort descending.
        See Also:
        clearJobAttributesToSortOn(), Job
      • clearJobAttributesToRetrieve

        public void clearJobAttributesToRetrieve()
        Clears the job attributes to be retrieved. This removes all of the job attributes that would be retrieved. Some attributes are always retrieved, regardless if they are in this list or not, such as job name, job number, and user name.
        See Also:
        addJobAttributeToRetrieve(int)
      • clearJobAttributesToSortOn

        public void clearJobAttributesToSortOn()
        Clears the job attributes used to sort the list. This resets all of the job sort parameters to their default values.
        See Also:
        addJobAttributeToSortOn(int, boolean)
      • clearJobSelectionCriteria

        public void clearJobSelectionCriteria()
                                       throws java.beans.PropertyVetoException
        Clears the selection types and values used to filter the list of jobs. This resets all of the job selection parameters to their default values.
        Throws:
        java.beans.PropertyVetoException - If the recipient wishes the property change to be rolled back.
        See Also:
        addJobSelectionCriteria(int, java.lang.Object)
      • addPropertyChangeListener

        public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
        Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange() method will be called each time the value of any bound property is changed.
        Parameters:
        listener - The listener.
        See Also:
        removePropertyChangeListener(java.beans.PropertyChangeListener)
      • addVetoableChangeListener

        public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange() method will be called each time the value of any constrained property is changed.
        Parameters:
        listener - The listener.
        See Also:
        removeVetoableChangeListener(java.beans.VetoableChangeListener)
      • finalize

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

        public java.util.Enumeration getJobs()
                                      throws AS400SecurityException,
                                             ErrorCompletingRequestException,
                                             java.lang.InterruptedException,
                                             java.io.IOException,
                                             ObjectDoesNotExistException
        Returns an Enumeration that wraps the list of jobs on the system. This method calls load() implicitly if needed. The Enumeration retrieves jobs from the system in blocks as needed when nextElement() is called. This JobList should not be closed until the program is done processing elements out of the Enumeration. That is, this method does not retrieve all of the jobs from the system up front -- it retrieves them as needed, which allows for a lower memory footprint versus more calls to the system. The block size used internally by the Enumeration is set to 1000 jobs.
        Returns:
        An Enumeration of Job 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.
        See Also:
        Job
      • getJobs

        public Job[] getJobs(int listOffset,
                    int number)
                      throws AS400Exception,
                             AS400SecurityException,
                             ErrorCompletingRequestException,
                             java.lang.InterruptedException,
                             java.io.IOException,
                             ObjectDoesNotExistException
        Returns a subset of the list of jobs in the job list. This method allows the user to retrieve the job list from the system in pieces. If a call to load() is made (either implicitly or explicitly), then the jobs at a given list offset will change, so a subsequent call to getJobs() with the same listOffset and number will most likely not return the same Jobs as the previous call.
        Parameters:
        listOffset - The offset in the list of jobs (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 jobs. Note: Prior to JTOpen 7.2, this parameter was incorrectly described.
        number - The number of jobs 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 Job 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:
        AS400Exception - If an error occurs.
        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.
        See Also:
        Job
      • getLength

        public int getLength()
        Returns the number of jobs in the list. This method implicitly calls load() if it has not already been called.
        Returns:
        The number of jobs, or 0 if no list was retrieved.
        See Also:
        load()
      • getName

        public java.lang.String getName()
        Returns the job name that describes which jobs are returned.
        Returns:
        The job name.
        See Also:
        setName(java.lang.String)
      • getNumber

        public java.lang.String getNumber()
        Returns the job number that describes which jobs are returned.
        Returns:
        The job number.
        See Also:
        setNumber(java.lang.String)
      • getSystem

        public AS400 getSystem()
        Returns the system object representing the system on which the jobs exist.
        Returns:
        The system object representing the system on which the jobs exist. If the system has not been set, null is returned.
      • getUser

        public java.lang.String getUser()
        Returns the user name that describes which jobs are returned.
        Returns:
        The user name.
        See Also:
        setUser(java.lang.String)
      • load

        public void load()
                  throws AS400SecurityException,
                         ErrorCompletingRequestException,
                         java.lang.InterruptedException,
                         java.io.IOException,
                         ObjectDoesNotExistException
        Loads the list of jobs on the system. This method informs the system to build a list of jobs given the previously added job attributes to select, retrieve, and sort. This method blocks until the system returns the total number of jobs it has compiled. A subsequent call to getJobs() will retrieve the actual job information and attributes for each job 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.
        See Also:
        getLength()
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The listener object.
      • removeVetoableChangeListener

        public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The listener object.
      • setName

        public void setName(java.lang.String name)
                     throws java.beans.PropertyVetoException
        Sets the job name that describes which jobs are returned. The default is SELECTION_JOB_NAME_ALL. This takes effect the next time the list of jobs is retrieved or refreshed.
        Parameters:
        name - The job name, or SELECTION_JOB_NAME_ALL for all job names.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
        See Also:
        addJobSelectionCriteria(int, java.lang.Object), getName()
      • setNumber

        public void setNumber(java.lang.String number)
                       throws java.beans.PropertyVetoException
        Sets the job number that describes which jobs are returned. The default is SELECTION_JOB_NUMBER_ALL. This takes effect the next time the list of jobs is retrieved or refreshed.
        Parameters:
        number - The job number, or SELECTION_JOB_NUMBER_ALL for all job numbers.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
        See Also:
        addJobSelectionCriteria(int, java.lang.Object), getNumber()
      • setSystem

        public void setSystem(AS400 system)
                       throws java.beans.PropertyVetoException
        Sets the system object representing the system on which the jobs exist. The system cannot be changed once a connection to the system has been established.
        Parameters:
        system - The system object representing the system on which the jobs exists.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
      • setUser

        public void setUser(java.lang.String user)
                     throws java.beans.PropertyVetoException
        Sets the user name value that describes which jobs are returned. The default is SELECTION_USER_NAME_ALL. This takes effect the next time the list of jobs is retrieved or refreshed.
        Parameters:
        user - The user name, or SELECTION_USER_NAME_ALL for all user names.
        Throws:
        java.beans.PropertyVetoException - If any of the registered listeners vetos the property change.
        See Also:
        addJobSelectionCriteria(int, java.lang.Object), getUser()