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
DeploymentProcessor
s. 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 TypeMethodDescriptionvoid
destroy()
Destroys the processor, closing and releasing any used resources.protected abstract void
Allows extending classes perform any custom cleanupprotected abstract ChangeSet
doExecute
(Deployment deployment, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) Triggers the execution of the processor for the givenDeployment
andChangeSet
protected abstract void
doInit
(org.apache.commons.configuration2.Configuration config) Allows extending classes perform any custom initializationvoid
execute
(Deployment deployment) Executes the processorprotected Object
getDeploymentParam
(String param) Get a param from the current deploymentprotected ChangeSet
getFilteredChangeSet
(ChangeSet changeSet) void
init
(org.apache.commons.configuration2.Configuration config) Initializes the bean using the specified configuration.protected boolean
isJumpToActive
(Deployment deployment) boolean
Returns true if this processor runs after the deployment has finalized.void
setBeanName
(String name) Sets the bean name of the processor.void
Sets the environment of the site.void
setSiteName
(String siteName) Sets the site name.void
setTargetId
(String targetId) Sets the target ID.protected abstract boolean
shouldExecute
(Deployment deployment, ChangeSet filteredChangeSet) Indicates if the processor should be executed for the givenDeployment
andChangeSet
protected boolean
shouldIncludeFile
(String file) protected void
startJumpTo
(Deployment deployment) boolean
supportsMode
(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:
setBeanName
in interfaceorg.springframework.beans.factory.BeanNameAware
-
isPostDeployment
public boolean isPostDeployment()Description copied from interface:DeploymentProcessor
Returns true if this processor runs after the deployment has finalized.- Specified by:
isPostDeployment
in interfaceDeploymentProcessor
-
init
public void init(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException, DeployerException Description copied from interface:InitializableByConfigBean
Initializes the bean using the specified configuration.- Specified by:
init
in 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:DeploymentProcessor
Destroys the processor, closing and releasing any used resources.- Specified by:
destroy
in interfaceDeploymentProcessor
- Throws:
DeployerException
- if an error occurs
-
supportsMode
Description copied from interface:DeploymentProcessor
Indicates if the processor should be included in the given deployment mode- Specified by:
supportsMode
in interfaceDeploymentProcessor
- Parameters:
mode
- the deployment mode to check- Returns:
- true if the processor should be included
-
execute
Description copied from interface:DeploymentProcessor
Executes the processor- Specified by:
execute
in 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 givenDeployment
andChangeSet
- Parameters:
deployment
- theDeployment
to checkfilteredChangeSet
- theChangeSet
to 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 givenDeployment
andChangeSet
- 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
ChangeSet
or null - Throws:
Exception
- if there is any error processing theChangeSet
-