use of org.smartdata.rule.parser.SmartRuleStringParser in project SSM by Intel-bigdata.
the class TestSmartRuleStringParser method parseRule.
private void parseRule(String rule) throws Exception {
TranslationContext tc = new TranslationContext(1, System.currentTimeMillis());
SmartRuleStringParser parser = new SmartRuleStringParser(rule, tc, new SmartConf());
TranslateResult tr = parser.translate();
int index = 1;
System.out.println("\n" + rule);
for (String sql : tr.getSqlStatements()) {
System.out.println("\t" + index + ". " + sql);
index++;
}
}
use of org.smartdata.rule.parser.SmartRuleStringParser in project SSM by Intel-bigdata.
the class RuleInfoRepo method doLaunchExecutor.
private RuleExecutor doLaunchExecutor(RuleManager ruleManager) throws IOException {
RuleState state = ruleInfo.getState();
if (state == RuleState.ACTIVE || state == RuleState.DRYRUN) {
if (executor != null && !executor.isExited()) {
return null;
}
ExecutionContext ctx = new ExecutionContext();
ctx.setRuleId(ruleInfo.getId());
TranslationContext transCtx = new TranslationContext(ruleInfo.getId(), ruleInfo.getSubmitTime());
TranslateResult tr = executor != null ? executor.getTranslateResult() : new SmartRuleStringParser(ruleInfo.getRuleText(), transCtx, conf).translate();
List<RuleExecutorPlugin> plugins = RuleExecutorPluginManager.getPlugins();
for (RuleExecutorPlugin plugin : plugins) {
plugin.onNewRuleExecutor(ruleInfo, tr);
}
executor = new RuleExecutor(ruleManager, ctx, tr, ruleManager.getMetaStore());
return executor;
}
return null;
}
Aggregations