Class AmazonS3PersistenceStrategy
java.lang.Object
org.jasig.portlet.attachment.service.AmazonS3PersistenceStrategy
- All Implemented Interfaces:
IDocumentPersistenceStrategy
@Service public class AmazonS3PersistenceStrategy extends Object implements IDocumentPersistenceStrategy
Persistence strategy which persists the attachment's file to an S3 bucket
- Author:
- James Wennmacher, jwennmacher@unicon.net
-
Constructor Summary
Constructors Constructor Description AmazonS3PersistenceStrategy() -
Method Summary
Modifier and Type Method Description StringgetS3BucketBaseUrl()StringgetS3BucketName()StringgetS3BucketPath()StringgetS3CacheControlString()booleanisPersistenceIntoDatabaseRequired()Boolean indicating whether or not attachment data is stored into the database.StringpersistAttachmentBinary(javax.servlet.http.HttpServletRequest request, Attachment attachment)Accepts an attachment to save and persists the attachment binary data using the implemented persistence strategy.voidsetPersistenceIntoDatabaseRequired(boolean persistenceIntoDatabaseRequired)Boolean indicating whether or not to store the file data into the database.voidsetS3BucketBaseUrl(String s3BucketBaseUrl)voidsetS3BucketName(String s3BucketName)voidsetS3BucketPath(String s3BucketPath)voidsetS3CacheControlString(String s3CacheControlString)
-
Constructor Details
-
AmazonS3PersistenceStrategy
public AmazonS3PersistenceStrategy()
-
-
Method Details
-
persistAttachmentBinary
public String persistAttachmentBinary(javax.servlet.http.HttpServletRequest request, Attachment attachment) throws PersistenceExceptionDescription copied from interface:IDocumentPersistenceStrategyAccepts an attachment to save and persists the attachment binary data using the implemented persistence strategy.- Specified by:
persistAttachmentBinaryin interfaceIDocumentPersistenceStrategy- Parameters:
request- HTTPServletRequest. May be null to indicate a data import operation.attachment- attachment containing data to save- Returns:
- URL to access the attachment with. Null means did not persist the attachment.
- Throws:
PersistenceException- Exception persisting the document to the persistence store
-
setPersistenceIntoDatabaseRequired
public void setPersistenceIntoDatabaseRequired(boolean persistenceIntoDatabaseRequired)Boolean indicating whether or not to store the file data into the database. Storage into S3 has the data external to the portal server in a stable persistent location so there is no need to have the file data stored into a database.- Parameters:
persistenceIntoDatabaseRequired- True to store the file data in the database, else false.
-
isPersistenceIntoDatabaseRequired
public boolean isPersistenceIntoDatabaseRequired()Description copied from interface:IDocumentPersistenceStrategyBoolean indicating whether or not attachment data is stored into the database. Some persistence stores, such as the local filesystem, would want the data stored into the database to allow for hydrating the data from the database in case it is not on the local file system. This is used when you have a cluster of portal servers and a server may not have the content hydrated locally. Other persistence stores, such as a network share or S3, store their data external to the portal server so there is no need to have the file data stored into a database.- Specified by:
isPersistenceIntoDatabaseRequiredin interfaceIDocumentPersistenceStrategy- Returns:
- True if the file data is stored in the database, else false.
-
getS3BucketName
-
setS3BucketName
-
getS3BucketBaseUrl
-
setS3BucketBaseUrl
-
getS3BucketPath
-
setS3BucketPath
-
getS3CacheControlString
-
setS3CacheControlString
-