org.camunda.bpm.engine.impl.bpmn.deployer
Class BpmnDeployer

java.lang.Object
  extended by org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer
All Implemented Interfaces:
Deployer

public class BpmnDeployer
extends Object
implements Deployer

Deployer responsible to parse BPMN 2.0 XML files and create the proper ProcessDefinitionEntitys. Overwrite this class if you want to gain some control over this mechanism, e.g. setting different version numbers, or you want to use your own BpmnParser.

Author:
Tom Baeyens, Joram Barrez, Bernd Ruecker

Field Summary
static String[] BPMN_RESOURCE_SUFFIXES
           
protected  BpmnParser bpmnParser
           
static String[] DIAGRAM_SUFFIXES
           
protected  ExpressionManager expressionManager
           
protected  IdGenerator idGenerator
           
 
Constructor Summary
BpmnDeployer()
           
 
Method Summary
protected  void addAuthorizations(ProcessDefinitionEntity processDefinition)
           
protected  void addMessageEventSubscriptions(ProcessDefinitionEntity processDefinition)
           
protected  void addTimerDeclarations(ProcessDefinitionEntity processDefinition)
           
protected  void adjustStartEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity oldLatestProcessDefinition)
          adjust all event subscriptions responsible to start process instances (timer start event, message start event).
protected  void createJobDefinition(ProcessDefinition processDefinition, JobDeclaration<?> jobDeclaration)
           
protected  void createResource(String name, byte[] bytes, DeploymentEntity deploymentEntity)
           
 void deploy(DeploymentEntity deployment)
           
protected  String getBpmnFileImageResourceName(String bpmnFileResource, String diagramSuffix)
           
 BpmnParser getBpmnParser()
           
protected  String getDiagramResourceForProcess(String bpmnFileResource, String processKey, Map<String,ResourceEntity> resources)
          Returns the default name of the image resource for a certain process.
 ExpressionManager getExpressionManager()
           
 IdGenerator getIdGenerator()
           
protected  String getProcessDefinitionId(DeploymentEntity deployment, ProcessDefinitionEntity processDefinition)
          create an id for the process definition.
protected  String getProcessImageResourceName(String bpmnFileResource, String processKey, String diagramSuffix)
           
protected  int getVersionForNewProcessDefinition(DeploymentEntity deployment, ProcessDefinitionEntity newProcessDefinition, ProcessDefinitionEntity latestProcessDefinition)
          per default we increment the latest process definition by one - but you might want to hook in some own logic here, e.g.
protected  boolean isBpmnResource(String resourceName)
           
protected  void removeObsoleteMessageEventSubscriptions(ProcessDefinitionEntity processDefinition, ProcessDefinitionEntity latestProcessDefinition)
           
protected  void removeObsoleteTimers(ProcessDefinitionEntity processDefinition)
           
 void setBpmnParser(BpmnParser bpmnParser)
           
 void setExpressionManager(ExpressionManager expressionManager)
           
 void setIdGenerator(IdGenerator idGenerator)
           
protected  String stripBpmnFileSuffix(String bpmnFileResource)
           
protected  void updateJobDeclarations(List<JobDeclaration<?>> jobDeclarations, ProcessDefinition processDefinition, boolean isNewDeployment)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BPMN_RESOURCE_SUFFIXES

public static final String[] BPMN_RESOURCE_SUFFIXES

DIAGRAM_SUFFIXES

public static final String[] DIAGRAM_SUFFIXES

expressionManager

protected ExpressionManager expressionManager

bpmnParser

protected BpmnParser bpmnParser

idGenerator

protected IdGenerator idGenerator
Constructor Detail

BpmnDeployer

public BpmnDeployer()
Method Detail

deploy

public void deploy(DeploymentEntity deployment)
Specified by:
deploy in interface Deployer

updateJobDeclarations

protected void updateJobDeclarations(List<JobDeclaration<?>> jobDeclarations,
                                     ProcessDefinition processDefinition,
                                     boolean isNewDeployment)

createJobDefinition

protected void createJobDefinition(ProcessDefinition processDefinition,
                                   JobDeclaration<?> jobDeclaration)

adjustStartEventSubscriptions

protected void adjustStartEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition,
                                             ProcessDefinitionEntity oldLatestProcessDefinition)
adjust all event subscriptions responsible to start process instances (timer start event, message start event). The default behavior is to remove the old subscriptions and add new ones for the new deployed process definitions.


getProcessDefinitionId

protected String getProcessDefinitionId(DeploymentEntity deployment,
                                        ProcessDefinitionEntity processDefinition)
create an id for the process definition. The default is to ask the IdGenerator and add the process definition key and version if that does not exceed 64 characters. You might want to hook in your own implemenation here.

Parameters:
deployment -

getVersionForNewProcessDefinition

protected int getVersionForNewProcessDefinition(DeploymentEntity deployment,
                                                ProcessDefinitionEntity newProcessDefinition,
                                                ProcessDefinitionEntity latestProcessDefinition)
per default we increment the latest process definition by one - but you might want to hook in some own logic here, e.g. to align process definition versions with deployment / build versions.


addTimerDeclarations

protected void addTimerDeclarations(ProcessDefinitionEntity processDefinition)

removeObsoleteTimers

protected void removeObsoleteTimers(ProcessDefinitionEntity processDefinition)

removeObsoleteMessageEventSubscriptions

protected void removeObsoleteMessageEventSubscriptions(ProcessDefinitionEntity processDefinition,
                                                       ProcessDefinitionEntity latestProcessDefinition)

addMessageEventSubscriptions

protected void addMessageEventSubscriptions(ProcessDefinitionEntity processDefinition)

addAuthorizations

protected void addAuthorizations(ProcessDefinitionEntity processDefinition)

getDiagramResourceForProcess

protected String getDiagramResourceForProcess(String bpmnFileResource,
                                              String processKey,
                                              Map<String,ResourceEntity> resources)
Returns the default name of the image resource for a certain process. It will first look for an image resource which matches the process specifically, before resorting to an image resource which matches the BPMN 2.0 xml file resource. Example: if the deployment contains a BPMN 2.0 xml resource called 'abc.bpmn20.xml' containing only one process with key 'myProcess', then this method will look for an image resources called 'abc.myProcess.png' (or .jpg, or .gif, etc.) or 'abc.png' if the previous one wasn't found. Example 2: if the deployment contains a BPMN 2.0 xml resource called 'abc.bpmn20.xml' containing three processes (with keys a, b and c), then this method will first look for an image resource called 'abc.a.png' before looking for 'abc.png' (likewise for b and c). Note that if abc.a.png, abc.b.png and abc.c.png don't exist, all processes will have the same image: abc.png.

Returns:
null if no matching image resource is found.

getBpmnFileImageResourceName

protected String getBpmnFileImageResourceName(String bpmnFileResource,
                                              String diagramSuffix)

getProcessImageResourceName

protected String getProcessImageResourceName(String bpmnFileResource,
                                             String processKey,
                                             String diagramSuffix)

stripBpmnFileSuffix

protected String stripBpmnFileSuffix(String bpmnFileResource)

createResource

protected void createResource(String name,
                              byte[] bytes,
                              DeploymentEntity deploymentEntity)

isBpmnResource

protected boolean isBpmnResource(String resourceName)

getExpressionManager

public ExpressionManager getExpressionManager()

setExpressionManager

public void setExpressionManager(ExpressionManager expressionManager)

getBpmnParser

public BpmnParser getBpmnParser()

setBpmnParser

public void setBpmnParser(BpmnParser bpmnParser)

getIdGenerator

public IdGenerator getIdGenerator()

setIdGenerator

public void setIdGenerator(IdGenerator idGenerator)


Copyright © 2014 camunda services GmbH. All Rights Reserved.