Class AbstractDeploymentProcessor
java.lang.Object
org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
- All Implemented Interfaces:
DeploymentProcessor,InitializableByConfigBean,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware
- Direct Known Subclasses:
AbstractMainDeploymentProcessor,AbstractPostDeploymentProcessor
public abstract class AbstractDeploymentProcessor
extends Object
implements DeploymentProcessor, org.springframework.beans.factory.BeanNameAware
Base class for
DeploymentProcessors. Inclusion/exclusion of files is handled
by this class, through YAML configuration properties includeFiles and excludeFiles. So basically
each processor instance can have its own set of inclusions/exclusions.
This class also handles processor "jumping", which is triggered when a processor explicitly indicates that after a successful execution the pipeline should skip directly to executing a processor with a certain label.
It is also possible to make sure a processor is always executed even if the current ChangeSet is empty, this
can be accomplished with the alwaysRun property in the YAML configuration.
- Author:
- avasquez
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys the processor, closing and releasing any used resources.protected abstract voidAllows extending classes perform any custom cleanupprotected abstract ChangeSetdoExecute(Deployment deployment, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) Triggers the execution of the processor for the givenDeploymentandChangeSetprotected abstract voiddoInit(org.apache.commons.configuration2.Configuration config) Allows extending classes perform any custom initializationvoidexecute(Deployment deployment) Executes the processorprotected ObjectgetDeploymentParam(String param) Get a param from the current deploymentprotected ChangeSetgetFilteredChangeSet(ChangeSet changeSet) voidinit(org.apache.commons.configuration2.Configuration config) Initializes the bean using the specified configuration.protected booleanisJumpToActive(Deployment deployment) booleanReturns true if this processor runs after the deployment has finalized.voidsetBeanName(String name) Sets the bean name of the processor.voidSets the environment of the site.voidsetSiteName(String siteName) Sets the site name.voidsetTargetId(String targetId) Sets the target ID.protected abstract booleanshouldExecute(Deployment deployment, ChangeSet filteredChangeSet) Indicates if the processor should be executed for the givenDeploymentandChangeSetprotected booleanshouldIncludeFile(String file) protected voidstartJumpTo(Deployment deployment) booleansupportsMode(Deployment.Mode mode) Indicates if the processor should be included in the given deployment mode
-
Field Details
-
JUMPING_TO_PARAM_NAME
- See Also:
-
env
-
siteName
-
targetId
-
name
-
label
-
jumpTo
-
includeFiles
-
excludeFiles
-
alwaysRun
protected boolean alwaysRun
-
-
Constructor Details
-
AbstractDeploymentProcessor
public AbstractDeploymentProcessor()
-
-
Method Details
-
setEnv
Sets the environment of the site. -
setSiteName
Sets the site name. -
setTargetId
Sets the target ID. -
setBeanName
Sets the bean name of the processor.- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
isPostDeployment
public boolean isPostDeployment()Description copied from interface:DeploymentProcessorReturns true if this processor runs after the deployment has finalized.- Specified by:
isPostDeploymentin interfaceDeploymentProcessor
-
init
public void init(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException, DeployerException Description copied from interface:InitializableByConfigBeanInitializes the bean using the specified configuration.- Specified by:
initin interfaceInitializableByConfigBean- Parameters:
config- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException- if there's configuration related exceptionDeployerException- if there's a general exception on init
-
destroy
Description copied from interface:DeploymentProcessorDestroys the processor, closing and releasing any used resources.- Specified by:
destroyin interfaceDeploymentProcessor- Throws:
DeployerException- if an error occurs
-
supportsMode
Description copied from interface:DeploymentProcessorIndicates if the processor should be included in the given deployment mode- Specified by:
supportsModein interfaceDeploymentProcessor- Parameters:
mode- the deployment mode to check- Returns:
- true if the processor should be included
-
execute
Description copied from interface:DeploymentProcessorExecutes the processor- Specified by:
executein interfaceDeploymentProcessor- Parameters:
deployment- the current deployment info
-
getFilteredChangeSet
-
shouldIncludeFile
-
isJumpToActive
-
startJumpTo
-
getDeploymentParam
Get a param from the current deployment- Parameters:
param- the param name- Returns:
- the param value, or null if the param is not set or current deployment is null
-
shouldExecute
Indicates if the processor should be executed for the givenDeploymentandChangeSet- Parameters:
deployment- theDeploymentto checkfilteredChangeSet- theChangeSetto check- Returns:
- true if the processor should be executed
-
doInit
protected abstract void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException, DeployerException Allows extending classes perform any custom initialization- Parameters:
config- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException- if there's configuration related exceptionDeployerException- if there's a general exception on init
-
doDestroy
Allows extending classes perform any custom cleanup- Throws:
DeployerException- if an error occurs
-
doExecute
protected abstract ChangeSet doExecute(Deployment deployment, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws Exception Triggers the execution of the processor for the givenDeploymentandChangeSet- Parameters:
deployment- the current deploymentfilteredChangeSet- the filtered change set (as returned bygetFilteredChangeSet(ChangeSet))originalChangeSet- the original change set (as returned by the previous processors in the pipeline)- Returns:
- a new
ChangeSetor null - Throws:
Exception- if there is any error processing theChangeSet
-