g-Eclipse
Release 1.0.0

eu.geclipse.servicejob.model.submittable.job
Class AbstractSubmittableServiceJob

java.lang.Object
  extended by PlatformObject
      extended by eu.geclipse.core.model.impl.AbstractGridElement
          extended by eu.geclipse.servicejob.model.AbstractServiceJob
              extended by eu.geclipse.servicejob.model.submittable.job.AbstractSubmittableServiceJob
All Implemented Interfaces:
IGridElement, IManageable, IServiceJob

public abstract class AbstractSubmittableServiceJob
extends AbstractServiceJob

Abstract class implementing basic IServiceJob methods for job based service jobs. The implementation follows this specified workflow:

If the service job varies from the above workflow, some of the methods should be overwritten.


Field Summary
static java.lang.String SERVICE_JOB_INFO_FILENAME
          File name for storing info of the service job.
static java.lang.String SERVICE_JOB_STATUS_FILENAME
          Extension of the file storing info of the service job results for the specified nodes
static java.lang.String XML_CHARSET
          XML charset
 
Constructor Summary
AbstractSubmittableServiceJob()
           
 
Method Summary
abstract  void computeJobResult(IGridJobID jobID, IGridJobStatus jobStatus)
          This method is invoked by service job updater when one of the running jobs is finished.
abstract  void computeServiceJobResult()
          This method is invoked by service job updater after last job of this service job is finished and its result was computed by computeJobResult(IGridJobID, IGridJobStatus).
abstract  IGridJobID createJobID(SubmittableServiceJobResult serviceJobResult)
          Implementations of this method should create and return proper, middleware-specific job id.
 void createNewResult(IGridJobID jobID, java.lang.String resourceName, java.util.Date submissionDate)
          Create new result for this service job.
 int getColumnWidth(java.lang.String singleServiceJobName)
          This method sets column width for single service job with a name specified as parameter.
abstract  IGridJobDescription getJSDLForSubmission(java.lang.String resourceName)
          Gets the JSDL which will be submitted to resource with name.
abstract  java.lang.String getRawDataInput(IGridJobID jobID, java.lang.String resourceName)
          This method should return starting string XML structure of raw data node of the given jobID associated with the resourceName.
abstract  java.lang.String getResultType(java.lang.String singleServiceJobName)
          This method should return type of the result data returned by single service job.
 IVirtualOrganization getSelectedJobsVO()
          Getter of the project's VO for this service job.
 ServiceJobUpdater getUpdater()
          Getter of this service job updater.
 void init()
           
abstract  void initData()
          Perform additional, service job specific tasks at the start of the service job.
 boolean isLocal()
          Determines if this element is local.
 boolean needsSubmissionWizard()
          This method is to obtain information whether service job implementation needs to display job submission wizard to the user when it is being run.
 void run()
          Method to run a service job
 void setJobResult(IGridJobID jobID, java.util.Date lastRefreshDate, java.lang.String status, java.lang.String besStatus)
          Sets result of the running grid job with jobID, storing the result in the status file of this job.
 
Methods inherited from class eu.geclipse.servicejob.model.AbstractServiceJob
addServiceJobResult, getFileStore, getLastUpdate, getLastUpdate, getManager, getName, getParent, getPath, getProperties, getResource, getResults, getServiceJobFolder, getServiceJobResourcesNames, getServiceJobResultsForResourceForDate, getSingleServiceJobResult, getStatus, getSubmissionService, getSummary, internalInit, setResource, setSubmissionService
 
Methods inherited from class eu.geclipse.core.model.impl.AbstractGridElement
dispose, getAdapter, getProject, isHidden, isVirtual
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.geclipse.core.model.IServiceJob
getInputStreamForResult, getServiceJobDescription, getSingleServiceJobNames
 

Field Detail

SERVICE_JOB_INFO_FILENAME

public static final java.lang.String SERVICE_JOB_INFO_FILENAME
File name for storing info of the service job.

See Also:
Constant Field Values

XML_CHARSET

public static final java.lang.String XML_CHARSET
XML charset

See Also:
Constant Field Values

SERVICE_JOB_STATUS_FILENAME

public static final java.lang.String SERVICE_JOB_STATUS_FILENAME
Extension of the file storing info of the service job results for the specified nodes

See Also:
Constant Field Values
Constructor Detail

AbstractSubmittableServiceJob

public AbstractSubmittableServiceJob()
Method Detail

isLocal

public boolean isLocal()
Description copied from interface: IGridElement
Determines if this element is local. A local element has to be any related item (not necessarily an IResource) that is local in the means that it is located on the local machine.

Returns:
True if this element is local.

init

public void init()

createJobID

public abstract IGridJobID createJobID(SubmittableServiceJobResult serviceJobResult)
Implementations of this method should create and return proper, middleware-specific job id. This usually will require some additional informations (e.g. job ID). Clients should use ServiceJobResult.getResultRawData() and parse needed information.

Parameters:
serviceJobResult - Job result for which job ID should be created.
Returns:
IGridJobID representing the service job. If no middleware specific id can be returned this should return generic GridJobID class.

initData

public abstract void initData()
Perform additional, service job specific tasks at the start of the service job. If needed, inputString representing input part of XML may be parsed for additional informations about the service job.


getUpdater

public ServiceJobUpdater getUpdater()
Getter of this service job updater.

Returns:
Service job updater for this service job.

run

public void run()
Description copied from interface: IServiceJob
Method to run a service job


getJSDLForSubmission

public abstract IGridJobDescription getJSDLForSubmission(java.lang.String resourceName)
Gets the JSDL which will be submitted to resource with name.

Parameters:
resourceName -
Returns:
JSDLJobDescription if the JSDL is ready for submission or null if it is not

setJobResult

public void setJobResult(IGridJobID jobID,
                         java.util.Date lastRefreshDate,
                         java.lang.String status,
                         java.lang.String besStatus)
Sets result of the running grid job with jobID, storing the result in the status file of this job. If result for the job with jobID exists the result is overwritten by the parser (the newly fetched status of the job is written). If there is no job result for the given jobID yet stored, then new XML node is added to the status XML for that jobID.

Developers can overwrite this method if the storage of the status results is resolved differently.

Parameters:
jobID - id of the running job
lastRefreshDate - date of the last refresh of job status
status - fetched job status
besStatus - BES status of the job

createNewResult

public void createNewResult(IGridJobID jobID,
                            java.lang.String resourceName,
                            java.util.Date submissionDate)
Create new result for this service job.

Parameters:
jobID - ID of the job for which service job's result should be created.
resourceName - Name of the resource on which service job should run.
submissionDate - Date of the job submission.

getResultType

public abstract java.lang.String getResultType(java.lang.String singleServiceJobName)
This method should return type of the result data returned by single service job.

Parameters:
singleServiceJobName - Name of the single service job (sub-job).
Returns:
String representing type of the result data (extension).

getRawDataInput

public abstract java.lang.String getRawDataInput(IGridJobID jobID,
                                                 java.lang.String resourceName)
This method should return starting string XML structure of raw data node of the given jobID associated with the resourceName.

Parameters:
jobID - ID of the job for which the node should be created
resourceName - Name of the resource.
Returns:
String representing starting XML of raw data for the service job result.

computeJobResult

public abstract void computeJobResult(IGridJobID jobID,
                                      IGridJobStatus jobStatus)
This method is invoked by service job updater when one of the running jobs is finished. Implementation should compute result of the service job or sub-job(s) accordingly to the outcome of job with jobID.

Parameters:
jobID - ID of job which finished running
jobStatus - status of the finished job

computeServiceJobResult

public abstract void computeServiceJobResult()
This method is invoked by service job updater after last job of this service job is finished and its result was computed by computeJobResult(IGridJobID, IGridJobStatus).


getSelectedJobsVO

public IVirtualOrganization getSelectedJobsVO()
Getter of the project's VO for this service job.

Returns:
This serviceJob's VO or null if cannot fetch VO.

getColumnWidth

public int getColumnWidth(java.lang.String singleServiceJobName)
Description copied from interface: IServiceJob
This method sets column width for single service job with a name specified as parameter.

Specified by:
getColumnWidth in interface IServiceJob
Overrides:
getColumnWidth in class AbstractServiceJob
Parameters:
singleServiceJobName - Name of the single service job.
Returns:
Width of the column.

needsSubmissionWizard

public boolean needsSubmissionWizard()
Description copied from interface: IServiceJob
This method is to obtain information whether service job implementation needs to display job submission wizard to the user when it is being run. Job submission wizard gives access to information which job submission service to use (see IServiceJob.getSubmissionService() method).

Specified by:
needsSubmissionWizard in interface IServiceJob
Overrides:
needsSubmissionWizard in class AbstractServiceJob
Returns:
true if this service job needs information to which submission service submit its jobs, false otherwise

g-Eclipse
Release 1.0.0