Class BpmnDeployer
- java.lang.Object
-
- org.camunda.bpm.engine.impl.AbstractDefinitionDeployer<ProcessDefinitionEntity>
-
- org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer
-
- All Implemented Interfaces:
Deployer
public class BpmnDeployer extends AbstractDefinitionDeployer<ProcessDefinitionEntity>
Deployer
responsible to parse BPMN 2.0 XML files and create the properProcessDefinitionEntity
s. 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 ownBpmnParser
.- Author:
- Tom Baeyens, Joram Barrez, Bernd Ruecker
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
BPMN_RESOURCE_SUFFIXES
protected BpmnParser
bpmnParser
protected ExpressionManager
expressionManager
protected static PropertyMapKey<java.lang.String,java.util.List<JobDeclaration<?,?>>>
JOB_DECLARATIONS_PROPERTY
static BpmnParseLogger
LOG
-
Fields inherited from class org.camunda.bpm.engine.impl.AbstractDefinitionDeployer
DIAGRAM_SUFFIXES, idGenerator
-
-
Constructor Summary
Constructors Constructor Description BpmnDeployer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAuthorizations(ProcessDefinitionEntity processDefinition)
protected void
addAuthorizationsFromIterator(java.util.Set<Expression> exprSet, ProcessDefinitionEntity processDefinition, org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.ExprType exprType)
protected void
addConditionalStartEventSubscription(EventSubscriptionDeclaration conditionalEventDefinition, ProcessDefinitionEntity processDefinition)
protected void
addDefinitionToDeploymentCache(DeploymentCache deploymentCache, ProcessDefinitionEntity definition)
Add a definition to the deployment cacheprotected void
addEventSubscription(ProcessDefinitionEntity processDefinition, EventSubscriptionDeclaration eventDefinition)
void
addEventSubscriptions(ProcessDefinitionEntity processDefinition)
protected void
addMessageStartEventSubscription(EventSubscriptionDeclaration messageEventDefinition, ProcessDefinitionEntity processDefinition)
protected void
addSignalStartEventSubscription(EventSubscriptionDeclaration signalEventDefinition, 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
definitionAddedToDeploymentCache(DeploymentEntity deployment, ProcessDefinitionEntity definition, Properties properties)
Called after a definition was added to the deployment cache.protected java.util.List<EventSubscriptionEntity>
filterSubscriptionsOfDifferentType(EventSubscriptionDeclaration eventSubscription, java.util.List<EventSubscriptionEntity> subscriptionsForSameMessageName)
It is possible to deploy a process containing a start and intermediate message event that wait for the same message or to have two processes, one with a message start event and the other one with a message intermediate event, that subscribe for the same message.protected ProcessDefinitionEntity
findDefinitionByDeploymentAndKey(java.lang.String deploymentId, java.lang.String definitionKey)
Find a definition entity by deployment id and definition key.protected ProcessDefinitionEntity
findLatestDefinitionByKeyAndTenantId(java.lang.String definitionKey, java.lang.String tenantId)
Find the last deployed definition entity by definition key and tenant id.BpmnParser
getBpmnParser()
protected DbEntityManager
getDbEntityManager()
protected EventSubscriptionManager
getEventSubscriptionManager()
ExpressionManager
getExpressionManager()
protected JobDefinitionManager
getJobDefinitionManager()
protected JobManager
getJobManager()
protected java.util.List<EventSubscriptionEntity>
getOrphanSubscriptionEvents(ProcessDefinitionEntity processDefinition)
protected java.util.List<EventSubscriptionEntity>
getPreviousSubscriptionEvents(ProcessDefinitionEntity latestProcessDefinition)
protected ProcessDefinitionManager
getProcessDefinitionManager()
protected java.lang.String[]
getResourcesSuffixes()
DON'T KEEP DEPLOYMENT-SPECIFIC STATEprotected void
handlePersistedDefinition(ProcessDefinitionEntity definition, ProcessDefinitionEntity persistedDefinition, DeploymentEntity deployment, Properties properties)
protected boolean
hasTenantId(EventSubscriptionEntity cachedSubscription, java.lang.String tenantId)
protected boolean
isOrphan(EventSubscriptionEntity entity)
protected boolean
isSameMessageEventSubscriptionAlreadyPresent(EventSubscriptionDeclaration eventSubscription, java.lang.String tenantId)
protected boolean
isSubscriptionForIntermediateEvent(EventSubscriptionEntity subscriptionEntity)
protected boolean
isSubscriptionForStartEvent(EventSubscriptionEntity subscriptionEntity)
protected boolean
isSubscriptionOfDifferentTypeAsDeclaration(EventSubscriptionEntity subscriptionEntity, EventSubscriptionDeclaration declaration)
protected void
persistDefinition(ProcessDefinitionEntity definition)
Persist definition entity into the database.protected void
persistedDefinitionLoaded(DeploymentEntity deployment, ProcessDefinitionEntity definition, ProcessDefinitionEntity persistedDefinition)
Called when a previous version of a definition was loaded from the persistent store.protected void
removeObsoleteEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity latestProcessDefinition)
protected void
removeObsoleteTimers(ProcessDefinitionEntity processDefinition)
void
setBpmnParser(BpmnParser bpmnParser)
void
setExpressionManager(ExpressionManager expressionManager)
protected java.util.List<ProcessDefinitionEntity>
transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties)
Transform the resource entity into definition entities.protected void
updateJobDeclarations(java.util.List<JobDeclaration<?,?>> jobDeclarations, ProcessDefinitionEntity processDefinition, boolean isNewDeployment)
-
Methods inherited from class org.camunda.bpm.engine.impl.AbstractDefinitionDeployer
deploy, ensureNoDuplicateDefinitionKeys, generateDefinitionId, getCommandContext, getDefinitionDiagramResourceName, getDeploymentCache, getDiagramResourceForDefinition, getDiagramSuffixes, getGeneralDiagramResourceName, getIdGenerator, getNextVersion, getProcessEngineConfiguration, isResourceHandled, loadDefinitions, parseDefinitionResources, persistDefinitions, postProcessDefinitions, registerDefinition, setIdGenerator, stripDefinitionFileSuffix, transformResource, updateDefinitionByLatestDefinition, updateDefinitionByPersistedDefinition
-
-
-
-
Field Detail
-
LOG
public static BpmnParseLogger LOG
-
BPMN_RESOURCE_SUFFIXES
public static final java.lang.String[] BPMN_RESOURCE_SUFFIXES
-
JOB_DECLARATIONS_PROPERTY
protected static final PropertyMapKey<java.lang.String,java.util.List<JobDeclaration<?,?>>> JOB_DECLARATIONS_PROPERTY
-
expressionManager
protected ExpressionManager expressionManager
-
bpmnParser
protected BpmnParser bpmnParser
-
-
Method Detail
-
getResourcesSuffixes
protected java.lang.String[] getResourcesSuffixes()
DON'T KEEP DEPLOYMENT-SPECIFIC STATE- Specified by:
getResourcesSuffixes
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Returns:
- the list of resource suffixes for this cacheDeployer
-
transformDefinitions
protected java.util.List<ProcessDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties)
Description copied from class:AbstractDefinitionDeployer
Transform the resource entity into definition entities.- Specified by:
transformDefinitions
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Parameters:
deployment
- the deployment the resources belongs toresource
- the resource to transform- Returns:
- a list of transformed definition entities
-
findDefinitionByDeploymentAndKey
protected ProcessDefinitionEntity findDefinitionByDeploymentAndKey(java.lang.String deploymentId, java.lang.String definitionKey)
Description copied from class:AbstractDefinitionDeployer
Find a definition entity by deployment id and definition key.- Specified by:
findDefinitionByDeploymentAndKey
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Parameters:
deploymentId
- the deployment iddefinitionKey
- the definition key- Returns:
- the corresponding definition entity or null if non is found
-
findLatestDefinitionByKeyAndTenantId
protected ProcessDefinitionEntity findLatestDefinitionByKeyAndTenantId(java.lang.String definitionKey, java.lang.String tenantId)
Description copied from class:AbstractDefinitionDeployer
Find the last deployed definition entity by definition key and tenant id.- Specified by:
findLatestDefinitionByKeyAndTenantId
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Returns:
- the corresponding definition entity or null if non is found
-
persistDefinition
protected void persistDefinition(ProcessDefinitionEntity definition)
Description copied from class:AbstractDefinitionDeployer
Persist definition entity into the database.- Specified by:
persistDefinition
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Parameters:
definition
- the definition entity
-
addDefinitionToDeploymentCache
protected void addDefinitionToDeploymentCache(DeploymentCache deploymentCache, ProcessDefinitionEntity definition)
Description copied from class:AbstractDefinitionDeployer
Add a definition to the deployment cache- Specified by:
addDefinitionToDeploymentCache
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Parameters:
deploymentCache
- the deployment cachedefinition
- the definition to add
-
definitionAddedToDeploymentCache
protected void definitionAddedToDeploymentCache(DeploymentEntity deployment, ProcessDefinitionEntity definition, Properties properties)
Description copied from class:AbstractDefinitionDeployer
Called after a definition was added to the deployment cache.- Overrides:
definitionAddedToDeploymentCache
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Parameters:
deployment
- the deployment of the definitiondefinition
- the definition entity
-
persistedDefinitionLoaded
protected void persistedDefinitionLoaded(DeploymentEntity deployment, ProcessDefinitionEntity definition, ProcessDefinitionEntity persistedDefinition)
Description copied from class:AbstractDefinitionDeployer
Called when a previous version of a definition was loaded from the persistent store.- Overrides:
persistedDefinitionLoaded
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
- Parameters:
deployment
- the deployment of the definitiondefinition
- the definition entitypersistedDefinition
- the loaded definition entity
-
handlePersistedDefinition
protected void handlePersistedDefinition(ProcessDefinitionEntity definition, ProcessDefinitionEntity persistedDefinition, DeploymentEntity deployment, Properties properties)
- Overrides:
handlePersistedDefinition
in classAbstractDefinitionDeployer<ProcessDefinitionEntity>
-
updateJobDeclarations
protected void updateJobDeclarations(java.util.List<JobDeclaration<?,?>> jobDeclarations, ProcessDefinitionEntity 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.
-
addTimerDeclarations
protected void addTimerDeclarations(ProcessDefinitionEntity processDefinition)
-
removeObsoleteTimers
protected void removeObsoleteTimers(ProcessDefinitionEntity processDefinition)
-
removeObsoleteEventSubscriptions
protected void removeObsoleteEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity latestProcessDefinition)
-
getPreviousSubscriptionEvents
protected java.util.List<EventSubscriptionEntity> getPreviousSubscriptionEvents(ProcessDefinitionEntity latestProcessDefinition)
-
getOrphanSubscriptionEvents
protected java.util.List<EventSubscriptionEntity> getOrphanSubscriptionEvents(ProcessDefinitionEntity processDefinition)
-
isOrphan
protected boolean isOrphan(EventSubscriptionEntity entity)
-
addEventSubscriptions
public void addEventSubscriptions(ProcessDefinitionEntity processDefinition)
-
addEventSubscription
protected void addEventSubscription(ProcessDefinitionEntity processDefinition, EventSubscriptionDeclaration eventDefinition)
-
addMessageStartEventSubscription
protected void addMessageStartEventSubscription(EventSubscriptionDeclaration messageEventDefinition, ProcessDefinitionEntity processDefinition)
-
isSameMessageEventSubscriptionAlreadyPresent
protected boolean isSameMessageEventSubscriptionAlreadyPresent(EventSubscriptionDeclaration eventSubscription, java.lang.String tenantId)
-
hasTenantId
protected boolean hasTenantId(EventSubscriptionEntity cachedSubscription, java.lang.String tenantId)
-
filterSubscriptionsOfDifferentType
protected java.util.List<EventSubscriptionEntity> filterSubscriptionsOfDifferentType(EventSubscriptionDeclaration eventSubscription, java.util.List<EventSubscriptionEntity> subscriptionsForSameMessageName)
It is possible to deploy a process containing a start and intermediate message event that wait for the same message or to have two processes, one with a message start event and the other one with a message intermediate event, that subscribe for the same message. Therefore we have to find out if there are subscriptions for the other type of event and remove those.- Parameters:
eventSubscription
-subscriptionsForSameMessageName
-
-
isSubscriptionOfDifferentTypeAsDeclaration
protected boolean isSubscriptionOfDifferentTypeAsDeclaration(EventSubscriptionEntity subscriptionEntity, EventSubscriptionDeclaration declaration)
-
isSubscriptionForStartEvent
protected boolean isSubscriptionForStartEvent(EventSubscriptionEntity subscriptionEntity)
-
isSubscriptionForIntermediateEvent
protected boolean isSubscriptionForIntermediateEvent(EventSubscriptionEntity subscriptionEntity)
-
addSignalStartEventSubscription
protected void addSignalStartEventSubscription(EventSubscriptionDeclaration signalEventDefinition, ProcessDefinitionEntity processDefinition)
-
addConditionalStartEventSubscription
protected void addConditionalStartEventSubscription(EventSubscriptionDeclaration conditionalEventDefinition, ProcessDefinitionEntity processDefinition)
-
addAuthorizationsFromIterator
protected void addAuthorizationsFromIterator(java.util.Set<Expression> exprSet, ProcessDefinitionEntity processDefinition, org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer.ExprType exprType)
-
addAuthorizations
protected void addAuthorizations(ProcessDefinitionEntity processDefinition)
-
getDbEntityManager
protected DbEntityManager getDbEntityManager()
-
getJobManager
protected JobManager getJobManager()
-
getJobDefinitionManager
protected JobDefinitionManager getJobDefinitionManager()
-
getEventSubscriptionManager
protected EventSubscriptionManager getEventSubscriptionManager()
-
getProcessDefinitionManager
protected ProcessDefinitionManager getProcessDefinitionManager()
-
getExpressionManager
public ExpressionManager getExpressionManager()
-
setExpressionManager
public void setExpressionManager(ExpressionManager expressionManager)
-
getBpmnParser
public BpmnParser getBpmnParser()
-
setBpmnParser
public void setBpmnParser(BpmnParser bpmnParser)
-
-