Index: src/main/java/info/magnolia/module/workflow/WorkflowModule.java =================================================================== --- src/main/java/info/magnolia/module/workflow/WorkflowModule.java (revision 17380) +++ src/main/java/info/magnolia/module/workflow/WorkflowModule.java (working copy) @@ -34,9 +34,8 @@ package info.magnolia.module.workflow; import info.magnolia.cms.util.FactoryUtil; -import info.magnolia.content2bean.Content2BeanException; -import info.magnolia.content2bean.Content2BeanUtil; -import info.magnolia.module.admininterface.AbstractAdminModule; +import info.magnolia.module.ModuleLifecycle; +import info.magnolia.module.ModuleLifecycleContext; import info.magnolia.module.workflow.flows.FlowDefinitionManager; import info.magnolia.module.workflow.jcr.JCRPersistedEngine; import info.magnolia.module.workflow.jcr.JCRWorkItemStore; @@ -55,7 +54,7 @@ * @author Nicolas Modrzyk * @version 3.0 */ -public class WorkflowModule extends AbstractAdminModule { +public class WorkflowModule implements ModuleLifecycle { private static final Logger log = LoggerFactory.getLogger(WorkflowModule.class); @@ -77,6 +76,30 @@ * Use life time jcr sessions or a session per operation */ private boolean useLifeTimeJCRSession = true; + + + public void start(ModuleLifecycleContext moduleLifecycleContext) { + instance = this; + startEngine(); + initializeWorkItemStore(); + } + + public void stop(ModuleLifecycleContext moduleLifecycleContext) { + JCRPersistedEngine engine = getEngine(); + if (engine != null && engine.isRunning()) { + log.info("Stopping workflow engine.."); + try { + // before try to stop purge and scheduling tasks + // TODO : this is already done by engine.stop() ... ? + ((SimpleExpressionPool) engine.getExpressionPool()).stop(); + engine.stop(); + } + catch (ServiceException se) { + log.error("Failed to stop Open WFE engine"); + log.error(se.getMessage(), se); + } + } + } /** * Cleanup empty parent nodes (for expressions, workitems) @@ -83,18 +106,6 @@ */ private boolean cleanup = true; - protected void onInit() { - try { - Content2BeanUtil.setProperties(this, getConfigNode()); - } - catch (Content2BeanException e) { - log.error("can't initialize workflow module",e); - } - instance = this; - startEngine(); - initializeWorkItemStore(); - } - protected void startEngine() { try { log.info("Starting openwfe engine"); @@ -118,23 +129,6 @@ } } - public void destroy() { - JCRPersistedEngine engine = getEngine(); - if (engine != null && engine.isRunning()) { - log.info("Stopping workflow engine.."); - try { - // before try to stop purge and scheduling tasks - // TODO : this is already done by engine.stop() ... ? - ((SimpleExpressionPool) engine.getExpressionPool()).stop(); - engine.stop(); - } - catch (ServiceException se) { - log.error("Failed to stop Open WFE engine"); - log.error(se.getMessage(), se); - } - } - } - /** * return the global work flow engine */