Package org.saidone.service.content
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 NodeContentStream descriptor using the AWS SDK.
This service is enabled when application.service.vault.storage.impl is set to
s3.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidarchiveNodeContent(org.alfresco.core.model.Node node, InputStream inputStream) Saves the content stream of the given node to S3.computeHash(String nodeId, String algorithm) Computes the checksum of a stored object using the supplied algorithm.voiddeleteNodeContent(String nodeId) Removes the stored object associated with the given node id.getNodeContent(String nodeId) Retrieves the content of a node from S3.getNodeContentInfo(String nodeId) Retrieves only the metadata of a node's content stored in S3 without streaming the actual binary.voidstop()Called just before the bean is destroyed.Methods inherited from class org.saidone.component.BaseComponent
init, setApplicationContext, shutDown
-
Constructor Details
-
S3ContentService
public S3ContentService()
-
-
Method Details
-
archiveNodeContent
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:
archiveNodeContentin interfaceContentService- Parameters:
node- node whose content is being archivedinputStream- input stream providing the node content
-
getNodeContent
Retrieves the content of a node from S3.- Specified by:
getNodeContentin interfaceContentService- 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
-
getNodeContentInfo
Retrieves only the metadata of a node's content stored in S3 without streaming the actual binary.- Specified by:
getNodeContentInfoin interfaceContentService- Parameters:
nodeId- identifier of the node- Returns:
- a populated
NodeContentInfo - Throws:
NodeNotFoundOnVaultException- if the object does not exist in S3
-
deleteNodeContent
Removes the stored object associated with the given node id.- Specified by:
deleteNodeContentin interfaceContentService- Parameters:
nodeId- identifier of the node
-
computeHash
Computes the checksum of a stored object using the supplied algorithm.- Specified by:
computeHashin interfaceContentService- Parameters:
nodeId- identifier of the nodealgorithm- 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:BaseComponentCalled just before the bean is destroyed. Logs a shutdown message indicating that the component is stopping.- Overrides:
stopin classBaseComponent
-