if (!WGWorkflowEngine.class.isAssignableFrom(engineClass)) {
throw new WGConfigurationException("Workflow engine class " + engineClass.getName() + " does not implement " + WGWorkflowEngine.class.getName());
}
try {
WGWorkflowEngine engine;
if (WGFactory.getModuleRegistry() != null) {
engine = (WGWorkflowEngine) WGFactory.getModuleRegistry().instantiate(engineClass);
}
else {
engine = (WGWorkflowEngine) engineClass.newInstance();
}
engine.init(this);
workflowEngine = engine;
}
catch (Exception e) {
throw new WGConfigurationException("Exception initializing workflow engine " + engineClass.getName(), e);