org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types
Class ExecutionEntity

java.lang.Object
  extended by org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.types.ExecutionEntity
All Implemented Interfaces:
Cloneable, Evaluable
Direct Known Subclasses:
AssignTaskType, CustomTaskType, ExecutionType, JobType

public abstract class ExecutionEntity
extends Object
implements Cloneable, Evaluable

Author:
Spyros Boutsis, NKUA

Nested Class Summary
static class ExecutionEntity.ExecutionState
           
 
Field Summary
protected  String entityName
          The name of this entity instance
protected  ExecutionEntity.ExecutionState execState
          The state of execution of this ExecutionEntity
protected  boolean isGoalFulfilled
          Specifies whether the goal of this execution entity has been fulfilled or not
protected  ExecutionEntity parent
          The parent execution entity in the execution hierarchy
protected  org.gcube.common.core.scope.GCUBEScope scope
          The scope that this execution entity belongs to
protected  String UID
          The unique identifier of this entity
 
Constructor Summary
ExecutionEntity()
          Class constructor
 
Method Summary
 void assignRandomUID()
          Assigns a new, randomly generated UID to this ExecutionEntity
abstract  void cancel()
          Cancels the execution of this execution entity.
 Object clone()
           
protected  void createExecutionLog(org.apache.log4j.Logger serverLogger, org.gcube.application.framework.core.session.ASLSession session)
          Creates a new, empty execution logger
abstract  EvaluationResult evaluate(String expression)
          Evaluates the given expression on the execution tree rooted at the current object and returns a Node representing the result
abstract  String execute(EntityExecutionData execData)
          Executes the logic of this execution entity.
 TaskExecutionLogger getExecutionLogger()
          Returns the execution logger
 ExecutionEntity.ExecutionState getExecutionState()
          Returns the current execution state of this entity
 String getName()
          Returns the name of this execution entity
 ExecutionEntity getParent()
          Returns the parent of this execution entity
 org.gcube.common.core.scope.GCUBEScope getScope()
          Returns the scope that this execution entity belongs to
abstract  String getTypeName()
          Returns the name of this ExecutionEntity's type
 String getUID()
          Returns the entity's UID
abstract  String getUIDescription()
          Returns a string which will be displayed in the user interface as a description for this entity.
abstract  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.
 boolean isFulfilled()
          Returns true if this entity's goal is fulfilled, or false otherwise
abstract  ExecutionEntity newInstance(String name)
          Instantiates the execution entity type represented by this object.
 void setExecutionState(ExecutionEntity.ExecutionState state)
          Sets the execution state of this entity
 void setIsFulfilled(boolean isFulfilled)
          Sets this execution entity as 'fulfilled', or not 'fulfilled'
 void setParent(ExecutionEntity parent)
          Sets the parent of this execution entity
 void setScope(org.gcube.common.core.scope.GCUBEScope scope)
          Sets the scope that this execution entity belongs to
abstract  void toXML(StringBuilder output)
          Outputs an XML description of the ExecutionEntity to the given StringBuilder object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected ExecutionEntity parent
The parent execution entity in the execution hierarchy


entityName

protected String entityName
The name of this entity instance


isGoalFulfilled

protected boolean isGoalFulfilled
Specifies whether the goal of this execution entity has been fulfilled or not


UID

protected String UID
The unique identifier of this entity


execState

protected ExecutionEntity.ExecutionState execState
The state of execution of this ExecutionEntity


scope

protected org.gcube.common.core.scope.GCUBEScope scope
The scope that this execution entity belongs to

Constructor Detail

ExecutionEntity

public ExecutionEntity()
Class constructor

Method Detail

getParent

public ExecutionEntity getParent()
Returns the parent of this execution entity

Returns:
the parent entity

setParent

public void setParent(ExecutionEntity parent)
Sets the parent of this execution entity

Parameters:
parent - the parent

getName

public String getName()
Returns the name of this execution entity

Returns:
the entity's name

getUID

public String getUID()
Returns the entity's UID

Returns:
the UID

assignRandomUID

public void assignRandomUID()
Assigns a new, randomly generated UID to this ExecutionEntity


isFulfilled

public boolean isFulfilled()
Returns true if this entity's goal is fulfilled, or false otherwise

Returns:

setIsFulfilled

public void setIsFulfilled(boolean isFulfilled)
Sets this execution entity as 'fulfilled', or not 'fulfilled'

Parameters:
isFulfilled -

setExecutionState

public void setExecutionState(ExecutionEntity.ExecutionState state)
Sets the execution state of this entity

Parameters:
state - the execution state to set

getExecutionState

public ExecutionEntity.ExecutionState getExecutionState()
Returns the current execution state of this entity

Returns:
the execution state

setScope

public void setScope(org.gcube.common.core.scope.GCUBEScope scope)
Sets the scope that this execution entity belongs to

Parameters:
scope - the entity's scope

getScope

public org.gcube.common.core.scope.GCUBEScope getScope()
Returns the scope that this execution entity belongs to

Returns:
the entity's scope

createExecutionLog

protected void createExecutionLog(org.apache.log4j.Logger serverLogger,
                                  org.gcube.application.framework.core.session.ASLSession session)
Creates a new, empty execution logger

Parameters:
serverLogger - the server-side logger currently in use by this execution entity

getExecutionLogger

public TaskExecutionLogger getExecutionLogger()
Returns the execution logger

Returns:

getTypeName

public abstract String getTypeName()
Returns the name of this ExecutionEntity's type

Returns:
the type name

execute

public abstract String execute(EntityExecutionData execData)
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.

Parameters:
execData - object containing useful data for the execution of the entity

cancel

public abstract void cancel()
Cancels the execution of this execution entity. If the entity is not currently executing, calling this method has no effect.


newInstance

public abstract ExecutionEntity newInstance(String name)
Instantiates the execution entity type represented by this object. The instance will have the given name.

Parameters:
name - the new instance name
Returns:
the new instance

evaluate

public abstract EvaluationResult evaluate(String expression)
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
Parameters:
expression - the expression to evaluate, in "a.b.c..." notation
Returns:
the Node object that represents the result

initializeWithDataInScope

public abstract void initializeWithDataInScope(org.gcube.common.core.scope.GCUBEScope scope)
                                        throws Exception
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).

Parameters:
scope - the scope in which the entity will be executed
Throws:
Exception

getUIDescription

public abstract String getUIDescription()
Returns a string which will be displayed in the user interface as a description for this entity.

Returns:
the entity description

toXML

public abstract void toXML(StringBuilder output)
Outputs an XML description of the ExecutionEntity to the given StringBuilder object.

Parameters:
output - the StringBuilder to write to

clone

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


Copyright © 2013. All Rights Reserved.