Class StudioAwsS3BlobStore
java.lang.Object
org.craftercms.commons.file.blob.impl.AbstractBlobStore<org.craftercms.commons.config.profiles.aws.S3Profile>
org.craftercms.commons.file.blob.impl.s3.AwsS3BlobStore
org.craftercms.studio.impl.v2.repository.blob.s3.StudioAwsS3BlobStore
- All Implemented Interfaces:
org.craftercms.commons.file.blob.BlobStore,ContentRepository,StudioBlobStore,StudioBlobStoreAdapter,ContentRepository
public class StudioAwsS3BlobStore
extends org.craftercms.commons.file.blob.impl.s3.AwsS3BlobStore
implements StudioBlobStoreAdapter
Implementation of
StudioBlobStore for AWS S3- Since:
- 3.1.6
- Author:
- joseross
-
Nested Class Summary
Nested classes/interfaces inherited from class org.craftercms.commons.file.blob.impl.AbstractBlobStore
org.craftercms.commons.file.blob.impl.AbstractBlobStore.Mapping -
Field Summary
FieldsFields inherited from class org.craftercms.commons.file.blob.impl.s3.AwsS3BlobStore
asyncClientFactory, clientFactoryFields inherited from class org.craftercms.commons.file.blob.impl.AbstractBlobStore
id, mappings, pattern, profile, profileMapper, publishingTargetResolverFields inherited from interface org.craftercms.commons.file.blob.BlobStore
CONFIG_KEY_CONFIGURATION, CONFIG_KEY_ID, CONFIG_KEY_MAPPING, CONFIG_KEY_MAPPING_PREFIX, CONFIG_KEY_MAPPING_PUBLISHING_TARGET, CONFIG_KEY_MAPPING_STORE_TARGET, CONFIG_KEY_PATTERN, CONFIG_KEY_READ_ONLY, CONFIG_KEY_STORE, CONFIG_KEY_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionStudioAwsS3BlobStore(ServicesConfig servicesConfig, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor taskExecutor) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelPublishAll(String siteId, String publishingTarget) Performs the cleanup after a failed publish all operation for the given site & targetvoidcheckContentExists(String site, String path) Checks if a content exists at a given path and throw an exception if it does not.protected voidChecks that the blob store is in writable mode (readOnly = false) and throws an exception if it is not.voidcompletePublishAll(String siteId, String publishingTarget, RepositoryChanges changes, String comment) Performs the actual publish of all changes for the given site & targetbooleancontentExists(String site, String path) Determine if content exists in the repository at a given pathvoidcopyBlobs(StudioBlobStore source, String environment, List<String> items) Copy the blob items from the source storecopyContent(String site, String fromPath, String toPath) copy content from PathA to pathBcreateFolder(String site, String path, String name) create a folderdeleteContent(String site, String path, String approver) delete contentvoiddoInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) voidduplicateSite(String sourceSiteId, String siteId, String sourceSandboxBranch, String sandboxBranch) Create copies of the source site's repositories.getContent(String site, String path, boolean shallow) Get content from the repositorylonggetContentSize(String site, String path) get file sizeprotected StringgetFullKey(org.craftercms.commons.file.blob.impl.AbstractBlobStore.Mapping mapping, String path) org.craftercms.commons.file.blob.BlobgetReference(String path) Return a reference to a file in the storevoidinitialPublish(String siteId) Execute initial publish for given siteprotected booleanbooleanIndicate if the store is read onlymoveContent(String site, String fromPath, String toPath, String newName) move content from PathA to pathBpreparePublishAll(String siteId, String publishingTarget) Prepares the repository to publish all changes for the given site & targetvoidpublish(String site, String sandboxBranch, List<DeploymentItemTO> deploymentItems, String environment, String author, String comment) Publish content to specified environment.publishAll(String siteId, String publishingTarget, String comment) Publishes all changes for the given site & targetbooleanshallowContentExists(String site, String path) This is a faster, but less accurate, version of contentExists.writeContent(String site, String path, InputStream content) write contentMethods inherited from class org.craftercms.commons.file.blob.impl.s3.AwsS3BlobStore
doGetContent, getAsyncClient, getClient, getKey, setAsyncClientFactory, setClientFactoryMethods inherited from class org.craftercms.commons.file.blob.impl.AbstractBlobStore
getId, getMapping, getResource, init, isCompatible, setId, setPattern, setProfileMapper, setPublishingTargetResolverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.craftercms.commons.file.blob.BlobStore
getId, getResource, init, isCompatibleMethods inherited from interface org.craftercms.studio.api.v1.repository.ContentRepository
getContent, moveContentMethods inherited from interface org.craftercms.studio.api.v2.repository.ContentRepository
getGlobalRepoLastCommitId, getItemPaths, getSubtreeItemsMethods inherited from interface org.craftercms.studio.api.v2.repository.blob.StudioBlobStoreAdapter
addRemote, commitIdExists, commitIdExists, createSiteCloneRemote, createSiteFromBlueprint, createVersion, createVersion, deleteSite, forAllSitePaths, getCommitIdsBetween, getContentByCommitId, getContentChildren, getContentItemHistory, getContentVersionHistory, getIntroducedCommits, getItem, getItemEnvironmentProperties, getLastEditCommitId, getOperationsFromDelta, getPreviousCommitId, getPublishingHistory, getRepoFirstCommitId, getRepoLastCommitId, getSubtreeItems, gitGCRepositories, initialPublish, isFolder, itemUnlock, listRemote, lockItem, lockItemForPublishing, publishedRepositoryExists, pullFromRemote, pushToRemote, removeRemote, removeRemoteRepositoriesForSite, repositoryExists, resetStagingRepository, revertContent, unLockItem, unLockItemForPublishing
-
Field Details
-
OK
- See Also:
-
servicesConfig
-
readOnly
protected boolean readOnly
-
-
Constructor Details
-
StudioAwsS3BlobStore
@ConstructorProperties({"servicesConfig","taskExecutor"}) public StudioAwsS3BlobStore(ServicesConfig servicesConfig, org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor taskExecutor)
-
-
Method Details
-
doInit
public void doInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) throws org.craftercms.commons.config.ConfigurationException - Overrides:
doInitin classorg.craftercms.commons.file.blob.impl.s3.AwsS3BlobStore- Throws:
org.craftercms.commons.config.ConfigurationException
-
checkReadWriteMode
Checks that the blob store is in writable mode (readOnly = false) and throws an exception if it is not.- Throws:
BlobStoreNotWritableModeException- is the blob store is in read-only modeServiceLayerException
-
isFolder
-
getFullKey
-
getReference
Description copied from interface:StudioBlobStoreReturn a reference to a file in the store- Specified by:
getReferencein interfaceStudioBlobStore- Parameters:
path- the path of the file- Returns:
- the blob object
-
isReadOnly
public boolean isReadOnly()Description copied from interface:StudioBlobStoreIndicate if the store is read only- Specified by:
isReadOnlyin interfaceStudioBlobStore- Returns:
- true if the store is read only
-
contentExists
Description copied from interface:ContentRepositoryDetermine if content exists in the repository at a given path- Specified by:
contentExistsin interfaceContentRepository- Specified by:
contentExistsin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to check if content exists- Returns:
- true if site has content object at path
-
checkContentExists
Description copied from interface:ContentRepositoryChecks if a content exists at a given path and throw an exception if it does not.- Specified by:
checkContentExistsin interfaceContentRepository- Parameters:
site- id of the sitepath- the content path- Throws:
ServiceLayerException- if no content is found at the given path
-
shallowContentExists
Description copied from interface:ContentRepositoryThis is a faster, but less accurate, version of contentExists. This prioritizes performance over checking the actual underlying repository if the content is actually in the store or we simply hold a reference to the object in the actual store.- Specified by:
shallowContentExistsin interfaceContentRepository- Specified by:
shallowContentExistsin interfaceContentRepository- Returns:
- true if site has content object at path
-
getContent
Description copied from interface:ContentRepositoryGet content from the repository- Specified by:
getContentin interfaceContentRepository- Parameters:
site- the site idpath- the path of the contentshallow- if true, it will load the file from disk directly, instead of retrieving it from git repository- Returns:
- InputStream to read the content
-
getContentSize
Description copied from interface:ContentRepositoryget file size- Specified by:
getContentSizein interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to content- Returns:
- Size in bytes
-
writeContent
public String writeContent(String site, String path, InputStream content) throws ServiceLayerException Description copied from interface:ContentRepositorywrite content- Specified by:
writeContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to contentcontent- stream of content to write- Returns:
- Commit Id if successful, null otherwise
- Throws:
ServiceLayerException- if error happens during write
-
createFolder
Description copied from interface:ContentRepositorycreate a folder- Specified by:
createFolderin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to create a folder inname- a folder name to create- Returns:
- Commit Id if successful, null otherwise
- Throws:
ServiceLayerException
-
deleteContent
Description copied from interface:ContentRepositorydelete content- Specified by:
deleteContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to contentapprover- user that approves delete content- Returns:
- Commit ID if successful, null otherwise
- Throws:
ServiceLayerException
-
moveContent
public String moveContent(String site, String fromPath, String toPath, String newName) throws ServiceLayerException Description copied from interface:ContentRepositorymove content from PathA to pathB- Specified by:
moveContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedfromPath- source contenttoPath- target pathnewName- new file name for rename- Returns:
- Commit ID if successful, empty string otherwise
- Throws:
ServiceLayerException
-
copyContent
Description copied from interface:ContentRepositorycopy content from PathA to pathB- Specified by:
copyContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedfromPath- paths to contenttoPath- target path- Returns:
- Commit ID if successful, empty string otherwise
- Throws:
ServiceLayerException
-
publish
public void publish(String site, String sandboxBranch, List<DeploymentItemTO> deploymentItems, String environment, String author, String comment) Description copied from interface:ContentRepositoryPublish content to specified environment.- Specified by:
publishin interfaceContentRepository- Parameters:
site- site identifiersandboxBranch- sandbox branch namedeploymentItems- items to be publishedenvironment- environment to publish toauthor- authorcomment- submission comment
-
initialPublish
Description copied from interface:ContentRepositoryExecute initial publish for given site- Specified by:
initialPublishin interfaceContentRepository- Parameters:
siteId- site identifier
-
publishAll
Description copied from interface:ContentRepositoryPublishes all changes for the given site & target- Specified by:
publishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing targetcomment- submission comment
-
preparePublishAll
Description copied from interface:ContentRepositoryPrepares the repository to publish all changes for the given site & target- Specified by:
preparePublishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing target- Returns:
- the set of changed files
-
completePublishAll
public void completePublishAll(String siteId, String publishingTarget, RepositoryChanges changes, String comment) Description copied from interface:ContentRepositoryPerforms the actual publish of all changes for the given site & target- Specified by:
completePublishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing targetchanges- the set of changed filescomment- submission comment
-
cancelPublishAll
Description copied from interface:ContentRepositoryPerforms the cleanup after a failed publish all operation for the given site & target- Specified by:
cancelPublishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing target
-
duplicateSite
public void duplicateSite(String sourceSiteId, String siteId, String sourceSandboxBranch, String sandboxBranch) Description copied from interface:ContentRepositoryCreate copies of the source site's repositories. This method will copy sandbox and published (if exists) repositories under a new directory with the new site id. For sandbox repository, a new branch will be created (from the currently checked-out branch) with the given sandbox branch name if it does not exist.- Specified by:
duplicateSitein interfaceContentRepository- Parameters:
sourceSiteId- source site idsiteId- new site idsandboxBranch- sandbox branch name
-
copyBlobs
Description copied from interface:StudioBlobStoreCopy the blob items from the source store- Specified by:
copyBlobsin interfaceStudioBlobStore- Parameters:
source- the source storeenvironment- the environment (publishing target)items- the items to copy
-