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 NodeContent
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 TypeMethodDescriptionvoid
archiveNodeContent
(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.void
deleteNodeContent
(String nodeId) Removes the stored object associated with the given node id.getNodeContent
(String nodeId) Retrieves the content of a node from S3.void
stop()
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:
archiveNodeContent
in 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:
getNodeContent
in 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
-
deleteNodeContent
Removes the stored object associated with the given node id.- Specified by:
deleteNodeContent
in interfaceContentService
- Parameters:
nodeId
- identifier of the node
-
computeHash
Computes the checksum of a stored object using the supplied algorithm.- Specified by:
computeHash
in 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:BaseComponent
Called just before the bean is destroyed. Logs a shutdown message indicating that the component is stopping.- Overrides:
stop
in classBaseComponent
-