g-Eclipse
Release 1.0.0

eu.geclipse.jsdl
Class JSDLJobDescriptionModel

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

public class JSDLJobDescriptionModel
extends AbstractGridContainer
implements IGridJobDescription

JSDLJobDescription object for use outside g-Eclipse model. This class bases only on EMF's model representing JSDL's XML definition. For creating instance of this class a java.io.File with JSDL content has to exist on disk.


Constructor Summary
JSDLJobDescriptionModel(java.io.File file)
           
 
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.
 SweepType addIndependentSweep(java.lang.String refParamName, java.lang.String sweepParamName)
          Method to add parameter definition of a sweep changing independently from referenced element (values will be sweep after all values of referenced parameter were substituted).
 SweepType addInnerSweep(java.lang.String refParamName, java.lang.String sweepParamName)
          Method to add parameter definition of a sweep changing for each change of referenced element (inner sweep loop).
 SweepType addSweepOnTheSameLevel(java.lang.String refParamName, java.lang.String sweepParamName)
          Method to add parameter definition of a sweep changing with referenced element (sweep on the same level).
 java.lang.String getApplicationName()
          Method to access "name" attribute of the POSIXApplication element.
 java.util.List<java.lang.String> getCandidateHostsNames()
          Method to access list of candidate hosts - that is content of CandidateHost element of JSDL Resources entry.
 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()
           
 java.lang.String getExecutable()
           
 java.util.List<java.lang.String> getExecutableArguments()
           
 IFileStore getFileStore()
          Get the file store that this element is associated with.
 java.io.InputStream getInputStream()
           
 java.lang.String getJSDLString()
          Reads content of EMF document and transforms it into a String object.
 java.lang.String getName()
          Get the name of this element.
 java.lang.String getOSTypeName()
          Method to access OperatingSystem name.
 java.lang.String getOSVersion()
          Method to access OperatingSystem version.
 IGridContainer getParent()
          Get the parent element of this element.
 IPath getPath()
          Get the path of this element relative to the grid root element.
 POSIXApplicationType getPosixApplication()
          Method to access POSIXApplication element.
 IResource getResource()
          Get the corresponding resource of this element.
 java.lang.String getStdErrorFileName()
           
 java.net.URI getStdErrorUri()
           
 java.lang.String getStdInputFileName()
           
 java.net.URI getStdInputUri()
           
 java.lang.String getStdOutputFileName()
           
 java.net.URI getStdOutputUri()
           
 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 isParametric()
          Method to check if any sweep element is present in this document.
 void removeDataStaging()
          Method to remove all DataStagings elements from JSDL.
 void removeTargetsFromOutStaging()
          Method to clear (remove) Target elements from data stagings out entries.
 void save()
           
 void setApplicationName(java.lang.String applicationName)
          Method to set "name" attribute of POSIXApplication element.
 void setEnumFunction(java.lang.String paramName, java.util.List<java.lang.String> values)
          Method for setting function defining sweep parameter values by enumeration (listing them).
 void setJobIdentification(java.lang.String jobName, java.lang.String description)
          This method re-sets JSDL JobIdentification element (creates new empty element).
 void setLoopFunction(java.lang.String paramName, java.math.BigInteger start, java.math.BigInteger end, java.math.BigInteger step, java.util.List<java.math.BigInteger> exceptions)
          Method for setting function defining sweep parameter values by integer loop.
 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.
 void updateModelFromFile()
          Updates the EMF JSDL model so that it matches the file content.
 
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, refresh, setDirty
 
Methods inherited from interface eu.geclipse.core.model.IGridElement
dispose, getProject, isHidden, isVirtual
 

Constructor Detail

JSDLJobDescriptionModel

public JSDLJobDescriptionModel(java.io.File file)
                        throws IOWrappedException
Parameters:
file -
Throws:
IOWrappedException
Method Detail

getDescription

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

getExecutable

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

getExecutableArguments

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

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

getStdInputFileName

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

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

getStdOutputFileName

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

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

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
Returns:
True if this container uses lazy loading.

getFileStore

public IFileStore getFileStore()
Description copied from interface: IGridElement
Get the file store that this element is associated with. May return null if there is no such associated file store. If this element is not virtual the filestore corresponds to the file store of the corresponding resource.

Specified by:
getFileStore in interface IGridElement
Returns:
The corresponding file store.

getName

public java.lang.String getName()
Description copied from interface: IGridElement
Get the name of this element. The names of all children of a container have to be unique within this container. If this element is not virtual the name is the name of the corresponding resource.

Specified by:
getName in interface IGridElement
Returns:
The name of this element.

getParent

public IGridContainer getParent()
Description copied from interface: IGridElement
Get the parent element of this element. The parent can only be an IGridContainer. This method may not return null since the only element that is allowed to return null is the IGridRoot which is a singleton and is internally defined within the model.

Specified by:
getParent in interface IGridElement
Returns:
The parent container of this element.

getPath

public IPath getPath()
Description copied from interface: IGridElement
Get the path of this element relative to the grid root element. If this element is not virtual this has to be the path of the corresponding @IResource.

Specified by:
getPath in interface IGridElement
Returns:
The path of this element relative to the grid root.

getResource

public IResource getResource()
Description copied from interface: IGridElement
Get the corresponding resource of this element. This may be null if - and only if - this element is virtual.

Specified by:
getResource in interface IGridElement
Returns:
The corresponding resource or null if this element is virtual.

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
Returns:
True if this element is local.

updateModelFromFile

public void updateModelFromFile()
                         throws IOWrappedException
Updates the EMF JSDL model so that it matches the file content.

Parameters:
file - XML file with JSDL content.
Throws:
IOWrappedException

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

getJSDLString

public java.lang.String getJSDLString()
                               throws java.io.IOException
Reads content of EMF document and transforms it into a String object.

Returns:
String representation of EMF document's content. This String is formated - e.g. it is divided into lines.
Throws:
java.io.IOException - when there was a problem while reading the file

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

getPosixApplication

public POSIXApplicationType getPosixApplication()
Method to access POSIXApplication element.

Returns:
POSIXApplcation element with all its children or null if this element is not set in JSDL document.

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

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.


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.

getCandidateHostsNames

public java.util.List<java.lang.String> getCandidateHostsNames()
Method to access list of candidate hosts - that is content of CandidateHost element of JSDL Resources entry.

Returns:
List with names of candidate hosts as set in JSDL document

isParametric

public boolean isParametric()
Method to check if any sweep element is present in this document. If so - this means that JSDL is defined as a parametric document.

Returns:
true if sweep element was defined, false otherwise

removeTargetsFromOutStaging

public void removeTargetsFromOutStaging()
Method to clear (remove) Target elements from data stagings out entries.


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

addSweepOnTheSameLevel

public SweepType addSweepOnTheSameLevel(java.lang.String refParamName,
                                        java.lang.String sweepParamName)
Method to add parameter definition of a sweep changing with referenced element (sweep on the same level). If JSDL is not parametric (no sweep defined yet) or referenced sweep cannot be found - this method has no effect.

Parameters:
refParamName - name (XPath expression) of a sweeped element with which newly created sweep should change
sweepParamName - name of JSDL element (XPath expression) for which new sweep will be created
Returns:
newly created sweep element

addInnerSweep

public SweepType addInnerSweep(java.lang.String refParamName,
                               java.lang.String sweepParamName)
Method to add parameter definition of a sweep changing for each change of referenced element (inner sweep loop). If JSDL is not parametric (no sweep defined yet) or referenced sweep cannot be found - this method has no effect.

Parameters:
refParamName - name (XPath expression) of a sweeped element for each change of which newly created sweep should change
sweepParamName - name of JSDL element (XPath expression) for which new sweep will be created
Returns:
newly created sweep element

addIndependentSweep

public SweepType addIndependentSweep(java.lang.String refParamName,
                                     java.lang.String sweepParamName)
Method to add parameter definition of a sweep changing independently from referenced element (values will be sweep after all values of referenced parameter were substituted).
If JSDL is not parametric, referenced element cannot be found or this method was called with null as a refParamName - sweep on a root level will be created. This means that JSDL will became parametric.

Parameters:
refParamName - name (XPath expression) of a sweeped element from which newly created parameter should be independent
sweepParamName - name of JSDL element (XPath expression) for which new sweep will be created
Returns:
newly created sweep element

setEnumFunction

public void setEnumFunction(java.lang.String paramName,
                            java.util.List<java.lang.String> values)
Method for setting function defining sweep parameter values by enumeration (listing them).

Parameters:
paramName - name of a parameter (JSDL element, XPath expression) for which function is defined
values - enumeration values of function

setLoopFunction

public void setLoopFunction(java.lang.String paramName,
                            java.math.BigInteger start,
                            java.math.BigInteger end,
                            java.math.BigInteger step,
                            java.util.List<java.math.BigInteger> exceptions)
Method for setting function defining sweep parameter values by integer loop.

Parameters:
paramName - name of a parameter (JSDL element, XPath expression) for which function is defined
start - starting value of loop
end - ending value of loop
step - changing step of loop
exceptions - values which will be excluded from values generated by this loop

save

public void save()

getInputStream

public java.io.InputStream getInputStream()

g-Eclipse
Release 1.0.0