Fixed ALF-9515: Activiti can no longer be disabled

Both Activiti and JBPM can now be "disabled" using the properties "system.workflow.engine.activiti.enabled" and "system.workflow.engine.jbpm.enabled", respectively. However, disabling JBPM is NOT recommended as several parts of the system are reliant on it. Furthermore, "disabled" just means the process definitions are not deployed and the engine is not registered with the WorkflowService, all DB tables etc. are still present. This means the engines can be disabled and re-enabled at will.

Also added back-end support for ALF-9392: More workflow metrics are required on the Workflow Console Admin Tool. An MBean is now available in Enterprise mode that provides the number of tasks, workflow definitions deployed and workflow instances in the system.

Added ENGINE_ID constant to JBPMEngine and globally replaced use of "jbpm" hard coded string.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29326 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2011-07-25 21:42:37 +00:00
parent a7b885a1c6
commit b3ce73691e
11 changed files with 274 additions and 89 deletions

View File

@@ -21,6 +21,7 @@ package org.alfresco.repo.workflow;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.service.cmr.workflow.WorkflowAdminService;
import org.alfresco.service.cmr.workflow.WorkflowException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -46,6 +47,8 @@ public class BPMEngineRegistry
/** Logging support */
private static Log logger = LogFactory.getLog("org.alfresco.repo.workflow");
private WorkflowAdminService workflowAdminService;
private Map<String, WorkflowComponent> workflowComponents;
private Map<String, TaskComponent> taskComponents;
@@ -58,6 +61,16 @@ public class BPMEngineRegistry
taskComponents = new HashMap<String, TaskComponent>();
}
/**
* Sets the workflow admin service
*
* @param workflowAdminService the workflow admin service
*/
public void setWorkflowAdminService(WorkflowAdminService workflowAdminService)
{
this.workflowAdminService = workflowAdminService;
}
/**
* Register a BPM Engine Workflow Component
*
@@ -70,10 +83,19 @@ public class BPMEngineRegistry
{
throw new WorkflowException("Workflow Component already registered for engine id '" + engineId + "'");
}
workflowComponents.put(engineId, engine);
if (logger.isInfoEnabled())
logger.info("Registered Workflow Component '" + engineId + "' (" + engine.getClass() + ")");
if (workflowAdminService.isEngineEnabled(engineId))
{
workflowComponents.put(engineId, engine);
if (logger.isDebugEnabled())
logger.debug("Registered Workflow Component '" + engineId + "' (" + engine.getClass() + ")");
}
else
{
if (logger.isWarnEnabled())
logger.warn("Ignoring Workflow Component '" + engineId + "' (" + engine.getClass() + ") as the engine is disabled");
}
}
/**
@@ -109,10 +131,19 @@ public class BPMEngineRegistry
{
throw new WorkflowException("Task Component already registered for engine id '" + engineId + "'");
}
taskComponents.put(engineId, engine);
if (logger.isInfoEnabled())
logger.info("Registered Task Component '" + engineId + "' (" + engine.getClass() + ")");
if (workflowAdminService.isEngineEnabled(engineId))
{
taskComponents.put(engineId, engine);
if (logger.isDebugEnabled())
logger.debug("Registered Task Component '" + engineId + "' (" + engine.getClass() + ")");
}
else
{
if (logger.isWarnEnabled())
logger.warn("Ignoring Task Component '" + engineId + "' (" + engine.getClass() + ") as the engine is disabled");
}
}
/**