04-13-2011 11:29 AM
Spring integration also has a special feature for deploying resources. In the process engine configuration, you can specify a set of resources. When the process engine is created, all those resources will be scanned and deployed. There is filtering in place that prevents duplicate deployments. Only when the resources actually have changed, will new deployments be deployed to the Activiti DB. This makes sense in a lot of use case, where the Spring container is rebooted often (eg testing).
public final class ContextListener
implements ServletContextListener {
private static final Logger logger = Logger.getLogger(ContextListener.class);
public void contextInitialized(ServletContextEvent event) {
//context = event.getServletContext();
try {
ProcessEngines.init();
Deployment deployment = ProcessEngines.getDefaultProcessEngine().getRepositoryService().createDeployment().addClasspathResource("org/me/gae/activiti/bpmn/simpleApprove.bpmn20.xml").enableDuplicateFiltering().name("simpleApprove").deploy();
logger.log(Priority.INFO,
"Deployment ID:" + deployment.getId() + " - " + deployment.getName() + " @" + deployment.getDeploymentTime());
} catch (Exception e) {
logger.log(Priority.FATAL, "Couldn't initialize Activiti Engine ", e);
}
….
04-14-2011 04:04 AM
04-14-2011 04:44 AM
Store the workflow xml on DB
use http://xmlunit.sourceforge.net/
if diferent load
else process is alrey deployed.
04-14-2011 05:01 AM
public Deployment execute(CommandContext commandContext) {
DeploymentEntity deployment = deploymentBuilder.getDeployment();
deployment.setDeploymentTime(ClockUtil.getCurrentTime());
if ( deploymentBuilder.isDuplicateFilterEnabled() ) {
DeploymentEntity existingDeployment = Context
.getCommandContext()
.getDeploymentManager()
.findLatestDeploymentByName(deployment.getName());
if ( (existingDeployment!=null)
&& !deploymentsDiffer(deployment, existingDeployment)) {
return existingDeployment;
}
}
04-14-2011 05:45 AM
04-14-2011 09:02 AM
try {
ProcessEngines.init();
Deployment deployment = ProcessEngines.getDefaultProcessEngine().getRepositoryService().createDeployment().enableDuplicateFiltering().addClasspathResource("org/me/gae/activiti/bpmn/simpleApprove.bpmn20.xml").name("simpleApprove").deploy();
logger.log(Priority.INFO,
"Deployment ID:" + deployment.getId() + " - " + deployment.getName() + " @" + deployment.getDeploymentTime());
} catch (Exception e) {
logger.log(Priority.FATAL, "Couldn't initialize Activiti Engine ", e);
}
INFO: ProcessEngine default created
14/Abr/2011 13:57:03 org.activiti.engine.ProcessEngines initProcessEnginFromResource
INFO: initialised process engine default
14/Abr/2011 13:57:08 org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource org/me/gae/activiti/bpmn/simpleApprove.bpmn20.xml
14/Abr/2011 13:57:09 org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XMLSchema currently not supported as typeLanguage
14/Abr/2011 13:57:09 org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XPath currently not supported as expressionLanguage
13:57:39,493 INFO ContextListener:43 - Deployment ID:1301 - simpleApprove @Thu Apr 14 13:57:07 WEST 2011
04-14-2011 02:12 PM
04-15-2011 04:41 AM
try {
ProcessEngines.init();
Deployment deployment = ProcessEngines.getDefaultProcessEngine().getRepositoryService().createDeployment().enableDuplicateFiltering().addClasspathResource("org/me/gae/activiti/bpmn/simpleApprove.bpmn20.xml").addClasspathResource("org/me/gae/activiti/bpmn/simpleApprove.png").name("simpleApprove").deploy();
logger.log(Priority.INFO,
"Deployment ID:" + deployment.getId() + " - " + deployment.getName() + " @" + deployment.getDeploymentTime());
} catch (Exception e) {
logger.log(Priority.FATAL, "Couldn't initialize Activiti Engine ", e);
}
04-15-2011 10:24 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.