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 Details

  • Method Details

    • persistAttachmentBinary

      public String persistAttachmentBinary​(javax.servlet.http.HttpServletRequest request, Attachment attachment) throws PersistenceException
      Description copied from interface: IDocumentPersistenceStrategy
      Accepts an attachment to save and persists the attachment binary data using the implemented persistence strategy.
      Specified by:
      persistAttachmentBinary in interface IDocumentPersistenceStrategy
      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: IDocumentPersistenceStrategy
      Boolean 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:
      isPersistenceIntoDatabaseRequired in interface IDocumentPersistenceStrategy
      Returns:
      True if the file data is stored in the database, else false.
    • getS3BucketName

      public String getS3BucketName()
    • setS3BucketName

      public void setS3BucketName​(String s3BucketName)
    • getS3BucketBaseUrl

      public String getS3BucketBaseUrl()
    • setS3BucketBaseUrl

      public void setS3BucketBaseUrl​(String s3BucketBaseUrl)
    • getS3BucketPath

      public String getS3BucketPath()
    • setS3BucketPath

      public void setS3BucketPath​(String s3BucketPath)
    • getS3CacheControlString

      public String getS3CacheControlString()
    • setS3CacheControlString

      public void setS3CacheControlString​(String s3CacheControlString)