Class BaseWorkflowExecutor
- java.lang.Object
-
- com.dtolabs.rundeck.core.execution.workflow.BaseWorkflowExecutor
-
- All Implemented Interfaces:
WorkflowExecutor
- Direct Known Subclasses:
EngineWorkflowExecutor,NodeFirstWorkflowExecutor
public abstract class BaseWorkflowExecutor extends java.lang.Object implements WorkflowExecutor
BaseWorkflowStrategy is ...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBaseWorkflowExecutor.BaseWorkflowExecutionResultstatic classBaseWorkflowExecutor.StepResultCapture
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringOPTION_KEYprotected static java.lang.StringSECURE_OPTION_KEYprotected static java.lang.StringSECURE_OPTION_VALUEprotected static WorkflowStatusResultWorkflowResultFailedFailure result-
Fields inherited from interface com.dtolabs.rundeck.core.execution.workflow.WorkflowExecutor
NODE_FIRST, PARALLEL, STEP_FIRST
-
-
Constructor Summary
Constructors Constructor Description BaseWorkflowExecutor(IFramework framework)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddNodeStepFailureContextData(StepExecutionResult dispatcherStepResult, ExecutionContextImpl.Builder builder)Add any node-specific step failure information to the node-specific data contextsprotected voidaddStepFailureContextData(StepExecutionResult stepResult, ExecutionContextImpl.Builder builder)Add step result failure information to the data contextvoidcombineNodeResultData(int c, StepExecutionResult stepResult, WFSharedContext combinedResultData)voidcombineResultData(int c, DataOutput outputContext, WFSharedContext combinedResultData, StepExecutionResult handlerResult)protected java.util.Map<java.lang.String,java.util.Collection<StepExecutionResult>>convertFailures(java.util.Map<java.lang.Integer,StepExecutionResult> failedMap)Convert map of step execution results keyed by step number, to a collection of step execution results keyed by node nameprotected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>createPrintableDataContext(java.lang.String optionKey, java.lang.String secureOptionKey, java.lang.String secureOptionValue, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> dataContext)Creates a copy of the given data context with the secure option values obfuscated.protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>createPrintableDataContext(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> dataContext)Creates a copy of the given data context with the secure option values obfuscated.protected StepExecutionResultexecuteWFItem(StepExecutionContext executionContext, java.util.Map<java.lang.Integer,StepExecutionResult> failedMap, int c, StepExecutionItem cmd)Execute a workflow item, returns true if the item succeeds.WorkflowExecutionResultexecuteWorkflow(StepExecutionContext executionContext, WorkflowExecutionItem item)abstract WorkflowExecutionResultexecuteWorkflowImpl(StepExecutionContext executionContext, WorkflowExecutionItem item)protected WorkflowStatusResultexecuteWorkflowItemsForNodeSet(StepExecutionContext executionContext, java.util.Map<java.lang.Integer,StepExecutionResult> failedMap, java.util.List<StepExecutionResult> resultList, java.util.List<StepExecutionItem> iWorkflowCmdItems, boolean keepgoing, int beginStepIndex, WFSharedContext sharedContext)Deprecated.should invoke engine workflow executorBaseWorkflowExecutor.StepResultCaptureexecuteWorkflowStep(StepExecutionContext executionContext, java.util.Map<java.lang.Integer,StepExecutionResult> failedMap, java.util.List<StepExecutionResult> resultList, boolean keepgoing, WorkflowExecutionListener wlistener, int c, StepExecutionItem cmd)Execute a step and handle flow control and error handler and log filter.protected IFrameworkgetFramework()protected WorkflowExecutionListenergetWorkflowListener(ExecutionContext executionContext)protected static NodeStepResultnodeStepResultFromNodeStepException(INodeEntry node, NodeStepException nodeStepException)protected ExecutionContextImpl.BuilderreplaceFailedNodesListenerInContext(ExecutionContextImpl.Builder builder, FailedNodesListener captureFailedNodesListener, ExecutionListener executionListener)voidreportNodesMatched(StepExecutionContext executionContext, NodeRecorder stepCaptureFailedNodesListener)protected voidvalidateNodeSet(ExecutionContext executionContext, NodesSelector nodeSelector)protected static WorkflowStatusDataResultworkflowResult(boolean status, java.lang.String statusString, ControlBehavior behavior, WFSharedContext sharedContext)
-
-
-
Field Detail
-
OPTION_KEY
protected static final java.lang.String OPTION_KEY
- See Also:
- Constant Field Values
-
SECURE_OPTION_KEY
protected static final java.lang.String SECURE_OPTION_KEY
- See Also:
- Constant Field Values
-
SECURE_OPTION_VALUE
protected static final java.lang.String SECURE_OPTION_VALUE
- See Also:
- Constant Field Values
-
WorkflowResultFailed
protected static final WorkflowStatusResult WorkflowResultFailed
Failure result
-
-
Constructor Detail
-
BaseWorkflowExecutor
public BaseWorkflowExecutor(IFramework framework)
-
-
Method Detail
-
workflowResult
protected static WorkflowStatusDataResult workflowResult(boolean status, java.lang.String statusString, ControlBehavior behavior, WFSharedContext sharedContext)
- Parameters:
status- success/failurestatusString- status stringbehavior- control behavior- Returns:
- result with the given input
-
getFramework
protected IFramework getFramework()
-
executeWorkflow
public final WorkflowExecutionResult executeWorkflow(StepExecutionContext executionContext, WorkflowExecutionItem item)
- Specified by:
executeWorkflowin interfaceWorkflowExecutor
-
getWorkflowListener
protected WorkflowExecutionListener getWorkflowListener(ExecutionContext executionContext)
-
executeWorkflowImpl
public abstract WorkflowExecutionResult executeWorkflowImpl(StepExecutionContext executionContext, WorkflowExecutionItem item)
-
executeWFItem
protected StepExecutionResult executeWFItem(StepExecutionContext executionContext, java.util.Map<java.lang.Integer,StepExecutionResult> failedMap, int c, StepExecutionItem cmd)
Execute a workflow item, returns true if the item succeeds. This method will throw an exception if the workflow item fails and the Workflow is has keepgoing==false.- Parameters:
executionContext- contextfailedMap- List to add any messages if the item failsc- index of the WF itemcmd- WF item descriptor- Returns:
- true if the execution succeeds, false otherwise
-
executeWorkflowItemsForNodeSet
protected WorkflowStatusResult executeWorkflowItemsForNodeSet(StepExecutionContext executionContext, java.util.Map<java.lang.Integer,StepExecutionResult> failedMap, java.util.List<StepExecutionResult> resultList, java.util.List<StepExecutionItem> iWorkflowCmdItems, boolean keepgoing, int beginStepIndex, WFSharedContext sharedContext)
Deprecated.should invoke engine workflow executorExecute the sequence of ExecutionItems within the context, and with the given keepgoing value- Parameters:
executionContext- contextfailedMap- failuresresultList- resultsiWorkflowCmdItems- list of stepskeepgoing- true to keepgoing on step failurebeginStepIndex- beginning step index- Returns:
- true if successful
-
addStepFailureContextData
protected void addStepFailureContextData(StepExecutionResult stepResult, ExecutionContextImpl.Builder builder)
Add step result failure information to the data context- Parameters:
stepResult- result
-
addNodeStepFailureContextData
protected void addNodeStepFailureContextData(StepExecutionResult dispatcherStepResult, ExecutionContextImpl.Builder builder)
Add any node-specific step failure information to the node-specific data contexts- Parameters:
dispatcherStepResult- resultbuilder-
-
replaceFailedNodesListenerInContext
protected ExecutionContextImpl.Builder replaceFailedNodesListenerInContext(ExecutionContextImpl.Builder builder, FailedNodesListener captureFailedNodesListener, ExecutionListener executionListener)
-
convertFailures
protected java.util.Map<java.lang.String,java.util.Collection<StepExecutionResult>> convertFailures(java.util.Map<java.lang.Integer,StepExecutionResult> failedMap)
Convert map of step execution results keyed by step number, to a collection of step execution results keyed by node name- Parameters:
failedMap- failures- Returns:
- converted
-
nodeStepResultFromNodeStepException
protected static NodeStepResult nodeStepResultFromNodeStepException(INodeEntry node, NodeStepException nodeStepException)
- Parameters:
node- nodenodeStepException- exception- Returns:
- a failure result with components from an exception
-
createPrintableDataContext
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> createPrintableDataContext(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> dataContext)
Creates a copy of the given data context with the secure option values obfuscated. This does not modify the original data context. "secureOption" map values will always be obfuscated. "option" entries that are also in "secureOption" will have their values obfuscated. All other maps within the data context will be added directly to the copy.- Parameters:
dataContext- data- Returns:
- printable data
-
createPrintableDataContext
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> createPrintableDataContext(java.lang.String optionKey, java.lang.String secureOptionKey, java.lang.String secureOptionValue, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> dataContext)Creates a copy of the given data context with the secure option values obfuscated. This does not modify the original data context. "secureOption" map values will always be obfuscated. "option" entries that are also in "secureOption" will have their values obfuscated. All other maps within the data context will be added directly to the copy.- Parameters:
optionKey- keysecureOptionKey- secure keysecureOptionValue- secure valuedataContext- data- Returns:
- printable data
-
executeWorkflowStep
public BaseWorkflowExecutor.StepResultCapture executeWorkflowStep(StepExecutionContext executionContext, java.util.Map<java.lang.Integer,StepExecutionResult> failedMap, java.util.List<StepExecutionResult> resultList, boolean keepgoing, WorkflowExecutionListener wlistener, int c, StepExecutionItem cmd)
Execute a step and handle flow control and error handler and log filter.- Parameters:
executionContext- contextfailedMap- map for placing failure resultsresultList- list of step resultskeepgoing- true if the workflow should keepgoing on errorwlistener- listenerc- step numbercmd- step- Returns:
- result and flow control
-
combineResultData
public void combineResultData(int c, DataOutput outputContext, WFSharedContext combinedResultData, StepExecutionResult handlerResult)
-
reportNodesMatched
public void reportNodesMatched(StepExecutionContext executionContext, NodeRecorder stepCaptureFailedNodesListener)
-
validateNodeSet
protected void validateNodeSet(ExecutionContext executionContext, NodesSelector nodeSelector)
-
combineNodeResultData
public void combineNodeResultData(int c, StepExecutionResult stepResult, WFSharedContext combinedResultData)
-
-