/** * Configures the pipeline based on the directives. It parses the recipe, * converting it into executable directives. * * @param parser Wrangle directives parser. */ @Override public void initialize(RecipeParser parser, ExecutorContext context) throws RecipeException { this.context = context; try { this.directives = parser.parse(); } catch (DirectiveParseException e) { throw new RecipeException(e.getMessage()); } catch (DirectiveNotFoundException | DirectiveLoadException e) { throw new RecipeException(e.getMessage(), e); } }
public RecipePipeline compile(List<String> recipe) throws RecipeException, DirectiveParseException, DirectiveLoadException, DirectiveNotFoundException { // Support only in-built directives. CompositeDirectiveRegistry registry = new CompositeDirectiveRegistry( new SystemDirectiveRegistry() ); String migrate = new MigrateToV2(recipe).migrate(); RecipeParser parser = new GrammarBasedParser(migrate, registry); parser.initialize(null); // No Directive Context. RecipePipeline pipeline = new RecipePipelineExecutor(); pipeline.initialize(parser, context); return pipeline; }