Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

RecoveryAction Class Reference
[Fault Detection Identification and Recovery]

#include <RecoveryAction.h>

Inheritance diagram for RecoveryAction:

PunctualAction CC_RootObject DC_DummyRecoveryAction DC_NullRecoveryAction DC_SampleRecoveryAction List of all members.

Detailed Description

Punctual action that performs a recovery action.

A recovery action is an action that is executed in response to the detection of a failure. Recovery actions are implemented as a form of punctual action. They add to their base class the next recovery action attribute and the execution check.

Recovery actions can be linked in sequential chains. The client only sees one single recovery action (the one at the head of the chain) but its execution can lead to all actions in the chain being executed in sequence. The next recovery action attribute holds the pointer to the next recovery action in the chain.

The execution check is performed before executing the recovery action. Its implementation is left open and concrete subclasses can use it to define the conditions under which the execution of the recovery action is allowed.

This is an abstract class because it leaves open the definition of actual actions to be performed by the recovery action component and the definition of the execution check open. This class only implements the management of the next recovery action.

Punctual actions return an outcome. The outcome of a recovery action R is the outcome of the last recovery action in the chain of recovery actions that has R as its first item.

Implementation Note: This could in principle be implemented as a subclass of ConditionalPunctualAction. This is not done because class a failure of the execution check in class ConditionalPunctualAction simply leads to an immediate termination of the punctual action. In the case of the RecoveryAction class, instead, a failure of the execution check leads to an attempt to execute the next recovery action.

Author:
Alessandro Pasetti (P&P Software GmbH)
Version:
1.0

Definition at line 58 of file RecoveryAction.h.

Public Member Functions

 RecoveryAction (void)
 Instantiate a recovery action.

void setNextRecoveryAction (RecoveryAction *pNextRecoveryAction)
 Set the next recovery action.

RecoveryActiongetNextRecoveryAction (void)
 Get the next recovery action.


Protected Member Functions

virtual TD_ActionOutcome doAction (void)
 Execute the recovery action if the execution check is satisfied and pass on the execute request to the next recovery action (if one is defined).

virtual bool canExecute (void)
 Encapsulate implementation of the execution check.

virtual TD_ActionOutcome doRecoveryAction (void)=0
 Encapsulate implementation of the concrete recovery actions associated to this component.


Constructor & Destructor Documentation

RecoveryAction::RecoveryAction void   ) 
 

Instantiate a recovery action.

The next recovery action is set to null.

Definition at line 16 of file RecoveryAction.cpp.


Member Function Documentation

bool RecoveryAction::canExecute void   )  [protected, virtual]
 

Encapsulate implementation of the execution check.

This method is called by method doAction() in this same class. This class provides a default implementation that always returns "can execute".

See also:
doAction
Returns:
true if the action can be executed, false if the action cannot be executed.

Reimplemented in DC_DummyRecoveryAction.

Definition at line 32 of file RecoveryAction.cpp.

TD_ActionOutcome RecoveryAction::doAction void   )  [protected, virtual]
 

Execute the recovery action if the execution check is satisfied and pass on the execute request to the next recovery action (if one is defined).

A pseudo-code implementation for this method is as follows:

   outcome = ACTION_CANNOT_EXECUTE;
   if ( canExecute() )
      outcome = doRecoveryAction()
   if ( nextRecoveryAction != pNULL)
      outcome = nextRecoveryAction->execute();
   return outcome; 
The doRecoveryAction() method is abstract and encapsulates the implementation of the actions associated to this recovery action. Thus, this class enforces the handing over of execution requests from one recovery action to the next but it leaves the definition of the specific recovery actions to concrete subclasses.
See also:
setNextRecoveryAction

TD_ActionOutcome

Returns:
the outcome code of the last recovery action to be executed or ACTION_CANNOT_EXECUTE if no action can be executed

Implements PunctualAction.

Definition at line 20 of file RecoveryAction.cpp.

virtual TD_ActionOutcome RecoveryAction::doRecoveryAction void   )  [protected, pure virtual]
 

Encapsulate implementation of the concrete recovery actions associated to this component.

This method is called by method doAction() in this same class.

See also:
doAction
Returns:
the outcome code of the punctual action

Implemented in DC_DummyRecoveryAction, DC_NullRecoveryAction, and DC_SampleRecoveryAction.

RecoveryAction * RecoveryAction::getNextRecoveryAction void   ) 
 

Get the next recovery action.

If no recovery action has been chained to this one, then a value of pNULL is returned.

See also:
doAction
Returns:
the next recovery action

Definition at line 41 of file RecoveryAction.cpp.

void RecoveryAction::setNextRecoveryAction RecoveryAction pNextRecoveryAction  ) 
 

Set the next recovery action.

See also:
doAction
Parameters:
pNextRecoveryAction the next recovery action

Definition at line 36 of file RecoveryAction.cpp.


The documentation for this class was generated from the following files:
Copyright 2003 P&P Software GmbH - All Rights Reserved