Search in sources :

Example 1 with Script

use of com.hortonworks.streamline.streams.runtime.script.Script in project streamline by hortonworks.

the class RuleProcessorRuntime method initializeRuleRuntimes.

private void initializeRuleRuntimes(Map<String, Object> config) {
    List<Rule> rules = rulesProcessor.getRules();
    if (rules != null) {
        for (Rule rule : rules) {
            RuleRuntime ruleRuntime;
            Script script = null;
            if (ScriptType.GROOVY.equals(scriptType)) {
                script = createGroovyScript(rule);
            } else if (ScriptType.SQL.equals(scriptType)) {
                script = createSqlScript(rule);
            } else {
                throw new RuntimeException("Ruleruntime scriptType unsupported: " + scriptType);
            }
            ruleRuntime = new RuleRuntime(rule, script, createActionRuntimes(rule));
            rulesRuntime.add(ruleRuntime);
            ruleRuntime.initialize(config);
        }
        LOG.info("ruleRuntimes [{}]", rulesRuntime);
    }
}
Also used : Script(com.hortonworks.streamline.streams.runtime.script.Script) GroovyScript(com.hortonworks.streamline.streams.runtime.script.GroovyScript) SqlScript(com.hortonworks.streamline.streams.runtime.rule.sql.SqlScript) Rule(com.hortonworks.streamline.streams.layout.component.rule.Rule) RuleRuntime(com.hortonworks.streamline.streams.runtime.rule.RuleRuntime)

Aggregations

Rule (com.hortonworks.streamline.streams.layout.component.rule.Rule)1 RuleRuntime (com.hortonworks.streamline.streams.runtime.rule.RuleRuntime)1 SqlScript (com.hortonworks.streamline.streams.runtime.rule.sql.SqlScript)1 GroovyScript (com.hortonworks.streamline.streams.runtime.script.GroovyScript)1 Script (com.hortonworks.streamline.streams.runtime.script.Script)1