Class 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 Detail

      • siteName

        protected String siteName
      • targetId

        protected String targetId
      • label

        protected String label
      • jumpTo

        protected String jumpTo
      • includeFiles

        protected String[] includeFiles
      • excludeFiles

        protected String[] excludeFiles
      • alwaysRun

        protected boolean alwaysRun
    • Constructor Detail

      • AbstractDeploymentProcessor

        public AbstractDeploymentProcessor()
    • Method Detail

      • setEnv

        public void setEnv​(String env)
        Sets the environment of the site.
      • setSiteName

        public void setSiteName​(String siteName)
        Sets the site name.
      • setTargetId

        public void setTargetId​(String targetId)
        Sets the target ID.
      • setBeanName

        public void setBeanName​(String name)
        Sets the bean name of the processor.
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
      • 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 interface InitializableByConfigBean
        Parameters:
        config - the bean's configuration
        Throws:
        org.craftercms.commons.config.ConfigurationException - if there's configuration related exception
        DeployerException - if there's a general exception on init
      • supportsMode

        public boolean supportsMode​(Deployment.Mode mode)
        Description copied from interface: DeploymentProcessor
        Indicates if the processor should be included in the given deployment mode
        Specified by:
        supportsMode in interface DeploymentProcessor
        Parameters:
        mode - the deployment mode to check
        Returns:
        true if the processor should be included
      • getFilteredChangeSet

        protected ChangeSet getFilteredChangeSet​(ChangeSet changeSet)
      • shouldIncludeFile

        protected boolean shouldIncludeFile​(String file)
      • isJumpToActive

        protected boolean isJumpToActive​(Deployment deployment)
      • startJumpTo

        protected void startJumpTo​(Deployment deployment)
      • shouldExecute

        protected abstract boolean shouldExecute​(Deployment deployment,
                                                 ChangeSet filteredChangeSet)
        Indicates if the processor should be executed for the given Deployment and ChangeSet
        Parameters:
        deployment - the Deployment to check
        filteredChangeSet - the ChangeSet 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 exception
        DeployerException - if there's a general exception on init
      • doDestroy

        protected abstract void doDestroy()
                                   throws DeployerException
        Allows extending classes perform any custom cleanup
        Throws:
        DeployerException - if an error occurs