Class S3ContentService

java.lang.Object
org.saidone.component.BaseComponent
org.saidone.service.content.S3ContentService
All Implemented Interfaces:
ContentService, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service @ConfigurationProperties(prefix="application.service.vault.storage") @ConditionalOnExpression("\'${application.service.vault.storage.impl:}\' == \'s3\'") public class S3ContentService extends BaseComponent implements ContentService
ContentService implementation that stores node binaries in Amazon S3.

During archival the content stream is uploaded while a checksum is computed on the fly. The resulting hash and other metadata are stored as object metadata. Retrieval operations return a NodeContent descriptor using the AWS SDK.

This service is enabled when application.service.vault.storage.impl is set to s3.

  • Constructor Details

    • S3ContentService

      public S3ContentService()
  • Method Details

    • archiveNodeContent

      public void archiveNodeContent(org.alfresco.core.model.Node node, InputStream inputStream)
      Saves the content stream of the given node to S3. The method computes the checksum on the fly and stores it as object metadata.
      Specified by:
      archiveNodeContent in interface ContentService
      Parameters:
      node - node whose content is being archived
      inputStream - input stream providing the node content
    • getNodeContent

      public NodeContent getNodeContent(String nodeId)
      Retrieves the content of a node from S3.
      Specified by:
      getNodeContent in interface ContentService
      Parameters:
      nodeId - identifier of the node
      Returns:
      descriptor containing file name, content type and the data stream
      Throws:
      NodeNotFoundOnVaultException - if the object is not found
    • deleteNodeContent

      public void deleteNodeContent(String nodeId)
      Removes the stored object associated with the given node id.
      Specified by:
      deleteNodeContent in interface ContentService
      Parameters:
      nodeId - identifier of the node
    • computeHash

      public String computeHash(String nodeId, String algorithm)
      Computes the checksum of a stored object using the supplied algorithm.
      Specified by:
      computeHash in interface ContentService
      Parameters:
      nodeId - identifier of the node
      algorithm - name of the hash algorithm
      Returns:
      hexadecimal encoded hash string
      Throws:
      NodeNotFoundOnVaultException - if the node cannot be found
    • stop

      @PreDestroy public void stop()
      Description copied from class: BaseComponent
      Called just before the bean is destroyed. Logs a shutdown message indicating that the component is stopping.
      Overrides:
      stop in class BaseComponent