ARLO Adapt
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | List of all members
arlo.NesterJob Class Reference
Inheritance diagram for arlo.NesterJob:
Inheritance graph
[legend]
Collaboration diagram for arlo.NesterJob:
Collaboration graph
[legend]

Public Member Functions

 NesterJob ()
 Default Constructor. More...
 
 NesterJob (NesterJob j)
 Copy Constructor. More...
 
boolean getNesterJob (int id, Connection connection)
 Get a Job from the database. More...
 
String GetJobParameter (String name)
 Lookup a JobParameter from the Job. More...
 
Vector< String > GetJobParameterVector (String name)
 Lookup a JobParameter from the Job. More...
 
boolean AddJobParameter (String name, String value)
 Add a JobParameter to a Job object in memory. More...
 
boolean SaveJob (Connection connection)
 Save a NesterJob object to the database. More...
 
void PrintJobParameters ()
 
boolean SaveJobLogMessage (String message)
 Save a log entry for a Job. More...
 
boolean SaveJobLogMessage (String message, Connection connection)
 
boolean UploadJobResultFile (String fileName, byte[] resultFileBytes, String notes, Connection connection)
 Upload a Job Result File back to the webserver. More...
 

Static Public Member Functions

static Integer GetJobStatusIdFromName (String statusName, Connection connection)
 Given a Job Status Name, lookup the database Id. More...
 
static Integer GetJobTypeIdFromName (String typeName, Connection connection)
 Given a Job Type Name, lookup the database Id. More...
 
static boolean SaveJobLogMessage (int jobId, String message)
 Save a log entry for a Job. More...
 
static boolean SaveJobLogMessage (int jobId, String message, Connection connection)
 

Public Attributes

int id
 
String name
 
int user_id
 
int project_id
 
Timestamp creationDate
 
int numToComplete
 
int numCompleted
 
double fractionCompleted
 
double elapsedRealTime
 
double timeToCompletion
 
boolean isRunning
 
boolean wasStopped
 
boolean isComplete
 
boolean wasDeleted
 
int type_id
 
Integer status_id
 
Integer requestedStatus_id
 
Integer parentJob_id
 
Integer priority
 
HashMap< String, Vector< String > > jobParameters
 

Private Member Functions

boolean SaveJobParameters (Connection connection)
 Save all of the Job's Parameters to the database. More...
 
boolean DeleteJobParametersFromDatabase (Connection connection)
 Delete all JobParamters for a Job from the database. More...
 
String getRandomString (int length)
 

Static Private Member Functions

static HashMap< String, Vector< String > > GetJobParameters (int jobId, Connection connection)
 Read in a Job's the JobParameters from the database. More...
 

Constructor & Destructor Documentation

arlo.NesterJob.NesterJob ( )

Default Constructor.

arlo.NesterJob.NesterJob ( NesterJob  j)

Copy Constructor.

Member Function Documentation

boolean arlo.NesterJob.AddJobParameter ( String  name,
String  value 
)

Add a JobParameter to a Job object in memory.

Note
Does not automatically save to the database.
Enforces the current database limit of 255 characters for name or value.
Parameters
nameName of the Parameter to add.
valueValue of the Parameter to add.
Returns
true if success, false otherwise.
boolean arlo.NesterJob.DeleteJobParametersFromDatabase ( Connection  connection)
private

Delete all JobParamters for a Job from the database.

In anticipation of writing out the updated paramters.

Parameters
connectionOpened database Connection.
Returns
True on success, False if any errors
String arlo.NesterJob.GetJobParameter ( String  name)

Lookup a JobParameter from the Job.

This expects a single value entry for the paramteter in the database.

Note
This routine will fail, returning a null, if multiple entries exist for the parameter.
Parameters
nameName of the Parameter to retrieve.
Returns
null if not found, String value otherwise
static HashMap<String, Vector<String> > arlo.NesterJob.GetJobParameters ( int  jobId,
Connection  connection 
)
staticprivate

Read in a Job's the JobParameters from the database.

Parameters
jobIdDatabase Id of the Job for which to grab parameters.
connectionOpened database Connection.
Returns
null if error, otherwise HashMap<String key, Vector<String> values>.
Vector<String> arlo.NesterJob.GetJobParameterVector ( String  name)

Lookup a JobParameter from the Job.

Returns a list of all values for the Parameter.

Note
This routine will return an empty Vector if no values exist, or are not found.
Parameters
nameName of the Parameter to retrieve.
Returns
Vector of Strings, empty if not found
static Integer arlo.NesterJob.GetJobStatusIdFromName ( String  statusName,
Connection  connection 
)
static

Given a Job Status Name, lookup the database Id.

Parameters
statusNameThe status name to lookup.
connectionAn opened database Connection
Returns
null if error / not found, the database ID otherwise
static Integer arlo.NesterJob.GetJobTypeIdFromName ( String  typeName,
Connection  connection 
)
static

Given a Job Type Name, lookup the database Id.

Parameters
typeNameThe type name to lookup.
connectionAn opened database Connection
Returns
null if error / not found, the database ID otherwise
boolean arlo.NesterJob.getNesterJob ( int  id,
Connection  connection 
)

Get a Job from the database.

Initializes 'this' with the Job.

Parameters
idDatabase Id of the Job for which to grab.
connectionOpened database Connection.
Returns
true if success, false if errors.
String arlo.NesterJob.getRandomString ( int  length)
private
void arlo.NesterJob.PrintJobParameters ( )
boolean arlo.NesterJob.SaveJob ( Connection  connection)

Save a NesterJob object to the database.

Note
If this.id == -1, this will create a new job, and set this objects id accordingly. Otherwise, this will overwrite an existing job's id.
Currently this does nothing with JobParameters
Parameters
connectionAn opened database Connection
Returns
true if success, false if any errors
boolean arlo.NesterJob.SaveJobLogMessage ( String  message)

Save a log entry for a Job.

Note
If this.id == -1, return false
Parameters
messageThe Message to save for the log entry.
Returns
true if success, false if any errors
static boolean arlo.NesterJob.SaveJobLogMessage ( int  jobId,
String  message 
)
static

Save a log entry for a Job.

Note
If jobId == -1, return false
Parameters
jobIdDatabase ID of the Job to which we are adding the log entry.
messageThe Message to save for the log entry.
Returns
true if success, false if any errors
boolean arlo.NesterJob.SaveJobLogMessage ( String  message,
Connection  connection 
)
static boolean arlo.NesterJob.SaveJobLogMessage ( int  jobId,
String  message,
Connection  connection 
)
static
boolean arlo.NesterJob.SaveJobParameters ( Connection  connection)
private

Save all of the Job's Parameters to the database.

Only adds parameters that don't already exist, in the case that we're updating an existing job.

Parameters
connectionOpened database Connection.
Returns
True on success, False if any errors
boolean arlo.NesterJob.UploadJobResultFile ( String  fileName,
byte[]  resultFileBytes,
String  notes,
Connection  connection 
)

Upload a Job Result File back to the webserver.

Note
If this.id == -1, return false
Error handling is rather weak here, so calling functions should not expect this to reliably complete.
Parameters
fileNameName of the file to upload.
resultFileBytesA array of bytes that we are uploading as the file.
notesNotes to store with the file.
connectionAn opened database Connection
Returns
true if success, false if any errors

Member Data Documentation

Timestamp arlo.NesterJob.creationDate
double arlo.NesterJob.elapsedRealTime
double arlo.NesterJob.fractionCompleted
int arlo.NesterJob.id
boolean arlo.NesterJob.isComplete
boolean arlo.NesterJob.isRunning
HashMap<String, Vector<String> > arlo.NesterJob.jobParameters
String arlo.NesterJob.name
int arlo.NesterJob.numCompleted
int arlo.NesterJob.numToComplete
Integer arlo.NesterJob.parentJob_id
Integer arlo.NesterJob.priority
int arlo.NesterJob.project_id
Integer arlo.NesterJob.requestedStatus_id
Integer arlo.NesterJob.status_id
double arlo.NesterJob.timeToCompletion
int arlo.NesterJob.type_id
int arlo.NesterJob.user_id
boolean arlo.NesterJob.wasDeleted
boolean arlo.NesterJob.wasStopped

The documentation for this class was generated from the following file: