Class ChildPipelineBuilder
Helper class for realizing a child pipeline that gets 'smooshed' back in to a parent as part of realizing a step
-
Constructor Summary
ConstructorsConstructorDescriptionChildPipelineBuilder(nz.org.riskscape.engine.pipeline.RealizationInput input, nz.org.riskscape.rl.ast.PipelineDeclaration childAst) Constructs a new ChildPipelineBuilder for realizing and integrating a child pipeline into a parent pipeline. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInputStep(nz.org.riskscape.engine.pipeline.RealizedStep stepFromParent, String stubName) Adds an input step from the parent pipeline into the child pipeline by creating a stub step.nz.org.riskscape.engine.pipeline.RealizedPipelineaddWellKnownOutput(nz.org.riskscape.engine.pipeline.RealizedStep outputStep, List<nz.org.riskscape.problem.Problem> warnings) Adds a step to the combined pipeline named after the input's prototype step (so will have the expected name) for any dependencies that are chained to this step.protected booleannz.org.riskscape.engine.pipeline.RealizedPipelinecombine()Combines the realized child pipeline back into the parent pipeline.booleannz.org.riskscape.engine.pipeline.RealizedPipelinenz.org.riskscape.rl.ast.PipelineDeclarationnz.org.riskscape.engine.pipeline.RealizedStepgetChildInputStep(nz.org.riskscape.engine.pipeline.RealizedStep originalInputStep) Retrieves the stub step that was created in the child pipeline for a given parent input step.nz.org.riskscape.engine.pipeline.RealizedPipelinenz.org.riskscape.engine.pipeline.RealizationInputgetInput()Map<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> nz.org.riskscape.engine.pipeline.RealizedPipelineMap<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> nz.org.riskscape.engine.pipeline.RealizedStepgetRebuiltStep(nz.org.riskscape.engine.pipeline.RealizedStep childStep) nz.org.riskscape.engine.steps.ChildPipelineBuilder.StategetState()inthashCode()booleannz.org.riskscape.engine.pipeline.RealizedPipelineRealizes the child pipeline using the configured AST and input steps.voidsetBuilding(nz.org.riskscape.engine.pipeline.RealizedPipeline building) voidsetChildStepPrefix(String childStepPrefix) voidsetCombined(nz.org.riskscape.engine.pipeline.RealizedPipeline combined) voidsetRebuilt(Map<nz.org.riskscape.engine.pipeline.RealizedStep, nz.org.riskscape.engine.pipeline.RealizedStep> rebuilt) voidsetState(nz.org.riskscape.engine.steps.ChildPipelineBuilder.State state) toString()
-
Constructor Details
-
ChildPipelineBuilder
public ChildPipelineBuilder(nz.org.riskscape.engine.pipeline.RealizationInput input, nz.org.riskscape.rl.ast.PipelineDeclaration childAst) Constructs a new ChildPipelineBuilder for realizing and integrating a child pipeline into a parent pipeline.
- Parameters:
input- the realization input containing the parent pipeline and contextchildAst- the AST declaration of the child pipeline to be realized
-
-
Method Details
-
addInputStep
public void addInputStep(nz.org.riskscape.engine.pipeline.RealizedStep stepFromParent, String stubName) Adds an input step from the parent pipeline into the child pipeline by creating a stub step. The stub step mirrors the parent step's output schema but won't be executed during child pipeline realization.
- Parameters:
stepFromParent- the realized step from the parent pipeline to use as inputstubName- the name to give the stub step in the child pipeline - this is how the child pipeline will refer to it
-
getChildInputStep
public nz.org.riskscape.engine.pipeline.RealizedStep getChildInputStep(nz.org.riskscape.engine.pipeline.RealizedStep originalInputStep) Retrieves the stub step that was created in the child pipeline for a given parent input step.
- Parameters:
originalInputStep- the original step from the parent pipeline- Returns:
- the corresponding stub step in the child pipeline, or null if not found
-
realizeChild
public nz.org.riskscape.engine.pipeline.RealizedPipeline realizeChild()Realizes the child pipeline using the configured AST and input steps. This method must be called after all input steps have been added via
addInputStep(nz.org.riskscape.engine.pipeline.RealizedStep, java.lang.String).- Returns:
- the realized child pipeline, which may contain failures if realization encountered problems
-
combine
public nz.org.riskscape.engine.pipeline.RealizedPipeline combine()Combines the realized child pipeline back into the parent pipeline.
If the child pipeline failed to realize, a failure step is added to the resulting pipeline to represent those errors
All child steps are prefixed with the parent step name to ensure unique naming.
- Returns:
- the combined pipeline containing both parent and child steps
-
addWellKnownOutput
public nz.org.riskscape.engine.pipeline.RealizedPipeline addWellKnownOutput(nz.org.riskscape.engine.pipeline.RealizedStep outputStep, List<nz.org.riskscape.problem.Problem> warnings) Adds a step to the combined pipeline named after the input's prototype step (so will have the expected name) for any dependencies that are chained to this step.
-
getCombined
public nz.org.riskscape.engine.pipeline.RealizedPipeline getCombined() -
isChildFailed
public boolean isChildFailed()- Returns:
- true if the child pipeline has failures.
-
getRebuiltStep
public nz.org.riskscape.engine.pipeline.RealizedStep getRebuiltStep(nz.org.riskscape.engine.pipeline.RealizedStep childStep) - Returns:
- the step in combined pipeline that was rebuilt for the child step, i.e. it is the child step, but renamed and in the combined pipeline
-
getState
public nz.org.riskscape.engine.steps.ChildPipelineBuilder.State getState() -
getInput
public nz.org.riskscape.engine.pipeline.RealizationInput getInput() -
getParent
public nz.org.riskscape.engine.pipeline.RealizedPipeline getParent() -
getChildAst
public nz.org.riskscape.rl.ast.PipelineDeclaration getChildAst() -
getInputSteps
public Map<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> getInputSteps() -
getRebuilt
public Map<nz.org.riskscape.engine.pipeline.RealizedStep,nz.org.riskscape.engine.pipeline.RealizedStep> getRebuilt() -
getBuilding
public nz.org.riskscape.engine.pipeline.RealizedPipeline getBuilding() -
setState
public void setState(nz.org.riskscape.engine.steps.ChildPipelineBuilder.State state) -
setRebuilt
public void setRebuilt(Map<nz.org.riskscape.engine.pipeline.RealizedStep, nz.org.riskscape.engine.pipeline.RealizedStep> rebuilt) -
setBuilding
public void setBuilding(nz.org.riskscape.engine.pipeline.RealizedPipeline building) -
setCombined
public void setCombined(nz.org.riskscape.engine.pipeline.RealizedPipeline combined) -
setChildStepPrefix
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
getChildStepPrefix
-