org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.task
Class CustomTaskType

java.lang.Object
  extended by org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
      extended by org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.task.CustomTaskType
All Implemented Interfaces:
Cloneable, Evaluable
Direct Known Subclasses:
ContentFullTextIndexGenerationTaskType, ForwardIndexGenerationTaskType, FullTextIndexGenerationForTreeCollectionTaskType, FullTextIndexGenerationTaskType, FullTextIndexNodeGenerationTaskType, GeoIndexGenerationTaskType, IncrementalFTIndexUpdaterGenerationTaskType, IncrementalFWIndexUpdaterGenerationTaskType, IncrementalGeoIndexUpdaterGenerationTaskType, MetadataCollectionTransformationTaskType, OpenSearchGenerationTaskType

public abstract class CustomTaskType
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
 
Method Summary
 void cancel()
          Cancels the execution of this execution entity.
 Object clone()
           
 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.
abstract  void executeTask(TaskExecutionData execData)
          Executes the task.
 String getAttributeValue(String expression)
          Gets the value of an attribute defined in the XML definition of this task type.
 DataType getInput()
          Returns the current input object
 DataType getOutput()
          Returns the current output object
 String getTypeName()
          Returns the name of this ExecutionEntity's type
abstract  Document getXMLTaskDefinitionDocument()
          Returns a Document object defining the XML structure of this task's contents.
 void initialize(String taskTypeName, DataType inputDataType, DataType outputDataType, Element willRun)
          Initializes this TaskType
 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.
 CustomTaskType newInstance(String name)
          Instantiates the execution entity type represented by this object.
 void toXML(StringBuilder output)
          Outputs an XML description of the ExecutionEntity to the given StringBuilder object.
 boolean willRun()
          Returns the value of the flag that specifies whether this task will be executed or not
 
Methods inherited from class org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
assignRandomUID, createExecutionLog, getExecutionLogger, getExecutionState, getName, getParent, getScope, getUID, getUIDescription, isFulfilled, setExecutionState, setIsFulfilled, setParent, setScope
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public void initialize(String taskTypeName,
                       DataType inputDataType,
                       DataType outputDataType,
                       Element willRun)
                throws Exception
Initializes this TaskType

Parameters:
taskTypeName - the name of the task type
inputDataType - the task's input data type
outputDataType - the task's output data type
Throws:
Exception

getInput

public DataType getInput()
Returns the current input object

Returns:
the input object

getOutput

public DataType getOutput()
Returns the current output object

Returns:
the output object

willRun

public boolean willRun()
Returns the value of the flag that specifies whether this task will be executed or not

Returns:
the value of the 'run' flag

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

getAttributeValue

public String getAttributeValue(String expression)
                         throws Exception
Gets the value of an attribute defined in the XML definition of this task type. Works only for attributes represented by "leaf" nodes in the XML definition, whose value is only a string and not a node tree. If the requested attribute is not currently set, returns null.

Parameters:
expression - the expression to evaluate, in "a.b.c..." notation
Returns:
the value of the attribute identified by the given expression
Throws:
Exception

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

newInstance

public CustomTaskType newInstance(String name)
Description copied from class: ExecutionEntity
Instantiates the execution entity type represented by this object. The instance will have the given name.

Specified by:
newInstance in class ExecutionEntity
Parameters:
name - the new instance name
Returns:
the new instance

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

clone

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

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

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

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

executeTask

public abstract void executeTask(TaskExecutionData execData)
Executes the task. No exceptions can be thrown by this method. In case of errors or warnings, the task implementation should log an appropriate message to the execution log.

Parameters:
execData - a TaskExecutionData object containing useful information that can be used during the task's execution

getXMLTaskDefinitionDocument

public abstract Document getXMLTaskDefinitionDocument()
                                               throws Exception
Returns a Document object defining the XML structure of this task's contents.

Returns:
the XML task definition document
Throws:
Exception


Copyright © 2013. All Rights Reserved.