Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.subsystems.qsys.jobs
Class JobTicketManager

java.lang.Object
  extended by java.util.Observable
      extended by com.ibm.etools.iseries.subsystems.qsys.jobs.JobTicketManager

public class JobTicketManager
extends Observable

A JobTicketManager is responsible for managing the set of JobTickets found in the workbench. It updates them with new status when requested by either a user or a timer. It will cause them to be persisted and deleted when necessary.

There is a single instance of this manager in the workbench which is created during workbench initialization. This instance can be retrieved using JobTicketManager.getDefault().

A JobTicketManager implements the Observable interface and can tell observers when a change in its state occurs. This may be useful in designing a user interface that updates when the JobTickets being managed by this JobTicketManager are updated.


Field Summary
static String Copyright
           
static Integer CURRENT_TICKET
          Argument used when notifying observers of a change to the current JobTicket (this is actually a way for us to notify the table view to select a JobTicket that was just added.
static Integer INTERVAL
          Argument used when notifying observers of a change in the interval.
static int NEVER
          The value used to set the timer to never automatically refresh.
static String PREF_BuildMonitorRefreshInterval
          The name of the preference that stores the refresh interval.
static Integer TICKETS
          Argument used when notifying observers of a change in the tickets.
 
Method Summary
 boolean add(JobTicket ticket)
          Adds a new JobTicket to those being managed.
 void commitInterval()
          Commits the manager to begin refreshing at the set interval.
 JobTicket getCurrentTicket()
          Get the current JobTicket, this is the last JobTicket added to the JobTicketManager
static JobTicketManager getDefault()
          Returns the singletime JobTicketManager for this workbench.
 int getInterval()
          Returns the interval value known by this manager.
 JobTicket[] getTickets()
          Returns all the tickets known by this manager.
static void initDefaults(IPreferenceStore store)
          Initializes the default preferences for all JobTicketManagers.
 void refresh()
          Refreshes all the unfinished tickets being managed by this job manager.
 void remove(JobTicket ticket)
          Removes a JobTicket from those being managed.
 void removeAll()
          Removes all JobTickets from this manager.
 void resetTimer()
          Schedules the refresh task so that it will be automatically run.
 void setInterval(int interval)
          Sets the interval value for this manager.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

TICKETS

public static final Integer TICKETS
Argument used when notifying observers of a change in the tickets.


INTERVAL

public static final Integer INTERVAL
Argument used when notifying observers of a change in the interval.


CURRENT_TICKET

public static final Integer CURRENT_TICKET
Argument used when notifying observers of a change to the current JobTicket (this is actually a way for us to notify the table view to select a JobTicket that was just added.


PREF_BuildMonitorRefreshInterval

public static final String PREF_BuildMonitorRefreshInterval
The name of the preference that stores the refresh interval.

See Also:
Constant Field Values

NEVER

public static final int NEVER
The value used to set the timer to never automatically refresh.

See Also:
Constant Field Values
Method Detail

getDefault

public static JobTicketManager getDefault()
Returns the singletime JobTicketManager for this workbench.


initDefaults

public static void initDefaults(IPreferenceStore store)
Initializes the default preferences for all JobTicketManagers. Used at workbench startup to retrieve the refresh interval. Note: the current value of the refresh interval is always set to NEVER in this method to avoid connecting to the host system on every startup.

Invoked during plugin initialization. Not meant to be called by clients.


resetTimer

public void resetTimer()
Schedules the refresh task so that it will be automatically run. If the interval is NEVER then the task is not scheduled.

Called by the user interface when a refresh has been performed.


add

public boolean add(JobTicket ticket)
Adds a new JobTicket to those being managed. This is the primary client interface. The client will create a job ticket after a job is submitted and add it to the manager as follows:

JobTicket ticket = new JobTicket(project, timeStamp, jobName, jobUser, jobNumber, JobTicket.Queued, connectionName, systemName, tag); JobTicketManager.getDefault().add(ticket);

Returns:
true if the ticket was added, false if it was not added (typically because it is a duplicate)

remove

public void remove(JobTicket ticket)
Removes a JobTicket from those being managed. If the ticket is not managed by this manager it does nothing.

This is typically invoked by the user interface when a ticket is selected and removed by a user.


removeAll

public void removeAll()
Removes all JobTickets from this manager.

This is typically invoked by the user interface when a ticket is selected and removed by a user.


refresh

public void refresh()
Refreshes all the unfinished tickets being managed by this job manager. If a tickets connection is not connected then it is skipped. If there are no observers then the refresh is skipped. This may be automatically invoked by the timer or may be manually invoked. If it is manually invoked it will cancel and reschedule the current timer task for a new interval.

Usually run by the user interface as the result of a user requested "refresh" action.

Clients are not expected to invoke this as it is invoked by the user interface or a timer.


getTickets

public JobTicket[] getTickets()
Returns all the tickets known by this manager. These are returned in no particular order.

Used by the user interface to present the remembered jobs to the user.


getInterval

public int getInterval()
Returns the interval value known by this manager. This is the number of seconds between refreshes. It is NEVER if the manager never refreshes.

The value is expressed in seconds.


setInterval

public void setInterval(int interval)
Sets the interval value for this manager. This is the number of seconds between refreshes. It is NEVER if the manager never refreshes.

Setting the interval notifies all observers the the interval setting has been changed. However, the interval must be committed to affect the refresh rate of this manager.

The value is expressed in seconds.


commitInterval

public void commitInterval()
Commits the manager to begin refreshing at the set interval. This is done so that the interval may be adjusted several times prior to being committed.


getCurrentTicket

public JobTicket getCurrentTicket()
Get the current JobTicket, this is the last JobTicket added to the JobTicketManager

Returns:
The current JobTicket, or null if there are no JobTickets or the current JobTicket was removed.

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.