/// <summary> /// Add a new atomic step to the composite operation. /// If the operation is currently executing a step, the step is added after the current step. /// </summary> public virtual void addStep(DeploymentOperationStep step) { if (currentStep != null) { steps.Insert(steps.IndexOf(currentStep) + 1, step); } else { steps.Add(step); } }
// runtime aspect /////////////////////////////////// public virtual void execute() { while (steps.Count > 0) { currentStep = steps.RemoveAt(0); try { LOG.debugPerformOperationStep(currentStep.Name); currentStep.performOperationStep(this); successfulSteps.Add(currentStep); LOG.debugSuccessfullyPerformedOperationStep(currentStep.Name); } catch (Exception e) { if (isRollbackOnFailure) { try { rollbackOperation(); } catch (Exception e2) { LOG.exceptionWhileRollingBackOperation(e2); } // re-throw the original exception throw LOG.exceptionWhilePerformingOperationStep(name, currentStep.Name, e); } else { LOG.exceptionWhilePerformingOperationStep(currentStep.Name, e); } } } }
public virtual DeploymentOperationBuilder addStep(DeploymentOperationStep step) { steps.Add(step); return(this); }