jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.db
Class DBJobManager

java.lang.Object
  extended by cedar.jetweb.db.DBJobManager

public abstract class DBJobManager
extends java.lang.Object

DataBase operations for job package.

Version:
$Date: 2005-11-23 21:44:23 +0000 (Wed, 23 Nov 2005) $ $Revision: 979 $
Author:
S.Butterworth

Field Summary
static java.lang.String SUCCESS
          constant to signify successful completion of a DB Fit operation.
 
Constructor Summary
DBJobManager()
           
 
Method Summary
static void addLogfile(LogFile log)
          Adds new logfile record to the database
static void checkStatus(LogFile log)
          Checks whether this logfile is already in the DB, setting the status field on the logfile object accordingly.
static int countCompletedJobs(java.lang.String hostname)
          Counts completed jobs in table "logfile" with given value of field "host".
static int countJobs(java.lang.String hostname)
          Counts jobs in table "logfile" with given value of field "host".
static void removeLogFile(java.lang.String name)
          Remove this logfile row from the table.
static PendingJob reserveJobName(java.lang.String suggestion)
          Gives a new unique jobname by prepending the logfile number to the suggested stem.
static void selectFromDB(LogFile log)
          Populate the given LogFile from the DB.
static void selectFromDB(PendingJob job)
          Select a PendingJob from the DB.
static void selectFromDBbyName(LogFile log)
          Fills runseriesId, status and logId of the input logfile.
static java.util.Enumeration<PendingJob> selectPendingJobs()
          Retrieves a list of all pending jobs from the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final java.lang.String SUCCESS
constant to signify successful completion of a DB Fit operation.

See Also:
Constant Field Values

Constructor Detail

DBJobManager

public DBJobManager()
Method Detail

addLogfile

public static void addLogfile(LogFile log)
                       throws JetWebException
Adds new logfile record to the database

Parameters:
log - to be inserted to the database
Throws:
JetWebException


selectFromDBbyName

public static void selectFromDBbyName(LogFile log)
                               throws JetWebException
Fills runseriesId, status and logId of the input logfile. The only data which needs to be filled in the LogFile before this is the File itself.

Parameters:
log - object to be filled
Throws:
JetWebException


selectFromDB

public static void selectFromDB(PendingJob job)
                         throws JetWebException
Select a PendingJob from the DB.

Parameters:
job - to be selected and populated.
Throws:
JetWebException


selectPendingJobs

public static java.util.Enumeration<PendingJob> selectPendingJobs()
                                                           throws JetWebException
Retrieves a list of all pending jobs from the database

Returns:
list of PendingJobs
Throws:
JetWebException


reserveJobName

public static PendingJob reserveJobName(java.lang.String suggestion)
                                 throws JetWebException
Gives a new unique jobname by prepending the logfile number to the suggested stem. Also reserves the place in the logfile table.

Parameters:
suggestion - stem for the jobname
Returns:
PendingJob object with the new jobname.
Throws:
JetWebException


checkStatus

public static void checkStatus(LogFile log)
                        throws JetWebException
Checks whether this logfile is already in the DB, setting the status field on the logfile object accordingly.

Parameters:
log -
Throws:
JetWebException


removeLogFile

public static void removeLogFile(java.lang.String name)
Remove this logfile row from the table.


countJobs

public static int countJobs(java.lang.String hostname)
                     throws JetWebException
Counts jobs in table "logfile" with given value of field "host".

Parameters:
hostname -
Returns:
Number of jobs submitted to specified host.
Throws:
JetWebException


countCompletedJobs

public static int countCompletedJobs(java.lang.String hostname)
                              throws JetWebException
Counts completed jobs in table "logfile" with given value of field "host".

Parameters:
hostname -
Returns:
Number of jobs completed by specified host.
Throws:
JetWebException


selectFromDB

public static void selectFromDB(LogFile log)
                         throws JetWebException
Populate the given LogFile from the DB. This method assumes the logId is already set.

Parameters:
int - The unique ID of the logfile.
Throws:
JetWebException