public abstract class AbstractDefinitionDeployer<DefinitionEntity extends ResourceDefinitionEntity> extends Object implements Deployer
Deployer
responsible to parse resource files and create the proper entities.
This class is extended by specific resource deployers.
Note: Implementations must be thread-safe. In particular they should not keep deployment-specific state.Modifier and Type | Field and Description |
---|---|
static String[] |
DIAGRAM_SUFFIXES |
protected IdGenerator |
idGenerator |
Constructor and Description |
---|
AbstractDefinitionDeployer() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addDefinitionToDeploymentCache(DeploymentCache deploymentCache,
DefinitionEntity definition)
Add a definition to the deployment cache
|
protected void |
definitionAddedToDeploymentCache(DeploymentEntity deployment,
DefinitionEntity definition,
Properties properties)
Called after a definition was added to the deployment cache.
|
void |
deploy(DeploymentEntity deployment) |
protected void |
ensureNoDuplicateDefinitionKeys(List<DefinitionEntity> definitions) |
protected abstract DefinitionEntity |
findDefinitionByDeploymentAndKey(String deploymentId,
String definitionKey)
Find a definition entity by deployment id and definition key.
|
protected abstract DefinitionEntity |
findLatestDefinitionByKeyAndTenantId(String definitionKey,
String tenantId)
Find the last deployed definition entity by definition key and tenant id.
|
protected String |
generateDefinitionId(DeploymentEntity deployment,
DefinitionEntity newDefinition,
DefinitionEntity latestDefinition)
create an id for the definition.
|
protected CommandContext |
getCommandContext() |
protected String |
getDefinitionDiagramResourceName(String resourceName,
DefinitionEntity definition,
String diagramSuffix) |
protected DeploymentCache |
getDeploymentCache() |
protected String |
getDiagramResourceForDefinition(DeploymentEntity deployment,
String resourceName,
DefinitionEntity definition,
Map<String,ResourceEntity> resources)
Returns the default name of the image resource for a certain definition.
|
protected String[] |
getDiagramSuffixes() |
protected String |
getGeneralDiagramResourceName(String resourceName,
DefinitionEntity definition,
String diagramSuffix) |
IdGenerator |
getIdGenerator() |
protected int |
getNextVersion(DeploymentEntity deployment,
DefinitionEntity newDefinition,
DefinitionEntity latestDefinition)
per default we increment the latest definition version by one - but you
might want to hook in some own logic here, e.g.
|
protected ProcessEngineConfigurationImpl |
getProcessEngineConfiguration() |
protected abstract String[] |
getResourcesSuffixes() |
protected void |
handlePersistedDefinition(DefinitionEntity definition,
DefinitionEntity persistedDefinition,
DeploymentEntity deployment,
Properties properties) |
protected boolean |
isResourceHandled(ResourceEntity resource) |
protected void |
loadDefinitions(DeploymentEntity deployment,
List<DefinitionEntity> definitions,
Properties properties) |
protected List<DefinitionEntity> |
parseDefinitionResources(DeploymentEntity deployment,
Properties properties) |
protected abstract void |
persistDefinition(DefinitionEntity definition)
Persist definition entity into the database.
|
protected void |
persistDefinitions(DeploymentEntity deployment,
List<DefinitionEntity> definitions,
Properties properties) |
protected void |
persistedDefinitionLoaded(DeploymentEntity deployment,
DefinitionEntity definition,
DefinitionEntity persistedDefinition)
Called when a previous version of a definition was loaded from the persistent store.
|
protected void |
postProcessDefinitions(DeploymentEntity deployment,
List<DefinitionEntity> definitions,
Properties properties) |
protected void |
registerDefinition(DeploymentEntity deployment,
DefinitionEntity definition,
Properties properties) |
void |
setIdGenerator(IdGenerator idGenerator) |
protected String |
stripDefinitionFileSuffix(String resourceName) |
protected abstract List<DefinitionEntity> |
transformDefinitions(DeploymentEntity deployment,
ResourceEntity resource,
Properties properties)
Transform the resource entity into definition entities.
|
protected Collection<DefinitionEntity> |
transformResource(DeploymentEntity deployment,
ResourceEntity resource,
Properties properties) |
protected void |
updateDefinitionByLatestDefinition(DeploymentEntity deployment,
DefinitionEntity definition,
DefinitionEntity latestDefinition) |
protected void |
updateDefinitionByPersistedDefinition(DeploymentEntity deployment,
DefinitionEntity definition,
DefinitionEntity persistedDefinition) |
public static final String[] DIAGRAM_SUFFIXES
protected IdGenerator idGenerator
public IdGenerator getIdGenerator()
public void setIdGenerator(IdGenerator idGenerator)
public void deploy(DeploymentEntity deployment)
protected List<DefinitionEntity> parseDefinitionResources(DeploymentEntity deployment, Properties properties)
protected boolean isResourceHandled(ResourceEntity resource)
protected abstract String[] getResourcesSuffixes()
protected Collection<DefinitionEntity> transformResource(DeploymentEntity deployment, ResourceEntity resource, Properties properties)
protected abstract List<DefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties)
deployment
- the deployment the resources belongs toresource
- the resource to transformprotected String getDiagramResourceForDefinition(DeploymentEntity deployment, String resourceName, DefinitionEntity definition, Map<String,ResourceEntity> resources)
protected String getDefinitionDiagramResourceName(String resourceName, DefinitionEntity definition, String diagramSuffix)
protected String getGeneralDiagramResourceName(String resourceName, DefinitionEntity definition, String diagramSuffix)
protected String[] getDiagramSuffixes()
protected void ensureNoDuplicateDefinitionKeys(List<DefinitionEntity> definitions)
protected void postProcessDefinitions(DeploymentEntity deployment, List<DefinitionEntity> definitions, Properties properties)
protected void persistDefinitions(DeploymentEntity deployment, List<DefinitionEntity> definitions, Properties properties)
protected void updateDefinitionByLatestDefinition(DeploymentEntity deployment, DefinitionEntity definition, DefinitionEntity latestDefinition)
protected void loadDefinitions(DeploymentEntity deployment, List<DefinitionEntity> definitions, Properties properties)
protected void handlePersistedDefinition(DefinitionEntity definition, DefinitionEntity persistedDefinition, DeploymentEntity deployment, Properties properties)
protected void updateDefinitionByPersistedDefinition(DeploymentEntity deployment, DefinitionEntity definition, DefinitionEntity persistedDefinition)
protected void persistedDefinitionLoaded(DeploymentEntity deployment, DefinitionEntity definition, DefinitionEntity persistedDefinition)
deployment
- the deployment of the definitiondefinition
- the definition entitypersistedDefinition
- the loaded definition entityprotected abstract DefinitionEntity findDefinitionByDeploymentAndKey(String deploymentId, String definitionKey)
deploymentId
- the deployment iddefinitionKey
- the definition keyprotected abstract DefinitionEntity findLatestDefinitionByKeyAndTenantId(String definitionKey, String tenantId)
protected abstract void persistDefinition(DefinitionEntity definition)
definition
- the definition entityprotected void registerDefinition(DeploymentEntity deployment, DefinitionEntity definition, Properties properties)
protected abstract void addDefinitionToDeploymentCache(DeploymentCache deploymentCache, DefinitionEntity definition)
deploymentCache
- the deployment cachedefinition
- the definition to addprotected void definitionAddedToDeploymentCache(DeploymentEntity deployment, DefinitionEntity definition, Properties properties)
deployment
- the deployment of the definitiondefinition
- the definition entityprotected int getNextVersion(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition)
protected String generateDefinitionId(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition)
IdGenerator
and add the definition key and version if that does not exceed 64 characters.
You might want to hook in your own implementation here.protected ProcessEngineConfigurationImpl getProcessEngineConfiguration()
protected CommandContext getCommandContext()
protected DeploymentCache getDeploymentCache()
Copyright © 2017. All rights reserved.