Package org.camunda.bpm.engine.impl.cmd
Class DeployCmd
- java.lang.Object
-
- org.camunda.bpm.engine.impl.cmd.DeployCmd
-
- All Implemented Interfaces:
java.io.Serializable,Command<DeploymentWithDefinitions>
public class DeployCmd extends java.lang.Object implements Command<DeploymentWithDefinitions>, java.io.Serializable
- Author:
- Tom Baeyens, Joram Barrez, Thorben Lindhauer, Daniel Meyer
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DeploymentBuilderImpldeploymentBuilderprotected DeploymentHandlerdeploymentHandler
-
Constructor Summary
Constructors Constructor Description DeployCmd(DeploymentBuilderImpl deploymentBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacquireExclusiveLock(CommandContext commandContext)protected voidaddResources(java.util.List<ResourceEntity> resources, DeploymentBuilderImpl deploymentBuilder)protected voidcheckCreateAndReadDeployments(CommandContext commandContext, java.util.Set<java.lang.String> deploymentIds)protected voidcheckDuplicateResourceName(java.util.List<ResourceEntity> resources)protected voidcreateUserOperationLog(DeploymentBuilderImpl deploymentBuilder, Deployment deployment, CommandContext commandContext)protected voiddeploy(CommandContext commandContext, DeploymentEntity deployment)protected DeploymentWithDefinitionsdoExecute(CommandContext commandContext)protected voidensureDeploymentsWithIdsExists(java.util.Set<java.lang.String> expected, java.util.List<DeploymentEntity> actual)protected voidensureResourcesWithIdsExist(java.lang.String deploymentId, java.util.Set<java.lang.String> expectedIds, java.util.List<ResourceEntity> actual)protected voidensureResourcesWithKeysExist(java.lang.String deploymentId, java.util.Set<java.lang.String> expectedKeys, java.util.Map<java.lang.String,ResourceEntity> actual, java.lang.String valueProperty)protected voidensureResourcesWithNamesExist(java.lang.String deploymentId, java.util.Set<java.lang.String> expectedNames, java.util.List<ResourceEntity> actual)DeploymentWithDefinitionsexecute(CommandContext commandContext)protected java.util.Set<java.lang.String>getAllDeploymentIds(DeploymentBuilderImpl deploymentBuilder)protected java.util.List<? extends ProcessDefinition>getDeployedProcesses(CommandContext commandContext, DeploymentWithDefinitions deployment)protected java.util.List<java.lang.String>getMissingElements(java.util.Set<java.lang.String> expected, java.util.Map<java.lang.String,?> actual)protected java.lang.String[]getProcessDefinitionsFromResources(CommandContext commandContext, DeploymentEntity deploymentToRegister, java.util.Collection ignoredResources)protected java.util.List<ResourceEntity>getResources(DeploymentBuilderImpl deploymentBuilder, CommandContext commandContext)protected java.util.List<ResourceEntity>getResourcesByDeploymentId(java.util.Set<java.lang.String> deploymentIds, CommandContext commandContext)protected java.util.List<ResourceEntity>getResourcesById(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resourcesById, CommandContext commandContext)protected java.util.List<ResourceEntity>getResourcesByName(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resourcesByName, CommandContext commandContext)protected DeploymentEntityinitDeployment()protected booleanisBpmnResource(Resource resourceEntity)protected booleanisCmmnResource(Resource resourceEntity)booleanisRetryable()When CockroachDB is used, this command may be retried multiple times until it is successful, or the retries are exhausted.protected java.util.Set<java.lang.String>parseProcessDefinitionKeys(java.util.Collection<Resource> resources)protected ProcessApplicationRegistrationregisterProcessApplication(CommandContext commandContext, DeploymentEntity deploymentToRegister, CandidateDeployment candidateDeployment, java.util.Collection ignoredResources)protected voidregisterWithJobExecutor(CommandContext commandContext, Deployment deployment)protected java.util.Map<java.lang.String,ResourceEntity>resolveResourcesToDeploy(CommandContext commandContext, DeploymentEntity candidateDeployment)protected voidscheduleProcessDefinitionActivation(CommandContext commandContext, DeploymentWithDefinitions deployment)protected voidsetDeploymentName(java.lang.String deploymentId, DeploymentBuilderImpl deploymentBuilder, CommandContext commandContext)
-
-
-
Field Detail
-
deploymentBuilder
protected DeploymentBuilderImpl deploymentBuilder
-
deploymentHandler
protected DeploymentHandler deploymentHandler
-
-
Constructor Detail
-
DeployCmd
public DeployCmd(DeploymentBuilderImpl deploymentBuilder)
-
-
Method Detail
-
execute
public DeploymentWithDefinitions execute(CommandContext commandContext)
- Specified by:
executein interfaceCommand<DeploymentWithDefinitions>
-
doExecute
protected DeploymentWithDefinitions doExecute(CommandContext commandContext)
-
acquireExclusiveLock
protected void acquireExclusiveLock(CommandContext commandContext)
-
resolveResourcesToDeploy
protected java.util.Map<java.lang.String,ResourceEntity> resolveResourcesToDeploy(CommandContext commandContext, DeploymentEntity candidateDeployment)
-
deploy
protected void deploy(CommandContext commandContext, DeploymentEntity deployment)
-
scheduleProcessDefinitionActivation
protected void scheduleProcessDefinitionActivation(CommandContext commandContext, DeploymentWithDefinitions deployment)
-
registerProcessApplication
protected ProcessApplicationRegistration registerProcessApplication(CommandContext commandContext, DeploymentEntity deploymentToRegister, CandidateDeployment candidateDeployment, java.util.Collection ignoredResources)
-
registerWithJobExecutor
protected void registerWithJobExecutor(CommandContext commandContext, Deployment deployment)
-
createUserOperationLog
protected void createUserOperationLog(DeploymentBuilderImpl deploymentBuilder, Deployment deployment, CommandContext commandContext)
-
initDeployment
protected DeploymentEntity initDeployment()
-
setDeploymentName
protected void setDeploymentName(java.lang.String deploymentId, DeploymentBuilderImpl deploymentBuilder, CommandContext commandContext)
-
addResources
protected void addResources(java.util.List<ResourceEntity> resources, DeploymentBuilderImpl deploymentBuilder)
-
getMissingElements
protected java.util.List<java.lang.String> getMissingElements(java.util.Set<java.lang.String> expected, java.util.Map<java.lang.String,?> actual)
-
getResources
protected java.util.List<ResourceEntity> getResources(DeploymentBuilderImpl deploymentBuilder, CommandContext commandContext)
-
getResourcesByDeploymentId
protected java.util.List<ResourceEntity> getResourcesByDeploymentId(java.util.Set<java.lang.String> deploymentIds, CommandContext commandContext)
-
getResourcesById
protected java.util.List<ResourceEntity> getResourcesById(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resourcesById, CommandContext commandContext)
-
getResourcesByName
protected java.util.List<ResourceEntity> getResourcesByName(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resourcesByName, CommandContext commandContext)
-
getDeployedProcesses
protected java.util.List<? extends ProcessDefinition> getDeployedProcesses(CommandContext commandContext, DeploymentWithDefinitions deployment)
-
getProcessDefinitionsFromResources
protected java.lang.String[] getProcessDefinitionsFromResources(CommandContext commandContext, DeploymentEntity deploymentToRegister, java.util.Collection ignoredResources)
-
parseProcessDefinitionKeys
protected java.util.Set<java.lang.String> parseProcessDefinitionKeys(java.util.Collection<Resource> resources)
-
getAllDeploymentIds
protected java.util.Set<java.lang.String> getAllDeploymentIds(DeploymentBuilderImpl deploymentBuilder)
-
checkDuplicateResourceName
protected void checkDuplicateResourceName(java.util.List<ResourceEntity> resources)
-
checkCreateAndReadDeployments
protected void checkCreateAndReadDeployments(CommandContext commandContext, java.util.Set<java.lang.String> deploymentIds)
-
isBpmnResource
protected boolean isBpmnResource(Resource resourceEntity)
-
isCmmnResource
protected boolean isCmmnResource(Resource resourceEntity)
-
ensureDeploymentsWithIdsExists
protected void ensureDeploymentsWithIdsExists(java.util.Set<java.lang.String> expected, java.util.List<DeploymentEntity> actual)
-
ensureResourcesWithIdsExist
protected void ensureResourcesWithIdsExist(java.lang.String deploymentId, java.util.Set<java.lang.String> expectedIds, java.util.List<ResourceEntity> actual)
-
ensureResourcesWithNamesExist
protected void ensureResourcesWithNamesExist(java.lang.String deploymentId, java.util.Set<java.lang.String> expectedNames, java.util.List<ResourceEntity> actual)
-
ensureResourcesWithKeysExist
protected void ensureResourcesWithKeysExist(java.lang.String deploymentId, java.util.Set<java.lang.String> expectedKeys, java.util.Map<java.lang.String,ResourceEntity> actual, java.lang.String valueProperty)
-
isRetryable
public boolean isRetryable()
When CockroachDB is used, this command may be retried multiple times until it is successful, or the retries are exhausted. CockroachDB uses a stricter, SERIALIZABLE transaction isolation which ensures a serialized manner of transaction execution. A concurrent transaction that attempts to modify the same data as another transaction is required to abort, rollback and retry. This also makes our use-case of pessimistic locks redundant since we only use them as synchronization barriers, and not to lock actual data which would protect it from concurrent modifications. The Deploy command only executes internal code, so we are certain that a retry of a failed deployment will not impact user data, and may be performed multiple times.- Specified by:
isRetryablein interfaceCommand<DeploymentWithDefinitions>- Returns:
- true if the
CrdbTransactionRetryInterceptorcan make a transparent retry of this command upon failure with aCrdbTransactionRetryException(only used when running on CockroachDB).
-
-