Class PipelineBuilder

java.lang.Object
nz.org.riskscape.rl.ExpressionParser
nz.org.riskscape.engine.pipeline.PipelineBuilder

public class PipelineBuilder extends nz.org.riskscape.rl.ExpressionParser

Traverses a PipelineDeclaration to produce a Pipeline.

TODO revist all of these error messages, including the nesting, as part of GL#470

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields inherited from class nz.org.riskscape.rl.ExpressionParser

    IDENTIFIERS, INSTANCE, KEY_IDENTIFIERS, LEADING_TOKENS, LITERALS
  • Constructor Summary

    Constructors
    Constructor
    Description
    PipelineBuilder(nz.org.riskscape.engine.bind.BindingContext context)
    Construct a pipeline builder from the given context, looking up available steps from the context
    PipelineBuilder(nz.org.riskscape.engine.pipeline.PipelineSteps availableSteps, nz.org.riskscape.engine.bind.BindingContext bindingContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.pipeline.Pipeline>
    buildPipeline(nz.org.riskscape.engine.resource.Resource source)
    Parse the pipeline from the given resource
    nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.pipeline.Pipeline>
    buildPipeline(nz.org.riskscape.pipeline.ast.PipelineDeclaration ast, String resourceName)
    Build a pipeline from the given AST.
    nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.pipeline.Pipeline>
    buildPipeline(nz.org.riskscape.pipeline.ast.PipelineDeclaration ast, nz.org.riskscape.engine.resource.Resource pipelineSource)
    Builds a Pipeline from ast.
    void
    toDsl(nz.org.riskscape.engine.pipeline.Pipeline pipeline, PrintStream writer)
    Writes the Pipelines definition in Pipeline DSL format to the print writer

    Methods inherited from class nz.org.riskscape.rl.ExpressionParser

    checkForParameters, lex, parse, parseAllowParameters, parseExpression, parseFunctionExpression, parseOr, parsePropertyExpression, parseString, toList, toStruct

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PipelineBuilder

      public PipelineBuilder(nz.org.riskscape.engine.bind.BindingContext context)

      Construct a pipeline builder from the given context, looking up available steps from the context

    • PipelineBuilder

      public PipelineBuilder(nz.org.riskscape.engine.pipeline.PipelineSteps availableSteps, nz.org.riskscape.engine.bind.BindingContext bindingContext)
  • Method Details

    • buildPipeline

      public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.pipeline.Pipeline> buildPipeline(nz.org.riskscape.pipeline.ast.PipelineDeclaration ast, String resourceName)

      Build a pipeline from the given AST.

      Parameters:
      ast - the AST to build
      resourceName - something sensible to display in any pipeline errors. This should be a valid URI (i.e. have dashes, not spaces)
      Returns:
      built pipeline or problems encountered
    • buildPipeline

      public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.pipeline.Pipeline> buildPipeline(nz.org.riskscape.pipeline.ast.PipelineDeclaration ast, nz.org.riskscape.engine.resource.Resource pipelineSource)

      Builds a Pipeline from ast.

      Parameters:
      ast - pipeline declaration
      pipelineSource - the resource that ast came from, used for problem locations
      Returns:
      built pipeline or problems encountered
    • buildPipeline

      public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.pipeline.Pipeline> buildPipeline(nz.org.riskscape.engine.resource.Resource source)

      Parse the pipeline from the given resource

      Parameters:
      source - a Resource to fetch text data from
      Returns:
      a Pipeline, or problems describing why parsing/building failed
    • toDsl

      public void toDsl(nz.org.riskscape.engine.pipeline.Pipeline pipeline, PrintStream writer)

      Writes the Pipelines definition in Pipeline DSL format to the print writer

      Parameters:
      pipeline - to write as pipeline DSL
      writer - to write to