org.peace_tools.workspace
Class JobBase

java.lang.Object
  extended by org.peace_tools.workspace.JobBase
Direct Known Subclasses:
Job, JobSummary

public abstract class JobBase
extends java.lang.Object

This is a common base class that contains fields that are common to both the JobSummary class and the Job class. This class does not have a corresponding element in the XML representation.


Nested Class Summary
static class JobBase.JobStatusType
          Different enumerations defining the last known runtime status of a given Job.
 
Field Summary
protected  java.lang.String jobID
          The unique generated jobID value for this job.
protected  javax.xml.datatype.Duration runtime
          The actual CPU time that the job took to run on the server.
protected  java.lang.String serverID
          A cross reference to the server on which this Job has been scheduled.
protected  JobBase.JobStatusType status
          The current runtime status of this job.
 
Constructor Summary
JobBase(JobBase jobData)
          A copy constructor to create/initialize a common Job base object using data from an existing job or job summary object.
JobBase(java.lang.String jobID, java.lang.String serverID)
          Constructor to create a common job object with the fixed value fields initialized to specific values.
 
Method Summary
 java.lang.String getJobID()
          Obtain the work space wide unique identifier set for this job.
 long getRunTime()
          Obtain the wall clock run time for this job.
 java.lang.String getServerID()
          Obtain the work space wide unique identifier set for the server on which this job is scheduled to run (or was run).
 JobBase.JobStatusType getStatus()
          Obtain the current status set for this job.
 boolean isDone()
          Convenience method to determine if job has completed.
 void setRunTime(long milliseconds)
          This method can be used to explicitly set the actual wall clock time that this job used on the server.
 void setStatus(JobBase.JobStatusType status)
          Change the status for this job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobID

protected final java.lang.String jobID
The unique generated jobID value for this job. This value is typically created when a new job is scheduled. This value is persisted in the work space configuration.


serverID

protected final java.lang.String serverID
A cross reference to the server on which this Job has been scheduled. This value is used to look up job status information and obtain the actual resulting data files for this job.


status

protected JobBase.JobStatusType status
The current runtime status of this job. This value is periodically updated until the job completes running (successfully or with erros).


runtime

protected javax.xml.datatype.Duration runtime
The actual CPU time that the job took to run on the server. This value is set only after the job completes. Until the job completes this value is null.

Constructor Detail

JobBase

public JobBase(java.lang.String jobID,
               java.lang.String serverID)
Constructor to create a common job object with the fixed value fields initialized to specific values.

Parameters:
jobID - The work space-wide unique, generated job ID for this job. The jobID is generated via a call to JobList.reserveJobID() method. This is a valid string (typically in the form job####)
serverID - The ID of the server on which this job is running. This is a cross reference ID of a Server configured in this work space.

JobBase

public JobBase(JobBase jobData)
A copy constructor to create/initialize a common Job base object using data from an existing job or job summary object.

Parameters:
jobData - The source job base object from where the data for this object is to be copied.
Method Detail

getJobID

public java.lang.String getJobID()
Obtain the work space wide unique identifier set for this job. The jobID value is created when new jobs are scheduled. These IDs are persisted in the work space configuration file and loaded when a work space is opened in the GUI.

Returns:
This method returns the unique identifier set for this job.

getServerID

public java.lang.String getServerID()
Obtain the work space wide unique identifier set for the server on which this job is scheduled to run (or was run). The serverID value is set when new jobs are scheduled. This ID is persisted in the work space configuration file and loaded when a work space is opened in the GUI.

Returns:
This method returns the unique server identifier set for this job.

setStatus

public void setStatus(JobBase.JobStatusType status)
Change the status for this job.

Parameters:
status - The new status value to be set for this job.

getStatus

public JobBase.JobStatusType getStatus()
Obtain the current status set for this job. The job status value is the last known status value for this job.

Returns:
The current status for this job.

setRunTime

public void setRunTime(long milliseconds)
This method can be used to explicitly set the actual wall clock time that this job used on the server.

Parameters:
milliseconds - The actual wall clock time that this job used on the server.

getRunTime

public long getRunTime()
Obtain the wall clock run time for this job. This value is meaningful only after the job has completed running. Until the job has completed running (and its status is updated) the runtime is returned to be -1.

Returns:
The wall clock time (in milliseconds) taken by this job to run on the server.

isDone

public boolean isDone()
Convenience method to determine if job has completed. This method returns true only if the status of the job is either SUCCESS or FAILED. In all other states this method returns true.

Returns:
Returns true to indicate if the job has completed (successfully or otherwise).