use of org.jaffa.soa.dataaccess.SOAEventLifecycleHandler in project jaffa-framework by jaffa-projects.
the class LifecycleHandlerConfig method addLifecycleHandler.
/**
* Create an instance of a lifecycle handler and add it to the factory as a prepended or appended handler.
*/
private void addLifecycleHandler(String ruleName, final RuleMetaData rule, String targetClassName) throws ClassNotFoundException {
ILifecycleHandlerFactory.ILifecycleHandlerProvider provider = null;
if (ruleName.equals(SoaEventRuleName)) {
provider = new ILifecycleHandlerFactory.ILifecycleHandlerProvider() {
@Override
public ILifecycleHandler getHandler() {
return new SOAEventLifecycleHandler(rule);
}
};
} else if (ruleName.equals(ScriptRuleName)) {
provider = new ILifecycleHandlerFactory.ILifecycleHandlerProvider() {
@Override
public ILifecycleHandler getHandler() {
return new ScriptLifecycleHandler(rule);
}
};
}
// if the handler is not defined, we are done here
if (provider == null) {
log.debug("No handler provider defined for rule: " + rule);
return;
}
// append or prepend based on the input flag
Boolean executeOnReturn = Parser.parseBoolean(rule.getParameter(RuleMetaData.PARAMETER_EXECUTE_ON_RETURN));
if (executeOnReturn) {
lifecycleHandlerFactory.addAppendedHandlerProvider(Class.forName(targetClassName), provider);
} else {
lifecycleHandlerFactory.addPrependedHandlerProvider(Class.forName(targetClassName), provider);
}
}
Aggregations