Class CommandLineProcessor
- java.lang.Object
-
- org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.CommandLineProcessor
-
- All Implemented Interfaces:
DeploymentProcessor
,InitializableByConfigBean
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
public class CommandLineProcessor extends AbstractMainDeploymentProcessor
Processor that runs a command line process. A processor instance can be configured with the following YAML properties:- workingDir: The directory from which the process will run. (defaults to the deployer's folder)
- command: The full command that the process will run.
- processTimeoutSecs: The amount of seconds to wait for the process to finish. (defaults to 30)
-
includeChanges: Additional parameters will be added to the command. (defaults to false)
Example: script.sh SITE_NAME OPERATION (CREATE | UPDATE | DELETE) FILE (relative path of the file)
- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
COMMAND_CONFIG_KEY
protected static long
DEFAULT_PROCESS_TIMEOUT_SECS
protected static String
INCLUDE_CHANGES_CONFIG_KEY
static String
OPERATION_CREATE
static String
OPERATION_DELETE
static String
OPERATION_UPDATE
protected static String
PROCESS_TIMEOUT_SECS_CONFIG_KEY
protected static String
WORKING_DIR_CONFIG_KEY
-
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
FAIL_DEPLOYMENT_CONFIG_KEY, failDeploymentOnFailure
-
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
alwaysRun, env, excludeFiles, includeFiles, JUMPING_TO_PARAM_NAME, jumpTo, label, name, siteName, targetId
-
-
Constructor Summary
Constructors Constructor Description CommandLineProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doDestroy()
Allows extending classes perform any custom cleanupprotected void
doInit(org.apache.commons.configuration2.Configuration config)
Allows extending classes perform any custom initializationprotected ChangeSet
doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet)
protected void
executeProcess(String site, String operation, String file)
protected void
processFiles(String site, String operation, List<String> files)
-
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
doExecute, failDeploymentOnProcessorFailure, init, shouldExecute
-
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
destroy, execute, getFilteredChangeSet, isJumpToActive, isPostDeployment, setBeanName, setEnv, setSiteName, setTargetId, shouldIncludeFile, startJumpTo, supportsMode
-
-
-
-
Field Detail
-
OPERATION_CREATE
public static final String OPERATION_CREATE
- See Also:
- Constant Field Values
-
OPERATION_UPDATE
public static final String OPERATION_UPDATE
- See Also:
- Constant Field Values
-
OPERATION_DELETE
public static final String OPERATION_DELETE
- See Also:
- Constant Field Values
-
WORKING_DIR_CONFIG_KEY
protected static final String WORKING_DIR_CONFIG_KEY
- See Also:
- Constant Field Values
-
COMMAND_CONFIG_KEY
protected static final String COMMAND_CONFIG_KEY
- See Also:
- Constant Field Values
-
PROCESS_TIMEOUT_SECS_CONFIG_KEY
protected static final String PROCESS_TIMEOUT_SECS_CONFIG_KEY
- See Also:
- Constant Field Values
-
INCLUDE_CHANGES_CONFIG_KEY
protected static final String INCLUDE_CHANGES_CONFIG_KEY
- See Also:
- Constant Field Values
-
DEFAULT_PROCESS_TIMEOUT_SECS
protected static final long DEFAULT_PROCESS_TIMEOUT_SECS
- See Also:
- Constant Field Values
-
-
Method Detail
-
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException
Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom initialization- Specified by:
doInit
in classAbstractDeploymentProcessor
- Parameters:
config
- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException
- if there's configuration related exception
-
doDestroy
protected void doDestroy() throws DeployerException
Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom cleanup- Specified by:
doDestroy
in classAbstractDeploymentProcessor
- Throws:
DeployerException
- if an error occurs
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException
Description copied from class:AbstractMainDeploymentProcessor
Performs the actual work of processing the files in theChangeSet
, it is also possible to return a newChangeSet
to be used for the following processors in the pipeline- Specified by:
doMainProcess
in classAbstractMainDeploymentProcessor
- Parameters:
deployment
- the current deploymentexecution
- the current executionfilteredChangeSet
- the filtered change set (as returned byAbstractDeploymentProcessor.getFilteredChangeSet(ChangeSet)
)originalChangeSet
- the original change set (as returned by the previous processors in the pipeline)- Returns:
- a new
ChangeSet
or null - Throws:
DeployerException
- if there is any error processing theChangeSet
-
processFiles
protected void processFiles(String site, String operation, List<String> files) throws DeployerException
- Throws:
DeployerException
-
executeProcess
protected void executeProcess(String site, String operation, String file) throws DeployerException
- Throws:
DeployerException
-
-