use of io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager.TriggerInitFailedException in project TriggerReactor by wysohn.
the class Trigger method init.
/**
* @throws IOException low level exception from Lexer
* @throws LexerException throws if lexical analysis failed
* @throws ParserException throws if parsing failed
* @throws TriggerInitFailedException
*/
public void init() throws TriggerInitFailedException {
try {
if (script == null) {
throw new NullPointerException("init() was invoked, yet 'script' was null. Make sure to override " + "init() method to in order to construct a customized Trigger.");
}
Charset charset = StandardCharsets.UTF_8;
Lexer lexer = new Lexer(script, charset);
Parser parser = new Parser(lexer);
root = parser.parse(true);
List<Warning> warnings = parser.getWarnings();
AbstractTriggerManager.reportWarnings(warnings, this);
executorMap = TriggerReactorCore.getInstance().getExecutorManager().getBackedMap();
placeholderMap = TriggerReactorCore.getInstance().getPlaceholderManager().getBackedMap();
gvarMap = TriggerReactorCore.getInstance().getVariableManager().getGlobalVariableAdapter();
} catch (Exception ex) {
throw new TriggerInitFailedException("Failed to initialize Trigger [" + this.getClass().getSimpleName() + " -- " + info + "]!", ex);
}
}
Aggregations