g-Eclipse
Release 1.0.0

eu.geclipse.core.jobs
Class GridJob

java.lang.Object
  extended by PlatformObject
      extended by eu.geclipse.core.model.impl.AbstractGridElement
          extended by eu.geclipse.core.model.impl.AbstractGridContainer
              extended by eu.geclipse.core.model.impl.ResourceGridContainer
                  extended by eu.geclipse.core.jobs.GridJob
All Implemented Interfaces:
IGridContainer, IGridElement, IGridJob, IManageable

public class GridJob
extends ResourceGridContainer
implements IGridJob

Class representing submitted job.


Field Summary
static java.lang.String FOLDERNAME_INPUT_FILES
          Name for folder containing input files for job
static java.lang.String FOLDERNAME_OUTPUT_FILES
          Name for folder containing output files for job
 
Constructor Summary
GridJob(IFolder jobFolder)
           
 
Method Summary
 void cancel()
          Cancel this job if it is already running.
 boolean canContain(IGridElement element)
          Determines if this may contain the specified element.
static boolean canCreate(IFolder folder)
          Check if a job can be created from this folder.
 void create(IFolder jobFolder, IGridJobID id, IGridJobService jobSrvce, IGridJobDescription description, java.lang.String uniqueJobName)
           
static GridJob createJobStructure(IFolder jobFolder, GridJobID id, IGridJobService jobService, IGridJobDescription description, java.lang.String uniqueJobName)
          Creates files and folders for job
 void deleteJob(IProgressMonitor monitor)
          Deletes the job from the grid.
 java.lang.String getHostName()
           
 IGridJobID getID()
          Gets the unique id of this job.
 java.util.List<java.net.URI> getInputStagers()
          Scan folder "Input Files" in submitted job and return list of input files
 IGridJobDescription getJobDescription()
          Gets the job description used to create the job.
static java.lang.String getJobIdClass(IFolder jobFolder)
          Using job folder, get info about class implemented IGridJobID (it helps to recognize GridJob middleware)
 java.lang.String getJobName()
          Gets the job name.
 IGridJobService getJobService()
           
 IGridJobStatus getJobStatus()
          Gets the current status of this job, without contacting the services.
 IGridElementManager getManager()
          Get the manager that is responsible for the element.
 java.util.List<java.net.URI> getOutputStagers()
          Scan folder "Output Files" in submitted job and return list of output files
 java.util.Date getSubmissionTime()
          Gets the date and time of submission.
 java.net.URI getURI()
           
 boolean isHidden()
          Determines if this element is hidden.
 boolean isLazy()
          Determines if this container is using a lazy loading mechanism to manage its children.
 boolean isLocal()
          Determines if this element is local.
 boolean isVirtual()
          Determines if this element is virtual.
 IGridJobStatus updateJobStatus(IProgressMonitor progressMonitor, boolean fullStatus)
          Updates the job status.
 
Methods inherited from class eu.geclipse.core.model.impl.ResourceGridContainer
getFileStore, getName, getParent, getPath, getResource
 
Methods inherited from class eu.geclipse.core.model.impl.AbstractGridContainer
contains, create, delete, deleteAll, dispose, findChild, findChildWithResource, getChildCount, getChildren, hasChildren, isDirty, refresh, setDirty
 
Methods inherited from class eu.geclipse.core.model.impl.AbstractGridElement
getAdapter, getProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.geclipse.core.model.IGridContainer
contains, create, delete, deleteAll, findChild, findChildWithResource, getChildCount, getChildren, hasChildren, isDirty, refresh, setDirty
 
Methods inherited from interface eu.geclipse.core.model.IGridElement
dispose, getFileStore, getName, getParent, getPath, getProject, getResource
 
Methods inherited from interface eu.geclipse.core.model.IGridElement
dispose, getFileStore, getName, getParent, getPath, getProject, getResource
 

Field Detail

FOLDERNAME_INPUT_FILES

public static final java.lang.String FOLDERNAME_INPUT_FILES
Name for folder containing input files for job


FOLDERNAME_OUTPUT_FILES

public static final java.lang.String FOLDERNAME_OUTPUT_FILES
Name for folder containing output files for job

Constructor Detail

GridJob

public GridJob(IFolder jobFolder)
Parameters:
jobFolder -
Method Detail

canCreate

public static boolean canCreate(IFolder folder)
Check if a job can be created from this folder. Currently it checks only if directory contains job info file.

Parameters:
folder -
Returns:
true if job can be created

createJobStructure

public static GridJob createJobStructure(IFolder jobFolder,
                                         GridJobID id,
                                         IGridJobService jobService,
                                         IGridJobDescription description,
                                         java.lang.String uniqueJobName)
                                  throws ProblemException
Creates files and folders for job

Parameters:
jobFolder - folder, in which structure for job will be created
id - job id
jobService -
description - job description
uniqueJobName -
Returns:
created job
Throws:
ProblemException

getJobIdClass

public static java.lang.String getJobIdClass(IFolder jobFolder)
Using job folder, get info about class implemented IGridJobID (it helps to recognize GridJob middleware)

Parameters:
jobFolder -
Returns:
class implementing IGridJobID, or null if this information cannot be got

cancel

public void cancel()
Description copied from interface: IGridJob
Cancel this job if it is already running.

Specified by:
cancel in interface IGridJob

canContain

public boolean canContain(IGridElement element)
Description copied from interface: IGridContainer
Determines if this may contain the specified element. This method works type specific, i.e. a container may or may not contain elements of a specified type.

Specified by:
canContain in interface IGridContainer
Overrides:
canContain in class AbstractGridContainer
Parameters:
element - The element that may be contained in this container.
Returns:
If this container may contain the specified element.

create

public void create(IFolder jobFolder,
                   IGridJobID id,
                   IGridJobService jobSrvce,
                   IGridJobDescription description,
                   java.lang.String uniqueJobName)
            throws ProblemException
Parameters:
jobFolder -
id -
jobSrvce -
description -
uniqueJobName -
Throws:
ProblemException

deleteJob

public void deleteJob(IProgressMonitor monitor)
               throws ProblemException
Description copied from interface: IGridJob
Deletes the job from the grid.

Specified by:
deleteJob in interface IGridJob
Parameters:
monitor - Use to monitor the progress. May be null.
Throws:
ProblemException - if an error occurs while deleting the job.

getHostName

public java.lang.String getHostName()
Returns:
hostname

getID

public IGridJobID getID()
Description copied from interface: IGridJob
Gets the unique id of this job. This id may be used to query for job information.

Specified by:
getID in interface IGridJob
Returns:
The unique id of this job.

getInputStagers

public java.util.List<java.net.URI> getInputStagers()
                                             throws ProblemException
Description copied from interface: IGridJob
Scan folder "Input Files" in submitted job and return list of input files

Specified by:
getInputStagers in interface IGridJob
Returns:
list of URI points to input files used by job
Throws:
ProblemException

getJobDescription

public IGridJobDescription getJobDescription()
Description copied from interface: IGridJob
Gets the job description used to create the job.

Specified by:
getJobDescription in interface IGridJob
Returns:
The job description used to create this job.

getJobName

public java.lang.String getJobName()
Description copied from interface: IGridJob
Gets the job name.

Specified by:
getJobName in interface IGridJob
Returns:
The name of this job without additional decorations, file extensions, etc.

getJobService

public IGridJobService getJobService()
Returns:
job service or null if service doesn't exists for that job.
Service may not exists if middleware doesn't support it, or if job was created in g-eclipse old version

getJobStatus

public IGridJobStatus getJobStatus()
Description copied from interface: IGridJob
Gets the current status of this job, without contacting the services.

Specified by:
getJobStatus in interface IGridJob
Returns:
This job's latest known status.

getManager

public IGridElementManager getManager()
Description copied from interface: IManageable
Get the manager that is responsible for the element.

Specified by:
getManager in interface IManageable
Returns:
This element's IGridElementManager.

getOutputStagers

public java.util.List<java.net.URI> getOutputStagers()
                                              throws ProblemException
Description copied from interface: IGridJob
Scan folder "Output Files" in submitted job and return list of output files

Specified by:
getOutputStagers in interface IGridJob
Returns:
list of URI points to output files produced by job
Throws:
ProblemException

getSubmissionTime

public java.util.Date getSubmissionTime()
Description copied from interface: IGridJob
Gets the date and time of submission.

Specified by:
getSubmissionTime in interface IGridJob
Returns:
A Date object with the submission time.

getURI

public java.net.URI getURI()
Returns:
uri

isHidden

public boolean isHidden()
Description copied from interface: IGridElement
Determines if this element is hidden. Hidden elements are not shown in the Grid model views.

Specified by:
isHidden in interface IGridElement
Overrides:
isHidden in class AbstractGridElement
Returns:
True if this is a hidden element, false otherwise.

isLazy

public boolean isLazy()
Description copied from interface: IGridContainer
Determines if this container is using a lazy loading mechanism to manage its children. In that case the children are not loaded when the container is constructed but when the IGridContainer.getChildren(IProgressMonitor monitor) methode is called the first time. On subsequent calls of IGridContainer.getChildren(IProgressMonitor monitor) the formerly loaded children are returned unless the IGridContainer.setDirty() method was called. In that case a call to IGridContainer.getChildren(IProgressMonitor monitor) will cause a reload of this containers children. Lazy containers always have to return true if they are asked if they contain any children with IGridContainer.hasChildren().

Specified by:
isLazy in interface IGridContainer
Overrides:
isLazy in class ResourceGridContainer
Returns:
True if this container uses lazy loading.

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.

Specified by:
isLocal in interface IGridElement
Overrides:
isLocal in class ResourceGridContainer
Returns:
True if this element is local.

isVirtual

public boolean isVirtual()
Description copied from interface: IGridElement
Determines if this element is virtual. Virtual elements have no corresponding resources. If this method returns false the IGridElement.getResource() method returns null. If this method returns true the IGridElement.getResource() has to return a valid IResource that is related to this element.

Specified by:
isVirtual in interface IGridElement
Overrides:
isVirtual in class AbstractGridElement
Returns:
True if this element is virtual, i.e. has no corresponding resource.

updateJobStatus

public IGridJobStatus updateJobStatus(IProgressMonitor progressMonitor,
                                      boolean fullStatus)
Description copied from interface: IGridJob
Updates the job status. The implementation of this method should ask the middleware for the up-to-date job status.

Specified by:
updateJobStatus in interface IGridJob
Parameters:
progressMonitor - Use to monitor the progress. May be null.
fullStatus - true if all available information about job should be downloaded, false if only basic info about status should be downloaded (only those available from IGridJobStatus)
Returns:
This job's current status.

g-Eclipse
Release 1.0.0