Interface StudioBlobStoreAdapter

All Superinterfaces:
org.craftercms.commons.file.blob.BlobStore, ContentRepository, ContentRepository, StudioBlobStore
All Known Implementing Classes:
StudioAwsS3BlobStore

public interface StudioBlobStoreAdapter extends StudioBlobStore
Base class for all implementations of StudioBlobStore
Since:
3.1.6
Author:
joseross
  • Method Details

    • getContentChildren

      default RepositoryItem[] getContentChildren(String site, String path)
      Description copied from interface: ContentRepository
      get immediate children for path
      Specified by:
      getContentChildren in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path to content
      Returns:
      a list of children
    • getContentVersionHistory

      default VersionTO[] getContentVersionHistory(String site, String path)
      Description copied from interface: ContentRepository
      get the version history for an item
      Specified by:
      getContentVersionHistory in interface ContentRepository
      Parameters:
      site - - the project ID
      path - - the path of the item
      Returns:
      a list of versions
    • getContentItemHistory

      default List<ItemVersion> getContentItemHistory(String site, String path)
      Specified by:
      getContentItemHistory in interface ContentRepository
    • getCommitIdsBetween

      default List<String> getCommitIdsBetween(String siteId, String commitFrom, String commitTo)
      Description copied from interface: ContentRepository
      Get the commits between two commit ids. This method must start in the commitTo and go back until it finds commitFrom. The actual result must be equivalent to git log --first-parent --reverse commitFrom..commitTo
      Specified by:
      getCommitIdsBetween in interface ContentRepository
      Parameters:
      siteId - site id
      commitFrom - the older commit id
      commitTo - the newer commit id
      Returns:
      list of commit ids between commitFrom (not included) and commitTo (inclusive)
    • getIntroducedCommits

      default List<String> getIntroducedCommits(String site, String baseCommit, String commitId)
      Description copied from interface: ContentRepository
      Get the new commits introduced by commitId into baseCommit.
      This method assumes that baseCommit is an ancestor of commitId's first parent. Result will be equivalent to git log baseCommit..commitId
      Specified by:
      getIntroducedCommits in interface ContentRepository
      Parameters:
      site - site id
      baseCommit - the commit id to compare against
      commitId - the commit id to compare
    • createVersion

      default String createVersion(String site, String path, boolean majorVersion)
      Description copied from interface: ContentRepository
      create a version
      Specified by:
      createVersion in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - location of content
      majorVersion - true if major
      Returns:
      the created version ID or null on failure
    • createVersion

      default String createVersion(String site, String path, String comment, boolean majorVersion)
      Description copied from interface: ContentRepository
      create a version
      Specified by:
      createVersion in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - location of content
      comment - version history comment
      majorVersion - true if major
      Returns:
      the created version ID or null on failure
    • revertContent

      default String revertContent(String site, String path, String version, boolean major, String comment)
      Description copied from interface: ContentRepository
      revert a version (create a new version based on an old version)
      Specified by:
      revertContent in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - - the path of the item to "revert"
      version - - old version ID to base to version on
      major - flag if it is major version
      comment - add comment when committing content
      Returns:
      Commit ID if successful, empty string otherwise
    • getContentByCommitId

      default Optional<org.springframework.core.io.Resource> getContentByCommitId(String site, String path, String commitId)
      Description copied from interface: ContentRepository
      return a specific version of the content
      Specified by:
      getContentByCommitId in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path of the content
      commitId - version to return
      Returns:
      the resource if available
    • lockItem

      default void lockItem(String site, String path)
      Description copied from interface: ContentRepository
      lock an item NOTE: site will be removed from this interface
      Specified by:
      lockItem in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path of the item
    • lockItemForPublishing

      default void lockItemForPublishing(String site, String path)
      Description copied from interface: ContentRepository
      lock an item NOTE: site will be removed from this interface
      Specified by:
      lockItemForPublishing in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path of the item
    • unLockItem

      default void unLockItem(String site, String path)
      Description copied from interface: ContentRepository
      unlock an item for publishing NOTE: site will be removed from this interface
      Specified by:
      unLockItem in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path of the item
    • unLockItemForPublishing

      default void unLockItemForPublishing(String site, String path)
      Description copied from interface: ContentRepository
      unlock an item for publishing NOTE: site will be removed from this interface
      Specified by:
      unLockItemForPublishing in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path of the item
    • isFolder

      default boolean isFolder(String siteId, String path)
      Description copied from interface: ContentRepository
      Check if content at given path is folder
      Specified by:
      isFolder in interface ContentRepository
      Parameters:
      siteId - site identifier
      path - content path
      Returns:
      true if path is folder, otherwise false
    • createSiteFromBlueprint

      default boolean createSiteFromBlueprint(String blueprintLocation, String siteId, String sandboxBranch, Map<String,String> params, String creator)
      Description copied from interface: ContentRepository
      Create a new site based on a blueprint
      Specified by:
      createSiteFromBlueprint in interface ContentRepository
      Parameters:
      blueprintLocation - blueprint location
      siteId - site identifier
      sandboxBranch - sandbox branch name
      params - site parameters
      creator - site creator
      Returns:
      true if successful, false otherwise
    • deleteSite

      default boolean deleteSite(String siteId)
      Description copied from interface: ContentRepository
      Deletes an existing site.
      Specified by:
      deleteSite in interface ContentRepository
      Specified by:
      deleteSite in interface ContentRepository
      Parameters:
      siteId - site to delete
      Returns:
      true if successful, false otherwise
    • initialPublish

      default void initialPublish(String site, String sandboxBranch, String environment, String author, String comment)
      Description copied from interface: ContentRepository
      Initial publish to specified environment.
      Specified by:
      initialPublish in interface ContentRepository
      Parameters:
      site - site identifier
      sandboxBranch - sandbox branch name
      environment - environment to publish
      author - author
      comment - comment
    • getRepoLastCommitId

      default String getRepoLastCommitId(String site)
      Description copied from interface: ContentRepository
      Get last commit id from repository for given site.
      Specified by:
      getRepoLastCommitId in interface ContentRepository
      Specified by:
      getRepoLastCommitId in interface ContentRepository
      Parameters:
      site - site id
      Returns:
      last commit id (current HEAD)
    • getRepoFirstCommitId

      default String getRepoFirstCommitId(String site)
      Description copied from interface: ContentRepository
      Get first id from repository for given site
      Specified by:
      getRepoFirstCommitId in interface ContentRepository
      Specified by:
      getRepoFirstCommitId in interface ContentRepository
      Parameters:
      site - site id
      Returns:
      first commit id
    • commitIdExists

      default boolean commitIdExists(String site, String commitId)
      Description copied from interface: ContentRepository
      Check if given commit id exists
      Specified by:
      commitIdExists in interface ContentRepository
      Parameters:
      site - site id
      commitId - commit id to check
      Returns:
      true if it exists in site repository, otherwise false
    • commitIdExists

      default boolean commitIdExists(String site, GitRepositories repoType, String commitId)
      Description copied from interface: ContentRepository
      Check if given commit id (or revision string) exists
      Specified by:
      commitIdExists in interface ContentRepository
      Parameters:
      site - site id
      repoType - repository type
      commitId - commit id or revision to check
      Returns:
      true if it exists in site repository, otherwise false
    • createSiteCloneRemote

      default boolean createSiteCloneRemote(String siteId, String sandboxBranch, String remoteName, String remoteUrl, String remoteBranch, boolean singleBranch, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey, Map<String,String> params, boolean createAsOrphan, String creator)
      Description copied from interface: ContentRepository
      Create new site as a clone from remote repository
      Specified by:
      createSiteCloneRemote in interface ContentRepository
      Parameters:
      siteId - site identifier
      sandboxBranch - sandbox branch name
      remoteName - remote name
      remoteUrl - remote repository url
      remoteBranch - remote branch name
      singleBranch - flag to signal if clone single branch or full repository
      authenticationType - type of authentication to use to connect remote repository
      remoteUsername - remote username
      remotePassword - remote password
      remoteToken - remote token
      remotePrivateKey - remote private key
      params - site parameters
      createAsOrphan - create as orphan
      creator - site creator
      Returns:
      true if success
    • addRemote

      default boolean addRemote(String siteId, String remoteName, String remoteUrl, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey)
      Description copied from interface: ContentRepository
      Add remote repository for site content repository
      Specified by:
      addRemote in interface ContentRepository
      Parameters:
      siteId - site identifier
      remoteName - remote name
      remoteUrl - remote url
      authenticationType - authentication type
      remoteUsername - remote username
      remotePassword - remote password
      remoteToken - remote token
      remotePrivateKey - remote private key
      Returns:
      true if operation was successful
    • removeRemote

      default boolean removeRemote(String siteId, String remoteName)
      Description copied from interface: ContentRepository
      Remove remote with given name for site
      Specified by:
      removeRemote in interface ContentRepository
      Parameters:
      siteId - site identifier
      remoteName - remote name
      Returns:
      true if operation was successful
    • removeRemoteRepositoriesForSite

      default void removeRemoteRepositoriesForSite(String siteId)
      Description copied from interface: ContentRepository
      Remove all remotes for given site
      Specified by:
      removeRemoteRepositoriesForSite in interface ContentRepository
      Parameters:
      siteId - site identifier
    • listRemote

      default List<RemoteRepositoryInfoTO> listRemote(String siteId, String sandboxBranch)
      Description copied from interface: ContentRepository
      List remote repositories for given site
      Specified by:
      listRemote in interface ContentRepository
      Parameters:
      siteId - site identifier
      sandboxBranch - sandbox branch name
      Returns:
      list of names of remote repositories
    • pushToRemote

      default boolean pushToRemote(String siteId, String remoteName, String remoteBranch)
      Description copied from interface: ContentRepository
      Push content to remote repository
      Specified by:
      pushToRemote in interface ContentRepository
      Parameters:
      siteId - site identifier
      remoteName - remote name
      remoteBranch - remote branch
      Returns:
      true if operation was successful
    • pullFromRemote

      default boolean pullFromRemote(String siteId, String remoteName, String remoteBranch)
      Description copied from interface: ContentRepository
      Pull from remote repository
      Specified by:
      pullFromRemote in interface ContentRepository
      Parameters:
      siteId - site identifier
      remoteName - remote name
      remoteBranch - remote branch
      Returns:
      true if operation was successful
    • resetStagingRepository

      default void resetStagingRepository(String siteId)
      Description copied from interface: ContentRepository
      Reset staging repository to live for given site
      Specified by:
      resetStagingRepository in interface ContentRepository
      Parameters:
      siteId - site identifier to use for resetting
    • gitGCRepositories

      default void gitGCRepositories(String siteId)
      Description copied from interface: ContentRepository
      Performs a git gc on all repositories for the given site
      Specified by:
      gitGCRepositories in interface ContentRepository
      Parameters:
      siteId - site identifier, or null for global repository
    • repositoryExists

      default boolean repositoryExists(String site)
      Description copied from interface: ContentRepository
      Check if repository exists for given site
      Specified by:
      repositoryExists in interface ContentRepository
      Parameters:
      site - site id
      Returns:
      true if repository exists, otherwise false
    • getSubtreeItems

      default List<String> getSubtreeItems(String site, String path, GitRepositories repoType, String branch)
      Description copied from interface: ContentRepository
      List subtree items for give site and path
      Specified by:
      getSubtreeItems in interface ContentRepository
      Parameters:
      site - site identifier
      path - path for subtree root
      repoType - repository type
      branch - A git object references expression (e.g.: HEAD, branch name, commit id)
      Returns:
      list of item paths contained in the subtree
    • getOperationsFromDelta

      default List<RepoOperation> getOperationsFromDelta(String site, String commitIdFrom, String commitIdTo)
      Description copied from interface: ContentRepository
      Get a list of operations since the commit ID provided (compare that commit to HEAD)
      Specified by:
      getOperationsFromDelta in interface ContentRepository
      Parameters:
      site - site to use
      commitIdFrom - commit ID to start at
      commitIdTo - commit ID to end at
      Returns:
      commit ID of current HEAD, updated operationsSinceCommit
    • getPublishingHistory

      default List<PublishingHistoryItem> getPublishingHistory(String siteId, String environment, String path, String publisher, ZonedDateTime fromDate, ZonedDateTime toDate, int limit)
      Description copied from interface: ContentRepository
      Get publishing history
      Specified by:
      getPublishingHistory in interface ContentRepository
      Parameters:
      siteId - site identifier
      environment - environment
      path - path regular expression to use as filter
      publisher - user to filter by
      fromDate - lower boundary for published date
      toDate - upper boundary for published date
      limit - number of records to return
      Returns:
      publishing history
    • getItem

      default org.craftercms.core.service.Item getItem(String siteId, String path, boolean flatten)
      Specified by:
      getItem in interface ContentRepository
    • getLastEditCommitId

      default String getLastEditCommitId(String siteId, String path)
      Specified by:
      getLastEditCommitId in interface ContentRepository
    • forAllSitePaths

      default void forAllSitePaths(String siteId, org.springframework.util.function.ThrowingConsumer<String> directoryProcessor, org.springframework.util.function.ThrowingConsumer<String> fileProcessor)
      Description copied from interface: ContentRepository
      Execute consumers for all site paths for the given site
      Specified by:
      forAllSitePaths in interface ContentRepository
      Parameters:
      siteId - the site id
      directoryProcessor - the consumer to process the directory paths
      fileProcessor - the consumer to process the file paths
    • getItemEnvironmentProperties

      default DetailedItem.Environment getItemEnvironmentProperties(String siteId, GitRepositories repo, String environment, String path)
      Description copied from interface: ContentRepository
      Get environment properties for item
      Specified by:
      getItemEnvironmentProperties in interface ContentRepository
      Parameters:
      siteId - site identifier
      repo - repository type
      environment - branch
      path - path of the item
      Returns:
      environment properties
    • getPreviousCommitId

      default String getPreviousCommitId(String siteId, String commitId)
      Description copied from interface: ContentRepository
      Get the previous commit id from repository for given a site id and a commit id
      Specified by:
      getPreviousCommitId in interface ContentRepository
      Parameters:
      siteId - site identifier
      commitId - commit Id
      Returns:
    • itemUnlock

      default void itemUnlock(String site, String path)
      Description copied from interface: ContentRepository
      unlock an item
      Specified by:
      itemUnlock in interface ContentRepository
      Parameters:
      site - site id where the operation will be executed
      path - path of the item
    • publishedRepositoryExists

      default boolean publishedRepositoryExists(String siteId)
      Description copied from interface: ContentRepository
      Check if published repository exists for given site.
      Specified by:
      publishedRepositoryExists in interface ContentRepository
      Parameters:
      siteId - site identifier
      Returns:
      true if PUBLISHED repository exists, otherwise false