Class S3SyncProcessor
- java.lang.Object
-
- org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.aws.AbstractS3Processor
-
- org.craftercms.deployer.impl.processors.aws.S3SyncProcessor
-
- All Implemented Interfaces:
DeploymentProcessor
,InitializableByConfigBean
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
public class S3SyncProcessor extends AbstractS3Processor
Implementation ofDeploymentProcessor
that syncs files to an AWS S3 Bucket- Since:
- 3.1.0
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected String
blobExtension
The extension used for blob files in the repositorystatic String
CONFIG_KEY_IGNORE_BLOBS
protected boolean
ignoreBlobs
Indicates if blob files should not be uploaded to S3protected String
localRepoUrl
URL for the local git repository-
Fields inherited from class org.craftercms.deployer.impl.processors.aws.AbstractS3Processor
builderConfigurer, CONFIG_KEY_URL, DELIMITER, logger, MACRO_SITENAME, s3Url, threadPoolTaskExecutor
-
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 S3SyncProcessor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor threadPoolTaskExecutor, String localRepoUrl, String blobExtension)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
deleteFiles(com.amazonaws.services.s3.AmazonS3 client, List<String> files)
Performs the delete of the given files.protected 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 boolean
shouldIncludeFile(String file)
protected void
uploadFiles(com.amazonaws.services.s3.AmazonS3 client, List<String> paths)
Performs the upload of the given files.-
Methods inherited from class org.craftercms.deployer.impl.processors.aws.AbstractS3Processor
buildClient, buildTransferManager, doDestroy, getS3BaseKey, getS3Key
-
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, startJumpTo, supportsMode
-
-
-
-
Field Detail
-
CONFIG_KEY_IGNORE_BLOBS
public static final String CONFIG_KEY_IGNORE_BLOBS
- See Also:
- Constant Field Values
-
localRepoUrl
protected String localRepoUrl
URL for the local git repository
-
blobExtension
protected String blobExtension
The extension used for blob files in the repository
-
ignoreBlobs
protected boolean ignoreBlobs
Indicates if blob files should not be uploaded to S3
-
-
Constructor Detail
-
S3SyncProcessor
@ConstructorProperties({"threadPoolTaskExecutor","localRepoUrl","blobExtension"}) public S3SyncProcessor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor threadPoolTaskExecutor, String localRepoUrl, String blobExtension)
-
-
Method Detail
-
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException
Description copied from class:AbstractS3Processor
Allows extending classes perform any custom initialization- Overrides:
doInit
in classAbstractS3Processor
- Parameters:
config
- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException
- if there's configuration related exception
-
shouldIncludeFile
protected boolean shouldIncludeFile(String file)
- Overrides:
shouldIncludeFile
in classAbstractDeploymentProcessor
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException
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
-
uploadFiles
protected void uploadFiles(com.amazonaws.services.s3.AmazonS3 client, List<String> paths) throws DeployerException
Performs the upload of the given files.- Parameters:
client
- AWS S3 clientpaths
- list of files to upload- Throws:
DeployerException
- if there is any error reading or uploading the files
-
deleteFiles
protected void deleteFiles(com.amazonaws.services.s3.AmazonS3 client, List<String> files) throws DeployerException
Performs the delete of the given files.- Parameters:
client
- AWS S3 clientfiles
- list of files to delete- Throws:
DeployerException
- if there is any error deleting the files
-
-