public CompositeRegistryIterator() { this.count = registries.length; this.idx = 0; this.iterator = registries[idx].iterator(); }
@Override public void reload() throws DirectiveLoadException { for(int idx = 0; idx < registries.length; ++idx) { registries[idx].reload(); } }
/** * This method provides a way to add a <code>Token</code> to the <code>TokenGroup</code>. * * @param token to be added to the token group. */ public void addToken(Token token) { group.add(token); }
/** * Constructor that extracts the {@link ExecutorContext} internals and turns them into variables. * This method extracts the trasient variables, runtime arguments, environment it's running in and * the context in which it is running as identifiers that can be used within JEXL expression. * * @param context to be examined to be extracted into JEXL expression variables. */ public ELContext(ExecutorContext context) { if (context == null) { return; } // Adds the transient store variables. for (String variable : context.getTransientStore().getVariables()) { values.put(variable, context.getTransientStore().get(variable)); } values.put("runtime", context.getProperties()); values.put("environment", context.getEnvironment().name()); values.put("context", context.getContextName()); }
/** * 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); } }
/** * Given a row, finds the length of the row. * * @param row length needs to be determined. * @return length of the row. */ public static int columns(Row row) { return row.length(); }
/** * Finds if the row has a column. * * @param row in which a column needs to be checked. * @param column name of the column to be checked. * @return true if column is not null and exists, false otherwise. */ public static boolean hascolumn(Row row, String column) { if (column == null) { return false; } return row.find(column) != -1 ? true : false; }
/** * Checks if the directive is being excluded from being used. * * @param directive to be checked for exclusion. * @return true if excluded, false otherwise. */ @Override public boolean isExcluded(String directive) { return config.isExcluded(directive); }
/** * Returns the root directive aliasee * @param directive * @return */ @Override public String getAlias(String directive) { return config.getAliasName(directive); }
/** * Returns a <code>RecipeSymbol</code> for the recipe being parsed. This * object has all the tokens that were successfully parsed along with source * information for each directive in the recipe. * * @return An compiled object after parsing the recipe. */ public RecipeSymbol getCompiledUnit() { return builder.build(); }
/** * Checks if the directive is aliased. * * @param directive to be checked for aliasing. * @return true if the directive has an alias, false otherwise. */ @Override public boolean hasAlias(String directive) { return config.hasAlias(directive); }
/** * Closes any resources acquired during initialization or otherwise. */ @Override public void close() throws IOException { for(int idx = 0; idx < registries.length; ++idx) { registries[idx].close(); } }
/** * Static method for creating an instance of the {@code RecipeSymbol.Builder}. * * @return a instance of builder. */ public static RecipeSymbol.Builder builder() { return new RecipeSymbol.Builder(); }
@Override public void initialize(Arguments args) throws DirectiveParseException { this.col = ((ColumnName) args.value("source")).value(); this.start = ((Numeric) args.value("start")).value().intValue(); this.end = ((Numeric) args.value("end")).value().intValue(); this.dest = ((ColumnName) args.value("destination")).value(); this.start = this.start - 1; this.end = this.end - 1; }