g-Eclipse
Release 1.0.0

eu.geclipse.jsdl
Class JSDLJobDescription

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.jsdl.JSDLJobDescription
All Implemented Interfaces:
IGridContainer, IGridElement, IGridJobDescription

public class JSDLJobDescription
extends ResourceGridContainer
implements IGridJobDescription

Concrete implementation of an IGridJobDescription for the JSDL language.


Constructor Summary
JSDLJobDescription(IFile file)
          Create a new JSDL job description from the specified IFile.
 
Method Summary
 void addArgument(java.lang.String argName)
          Adds a Argument element as a child of POSIXApplication element.
 void addArgumentForPosixApplication(java.lang.String argName, java.util.ArrayList<java.lang.String> argValues)
          Method to add Argument element to POSIXApplication element.
 void addCandidateHosts(java.util.List<java.lang.String> hostsList)
          Method to set CandidateHost element of JSDL's Resources.
 void addDataStagingIn(java.lang.String name, java.lang.String path)
          Sets JSDL DataStaging element for staged in resources.
 void addDataStagingOut(java.lang.String name, java.lang.String path)
          Adds JSDL DataStaging element for staged out resources.
 java.lang.String getApplicationName()
          Method to access "name" attribute of the POSIXApplication element.
 java.lang.String getAsString()
           
 java.util.List<java.lang.String> getCandidateHostsNames()
          Method to access list of candidate hosts.
 java.lang.String getCpuArchitectureName()
          Method to access CPUArchitecture name.
 java.util.List<DataStagingType> getDataStagingIn()
          Returns list of those DataStagings entries that have Source element set (data stagings in)
 java.util.Map<java.lang.String,java.lang.String> getDataStagingInStrings()
          Returns list of DataStagings entries that have Source element set (data stagings in) in form of Strings map - mapping file name to its location
 java.util.List<DataStagingType> getDataStagingOut()
          Returns list of those DataStagings entries that have Target element set (data stgaings out)
 java.util.Map<java.lang.String,java.lang.String> getDataStagingOutStrings()
          Returns list of DataStagings entries that have Target element set (data stagings out) in form of Strings map - mapping file name to its location
 java.lang.String getDescription()
           
 DocumentRoot getDocumentRoot()
          Method to access root element of an EMF document represented by this object.
 java.lang.String getExecutable()
           
 java.util.List<java.lang.String> getExecutableArguments()
           
 java.lang.String getJSDLString()
          Get the content of the corresponding JSDL file.
 java.lang.String getOSTypeName()
          Method to access OperatingSystem name.
 java.lang.String getOSVersion()
          Method to access OperatingSystem version.
 java.lang.String getStdErrorFileName()
           
 java.net.URI getStdErrorUri()
           
 java.lang.String getStdInputFileName()
           
 java.net.URI getStdInputUri()
           
 java.lang.String getStdOutputFileName()
           
 java.net.URI getStdOutputUri()
           
 org.w3c.dom.Document getXml()
          Returns EMF XML document as a DOM XML Document
 boolean isParametric()
           
 void removeDataStaging()
          Method to remove all DataStagings elements from JSDL.
 void removeTargetsFromOutStaging()
           
 void save()
          Given EMF model representation of JSDL this method serialises it to File (through EMF resources)
 void setApplicationName(java.lang.String applicationName)
          Method to set "name" attribute of POSIXApplication element.
 void setJobIdentification(java.lang.String jobName, java.lang.String description)
          This method re-sets JSDL JobIdentification element (creates new empty element).
 void setPOSIXApplicationDetails(java.lang.String applicationName, java.lang.String executableFile, java.lang.String stdin, java.lang.String stdinName, java.lang.String stdout, java.lang.String outName, java.lang.String err, java.lang.String errName)
          This method is for set content of POSIXApplication element.
 void setRoot(DocumentRoot root)
          This method is to set EMF document's root element.
 void setUpBasicJSDLStructure()
          This method re-sets JSDL content.
 
Methods inherited from class eu.geclipse.core.model.impl.ResourceGridContainer
getFileStore, getName, getParent, getPath, getResource, isLazy, isLocal
 
Methods inherited from class eu.geclipse.core.model.impl.AbstractGridContainer
canContain, 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, 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.IGridContainer
canContain, contains, create, delete, deleteAll, findChild, findChildWithResource, getChildCount, getChildren, hasChildren, isDirty, isLazy, refresh, setDirty
 
Methods inherited from interface eu.geclipse.core.model.IGridElement
dispose, getFileStore, getName, getParent, getPath, getProject, getResource, isHidden, isLocal, isVirtual
 

Constructor Detail

JSDLJobDescription

public JSDLJobDescription(IFile file)
Create a new JSDL job description from the specified IFile.

Parameters:
file - The file from which to create the description.
Method Detail

getDocumentRoot

public DocumentRoot getDocumentRoot()
Method to access root element of an EMF document represented by this object.

Returns:
root element of a JSDL document

setRoot

public void setRoot(DocumentRoot root)
This method is to set EMF document's root element. If given root is empty it creates JobDefinition and JobDescription JSDL elements.

Parameters:
root - EMF document root to set as a JSDL root element

save

public void save()
Given EMF model representation of JSDL this method serialises it to File (through EMF resources)

Parameters:
jsdlRoot - EMF object representing JSDL document root. This is handler to JSDL content in terms of EMF.

getJSDLString

public java.lang.String getJSDLString()
                               throws java.io.IOException,
                                      CoreException
Get the content of the corresponding JSDL file.

Returns:
The content of the file as a String.
Throws:
java.io.IOException - If an error occurs when loading the content.
CoreException - in case content of resource associated with JSDL is not accessible

setUpBasicJSDLStructure

public void setUpBasicJSDLStructure()
This method re-sets JSDL content. It creates empty parent JSDL elements - JobDefinition, JobDescription and JobIdentification. If JSDL had those elements before calling this method - they will be overwritten with new ones (and their content - children elements - will be lost).


setJobIdentification

public void setJobIdentification(java.lang.String jobName,
                                 java.lang.String description)
This method re-sets JSDL JobIdentification element (creates new empty element). If JSDL had this element before calling this method - it will be overwritten with new one (and its content - children elements - will be lost).
Note: if no JobDescription is set this method will throw NullPointerException

Parameters:
jobName - name of the job
description - the description of the job

setPOSIXApplicationDetails

public void setPOSIXApplicationDetails(java.lang.String applicationName,
                                       java.lang.String executableFile,
                                       java.lang.String stdin,
                                       java.lang.String stdinName,
                                       java.lang.String stdout,
                                       java.lang.String outName,
                                       java.lang.String err,
                                       java.lang.String errName)
This method is for set content of POSIXApplication element. For each standard input, output and error file it creates also corresponding data stagings entries.

Parameters:
applicationName - name of the POSIXApplication (value of "name" attribute in POSIXApplication element)
executableFile - value of Executable element
stdin - standard input file's URI (used in data staging element)
stdinName - standard input file's name (used in POSIX Input element and as a file name in data staging entry)
stdout - standard output file's URI (used in data staging element)
outName - standard output file's name (used in POSIX Output element and as a file name in data staging entry)
err - standard error file's URI (used in data staging element)
errName - standard error file's name (used in POSIX Error element and as a file name in data staging entry)

addDataStagingOut

public void addDataStagingOut(java.lang.String name,
                              java.lang.String path)
Adds JSDL DataStaging element for staged out resources.

Parameters:
name - name of the resource
path - URI representing resource's location

addDataStagingIn

public void addDataStagingIn(java.lang.String name,
                             java.lang.String path)
Sets JSDL DataStaging element for staged in resources.

Parameters:
name - name of the resource
path - URI representing resource's location

getExecutable

public java.lang.String getExecutable()
Specified by:
getExecutable in interface IGridJobDescription
Returns:
name of executable file executed by job

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface IGridJobDescription
Returns:
free text user's description for job

getExecutableArguments

public java.util.List<java.lang.String> getExecutableArguments()
Specified by:
getExecutableArguments in interface IGridJobDescription
Returns:
arguments for executable file

getCpuArchitectureName

public java.lang.String getCpuArchitectureName()
Method to access CPUArchitecture name. This is String value or Resources child element.

Returns:
content of CPUArchitecture element

getOSTypeName

public java.lang.String getOSTypeName()
Method to access OperatingSystem name. This is String value or Resources child element.

Returns:
content of OperatingSystem > OperatingSystemType > OperatingSystemName element

getOSVersion

public java.lang.String getOSVersion()
Method to access OperatingSystem version. This is String value or Resources child element.

Returns:
content of OperatingSystem > OperatingSystemVersion element

addArgumentForPosixApplication

public void addArgumentForPosixApplication(java.lang.String argName,
                                           java.util.ArrayList<java.lang.String> argValues)
Method to add Argument element to POSIXApplication element. Has no effect if POSIXApplication element was not set.

Parameters:
argName - name of the argument
argValues - list of argument's values

addArgument

public void addArgument(java.lang.String argName)
Adds a Argument element as a child of POSIXApplication element. Has no effect if POSIXApplication was not set.

Parameters:
argName - name of the argument to add

getStdInputFileName

public java.lang.String getStdInputFileName()
Specified by:
getStdInputFileName in interface IGridJobDescription
Returns:
filename on computing element for standard input

getStdOutputFileName

public java.lang.String getStdOutputFileName()
Specified by:
getStdOutputFileName in interface IGridJobDescription
Returns:
filename on computing element for standard output

addCandidateHosts

public void addCandidateHosts(java.util.List<java.lang.String> hostsList)
Method to set CandidateHost element of JSDL's Resources. If no Resources element was set - it will be created. Has no effect if JobDescription element was not set.

Parameters:
hostsList - list of hosts names

getDataStagingIn

public java.util.List<DataStagingType> getDataStagingIn()
Returns list of those DataStagings entries that have Source element set (data stagings in)

Returns:
list of DataStagings object with Source element set

getDataStagingInStrings

public java.util.Map<java.lang.String,java.lang.String> getDataStagingInStrings()
Returns list of DataStagings entries that have Source element set (data stagings in) in form of Strings map - mapping file name to its location

Returns:
Map with data staging in file's name as a key and its location as a value

getDataStagingOutStrings

public java.util.Map<java.lang.String,java.lang.String> getDataStagingOutStrings()
Returns list of DataStagings entries that have Target element set (data stagings out) in form of Strings map - mapping file name to its location

Returns:
Map with data staging out file's name as a key and its location as a value

getDataStagingOut

public java.util.List<DataStagingType> getDataStagingOut()
Returns list of those DataStagings entries that have Target element set (data stgaings out)

Returns:
list of DataStagings object with Target element set

removeDataStaging

public void removeDataStaging()
Method to remove all DataStagings elements from JSDL.


getStdOutputUri

public java.net.URI getStdOutputUri()
                             throws ProblemException
Specified by:
getStdOutputUri in interface IGridJobDescription
Returns:
URI to file containing standard output or null if std output is not staged out
Throws:
ProblemException - if URI cannot be created

getStdInputUri

public java.net.URI getStdInputUri()
                            throws ProblemException
Specified by:
getStdInputUri in interface IGridJobDescription
Returns:
URI to file containing standard input or null if std input is not staged in
Throws:
ProblemException - if URI cannot be created

getStdErrorFileName

public java.lang.String getStdErrorFileName()
Specified by:
getStdErrorFileName in interface IGridJobDescription
Returns:
filename on computing element for standard error

getStdErrorUri

public java.net.URI getStdErrorUri()
                            throws ProblemException
Specified by:
getStdErrorUri in interface IGridJobDescription
Returns:
URI to file containing standard error or null if std error is not staged out
Throws:
ProblemException - if URI cannot be created

setApplicationName

public void setApplicationName(java.lang.String applicationName)
Method to set "name" attribute of POSIXApplication element. Make sure that POSIXApplication is set.

Parameters:
applicationName - name of the application

getApplicationName

public java.lang.String getApplicationName()
Method to access "name" attribute of the POSIXApplication element. Make sure that POSIXApplication is set.

Returns:
value of "name" attribute of POSIXApplication element.

getXml

public org.w3c.dom.Document getXml()
Returns EMF XML document as a DOM XML Document

Returns:
DOM Document representing EMF's XML content

getAsString

public java.lang.String getAsString()
                             throws ProblemException
Throws:
ProblemException

getCandidateHostsNames

public java.util.List<java.lang.String> getCandidateHostsNames()
Method to access list of candidate hosts.

Returns:
List of Strings with names of candidate hosts

isParametric

public boolean isParametric()
Returns:
true if this job has parametric extension (sweep)

removeTargetsFromOutStaging

public void removeTargetsFromOutStaging()

g-Eclipse
Release 1.0.0