org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.job
Class JobType

java.lang.Object
  extended by org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
      extended by org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.job.JobType
All Implemented Interfaces:
Cloneable, Evaluable

public class JobType
extends ExecutionEntity
implements Cloneable

Author:
Spyros Boutsis, NKUA

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
ExecutionEntity.ExecutionState
 
Field Summary
 
Fields inherited from class org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
entityName, execState, isGoalFulfilled, parent, scope, UID
 
Constructor Summary
JobType(Class<? extends DataType> inputClass)
          Class constructor
 
Method Summary
 void addChainExecutionAssignment(AssignTaskType assignment)
           
 void addInitAssignment(AssignTaskType initAssignment)
          Adds an initialization assignment in the list of this job instance's initialization list
 void cancel()
          Cancels the execution of this execution entity.
 Object clone()
           
 void createJobInstancesForAllApplicableInputs(org.gcube.common.core.scope.GCUBEScope scope)
          Creates a job instance for each one of the applicable inputs for this job, and adds it to the BootstrappingConfiguration object
 EvaluationResult evaluate(String expression)
          Evaluates the given expression on the execution tree rooted at the current object and returns a Node representing the result
 String execute(EntityExecutionData eed)
          Executes the logic of this execution entity.
 String execute(EntityExecutionData eed, Map<String,String> userInputs, String jobsChainUID, JobType prevJobInchain)
           
 List<DataType> getApplicableInputs()
          Returns the list of DataTypes corresponding to the applicable inputs for this job.
 String getBaseJobName()
          Returns the name of the base job that this job extends (if any)
 List<AssignTaskType> getChainExecutionAssignments()
           
 List<AssignTaskType> getInitAssignments()
          Returns the list of initialization assignments for this job
 DataType getInput()
          Returns the DataType object that represents the input of this JobType
 ExecutionEntity getTaskTree()
          Returns the root of this job's task tree
 String getTypeName()
          Returns the name of this ExecutionEntity's type
 String getUIDescription()
          Returns a string which will be displayed in the user interface as a description for this entity.
 void initialize(String jobTypeName, String jobDescription, DataType inputDataType, Element tasks, BootstrappingConfiguration conf)
          Initializes this JobType
 void initializeFromPreviousJobInChain(JobType previousJob)
           
 void initializeWithDataInScope(org.gcube.common.core.scope.GCUBEScope scope)
          Finds the DataTypes that could be possibly used as inputs for this entity as well as each sub-entity contained in it.
 JobType newInstance(String newJobName)
          Instantiates this JobType, creating a new job.
 JobType newInstance(String newJobName, String baseJob)
          Instantiates this JobType, creating a new job.
 void removeApplicableInputs(List<DataType> applicableInputsToRemove)
          Accepts a list of DataTypes and removes from the list of this JobType's applicable inputs the ones whose UID matches the UID of a DataType contained in the given list.
 void setBaseJobName(String baseJobName)
           
 void setChainExecutionAssignments(List<AssignTaskType> assignments)
           
 void setInitAssignments(List<AssignTaskType> initAssignments)
          Sets the list of initialization assignments for this job type instance
 void setJobName(String jobName)
           
 void setJobTypeName(String jobTypeName)
           
 void toXML(StringBuilder output)
          Outputs an XML description of the ExecutionEntity to the given StringBuilder object.
 
Methods inherited from class org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
assignRandomUID, createExecutionLog, getExecutionLogger, getExecutionState, getName, getParent, getScope, getUID, isFulfilled, setExecutionState, setIsFulfilled, setParent, setScope
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobType

public JobType(Class<? extends DataType> inputClass)
Class constructor

Method Detail

initialize

public void initialize(String jobTypeName,
                       String jobDescription,
                       DataType inputDataType,
                       Element tasks,
                       BootstrappingConfiguration conf)
                throws Exception
Initializes this JobType

Parameters:
jobTypeName - the name of the task type
inputDataType - the task's input data type
tasks - the XML definition of the job's task tree
Throws:
Exception

newInstance

public JobType newInstance(String newJobName)
Instantiates this JobType, creating a new job.

Specified by:
newInstance in class ExecutionEntity
Parameters:
newJobName - the name of the new job
Returns:
the new job

newInstance

public JobType newInstance(String newJobName,
                           String baseJob)
Instantiates this JobType, creating a new job.

Parameters:
newJobName - the name of the new job
baseJob - the name of the base job that this job extends
Returns:
the new job

setJobName

public void setJobName(String jobName)

setBaseJobName

public void setBaseJobName(String baseJobName)

setJobTypeName

public void setJobTypeName(String jobTypeName)

setInitAssignments

public void setInitAssignments(List<AssignTaskType> initAssignments)
Sets the list of initialization assignments for this job type instance

Parameters:
initAssignments - the list of initialization assignments

setChainExecutionAssignments

public void setChainExecutionAssignments(List<AssignTaskType> assignments)

getChainExecutionAssignments

public List<AssignTaskType> getChainExecutionAssignments()

addInitAssignment

public void addInitAssignment(AssignTaskType initAssignment)
Adds an initialization assignment in the list of this job instance's initialization list

Parameters:
initAssignment - the initialization assignment to add

addChainExecutionAssignment

public void addChainExecutionAssignment(AssignTaskType assignment)

getBaseJobName

public String getBaseJobName()
Returns the name of the base job that this job extends (if any)

Returns:

getInitAssignments

public List<AssignTaskType> getInitAssignments()
Returns the list of initialization assignments for this job

Returns:

getInput

public DataType getInput()
Returns the DataType object that represents the input of this JobType

Returns:

getTaskTree

public ExecutionEntity getTaskTree()
Returns the root of this job's task tree

Returns:
the tree root

initializeWithDataInScope

public void initializeWithDataInScope(org.gcube.common.core.scope.GCUBEScope scope)
                               throws Exception
Description copied from class: ExecutionEntity
Finds the DataTypes that could be possibly used as inputs for this entity as well as each sub-entity contained in it. The possible inputs for each entity are stored in a list inside the entity itself, so this method does not need to return anything. Furthermore, this method checks if the desirable output of this entity already exists in the given scope, and if it does, the entity's goal is defined as being already 'fulfilled' (the entity does not need to be executed).

Specified by:
initializeWithDataInScope in class ExecutionEntity
Parameters:
scope - the scope in which the entity will be executed
Throws:
Exception

getApplicableInputs

public List<DataType> getApplicableInputs()
Returns the list of DataTypes corresponding to the applicable inputs for this job.

Returns:
the list of applicable DataTypes

removeApplicableInputs

public void removeApplicableInputs(List<DataType> applicableInputsToRemove)
Accepts a list of DataTypes and removes from the list of this JobType's applicable inputs the ones whose UID matches the UID of a DataType contained in the given list.

Parameters:
applicableInputsToRemove - the list of DataTypes containing the UIDs to remove

createJobInstancesForAllApplicableInputs

public void createJobInstancesForAllApplicableInputs(org.gcube.common.core.scope.GCUBEScope scope)
                                              throws Exception
Creates a job instance for each one of the applicable inputs for this job, and adds it to the BootstrappingConfiguration object

Throws:
Exception

evaluate

public EvaluationResult evaluate(String expression)
Description copied from class: ExecutionEntity
Evaluates the given expression on the execution tree rooted at the current object and returns a Node representing the result

Specified by:
evaluate in interface Evaluable
Specified by:
evaluate in class ExecutionEntity
Parameters:
expression - the expression to evaluate, in "a.b.c..." notation
Returns:
the Node object that represents the result

getTypeName

public String getTypeName()
Description copied from class: ExecutionEntity
Returns the name of this ExecutionEntity's type

Specified by:
getTypeName in class ExecutionEntity
Returns:
the type name

getUIDescription

public String getUIDescription()
Description copied from class: ExecutionEntity
Returns a string which will be displayed in the user interface as a description for this entity.

Specified by:
getUIDescription in class ExecutionEntity
Returns:
the entity description

execute

public String execute(EntityExecutionData eed)
Description copied from class: ExecutionEntity
Executes the logic of this execution entity. This method cannot throw an exception. In the case of errors, appropriate messages must be logged in the execution log.

Specified by:
execute in class ExecutionEntity
Parameters:
eed - object containing useful data for the execution of the entity

execute

public String execute(EntityExecutionData eed,
                      Map<String,String> userInputs,
                      String jobsChainUID,
                      JobType prevJobInchain)

cancel

public void cancel()
Description copied from class: ExecutionEntity
Cancels the execution of this execution entity. If the entity is not currently executing, calling this method has no effect.

Specified by:
cancel in class ExecutionEntity

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class ExecutionEntity
Throws:
CloneNotSupportedException

toXML

public void toXML(StringBuilder output)
Description copied from class: ExecutionEntity
Outputs an XML description of the ExecutionEntity to the given StringBuilder object.

Specified by:
toXML in class ExecutionEntity
Parameters:
output - the StringBuilder to write to

initializeFromPreviousJobInChain

public void initializeFromPreviousJobInChain(JobType previousJob)


Copyright © 2013. All Rights Reserved.