gr.uoa.di.madgik.execution.plan.element
Class PlanElementBase

java.lang.Object
  extended by gr.uoa.di.madgik.execution.plan.element.PlanElementBase
All Implemented Interfaces:
IPlanElement, Observer
Direct Known Subclasses:
BagPlanElement, BoundaryPlanElement, BreakPlanElement, CheckpointPlanElement, ConditionalPlanElement, FileTransferPlanElement, FlowPlanElement, LoopPlanElement, ParameterProcessingPlanElement, PojoPlanElement, SequencePlanElement, ShellPlanElement, TryCatchFinallyPlanElement, WaitPlanElement, WSRESTPlanElement, WSSOAPPlanElement

public abstract class PlanElementBase
extends Object
implements IPlanElement, Observer

Base abstract class implementing IPlanElement. This class can be extended by other classes that will offer some functionality as plan elements. This class offers some common functionalities needed by all plan classes. When the IPlanElement.Execute(ExecutionHandle) is invoked, the IPlanElement.ValidatePreExecution(ExecutionHandle) is invoked, the element is registered for ExecutionStateEvent.EventName#ExecutionCancel, ExecutionStateEvent.EventName#ExecutionPause and ExecutionStateEvent.EventName#ExecutionResume events and finally the ExecuteExtender(ExecutionHandle) method is invoked. In case an error occurs during this call, the element's ContingencyTrigger collection is retrieved and processed to check if there are some reactions that can be taken.

Author:
gpapanikos

Nested Class Summary
protected static class PlanElementBase.ClockType
          The type of clock associated with StartClock(ClockType) and StopClock(ClockType)
 
Nested classes/interfaces inherited from interface gr.uoa.di.madgik.execution.plan.element.IPlanElement
IPlanElement.PlanElementType
 
Constructor Summary
PlanElementBase()
           
 
Method Summary
protected  void CheckStatus(ExecutionHandle Handle)
          Check status of the execution.
 void Execute(ExecutionHandle Handle)
          Execute the element
protected abstract  void ExecuteExtender(ExecutionHandle Handle)
          Execute extender.
 void ExecuteWithStateAwareness(ExecutionHandle Handle)
          Execute with state awareness.
protected abstract  Logger GetExtenderLogger()
          Gets the extender logger.
protected  ExecutionPerformanceReportStateEvent GetPerformanceEvent()
          Instantiates a new performance event populating it with the clocks it has calculated
 void RegisterToRunningActionElementsRestriction(ExecutionHandle Handle)
          Register to running action elements restriction.
protected  void ResetClocks()
          Reset clocks.
protected  void StartClock(PlanElementBase.ClockType Type)
          Start clock.
protected  void StopClock(PlanElementBase.ClockType Type)
          Stop clock.
 void UnregisterToRunningActionElementsRestriction(ExecutionHandle Handle)
          Unregister to running action elements restriction.
 void update(Observable o, Object arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gr.uoa.di.madgik.execution.plan.element.IPlanElement
FromXML, FromXML, GetContingencyTriggers, GetID, GetModifiedVariableNames, GetName, GetNeededVariableNames, GetPlanElementType, Locate, LocateActionElements, SetContingencyResourcePick, SetName, SupportedContingencyTriggers, SupportsContingencyTriggers, ToXML, Validate, ValidatePreExecution
 

Constructor Detail

PlanElementBase

public PlanElementBase()
Method Detail

ResetClocks

protected void ResetClocks()
Reset clocks.


StartClock

protected void StartClock(PlanElementBase.ClockType Type)
Start clock.

Parameters:
Type - the type

StopClock

protected void StopClock(PlanElementBase.ClockType Type)
Stop clock.

Parameters:
Type - the type

GetPerformanceEvent

protected ExecutionPerformanceReportStateEvent GetPerformanceEvent()
Instantiates a new performance event populating it with the clocks it has calculated

Returns:
the execution performance report state event

Execute

public void Execute(ExecutionHandle Handle)
             throws ExecutionRunTimeException,
                    ExecutionInternalErrorException,
                    ExecutionCancelException,
                    ExecutionBreakException
Description copied from interface: IPlanElement
Execute the element

Specified by:
Execute in interface IPlanElement
Parameters:
Handle - the execution handle
Throws:
ExecutionRunTimeException - A runtime error occurred
ExecutionInternalErrorException - An internal error occurred
ExecutionCancelException - The execution is canceled
ExecutionBreakException - The execution was terminated after an explicit request

ExecuteWithStateAwareness

public void ExecuteWithStateAwareness(ExecutionHandle Handle)
                               throws ExecutionRunTimeException,
                                      ExecutionInternalErrorException,
                                      ExecutionCancelException,
                                      ExecutionBreakException
Execute with state awareness. The element is registered for ExecutionStateEvent.EventName#ExecutionCancel, ExecutionStateEvent.EventName#ExecutionPause and ExecutionStateEvent.EventName#ExecutionResume events, the ExecuteExtender(ExecutionHandle) is called, and then the element is again unregistered from these events

Parameters:
Handle - the execution handle
Throws:
ExecutionRunTimeException - A runtime error occurred
ExecutionInternalErrorException - An internal error occurred
ExecutionCancelException - The execution was canceled
ExecutionBreakException - The execution was terminated

GetExtenderLogger

protected abstract Logger GetExtenderLogger()
Gets the extender logger.

Returns:
the logger

ExecuteExtender

protected abstract void ExecuteExtender(ExecutionHandle Handle)
                                 throws ExecutionRunTimeException,
                                        ExecutionInternalErrorException,
                                        ExecutionCancelException,
                                        ExecutionBreakException
Execute extender. This class is implemented by extenders of the class

Parameters:
Handle - the execution handle
Throws:
ExecutionRunTimeException - A runtime error occurred
ExecutionInternalErrorException - An internal error occurred
ExecutionCancelException - The execution was canceled
ExecutionBreakException - The execution was terminated

CheckStatus

protected void CheckStatus(ExecutionHandle Handle)
                    throws ExecutionCancelException,
                           ExecutionInternalErrorException
Check status of the execution. If the plan was declared as paused this invocation will block until a resume event is caught.

Parameters:
Handle - the execution handle
Throws:
ExecutionInternalErrorException - An internal error occurred
ExecutionCancelException - The execution was canceled

RegisterToRunningActionElementsRestriction

public void RegisterToRunningActionElementsRestriction(ExecutionHandle Handle)
Register to running action elements restriction.

Parameters:
Handle - the execution handle

UnregisterToRunningActionElementsRestriction

public void UnregisterToRunningActionElementsRestriction(ExecutionHandle Handle)
Unregister to running action elements restriction.

Parameters:
Handle - the handle

update

public void update(Observable o,
                   Object arg)
Specified by:
update in interface Observer


Copyright © 2012. All Rights Reserved.