Class FileSystemPersistenceStrategy
java.lang.Object
org.jasig.portlet.attachment.service.FileSystemPersistenceStrategy
- All Implemented Interfaces:
IDocumentPersistenceStrategy
@Service public class FileSystemPersistenceStrategy extends Object implements IDocumentPersistenceStrategy
Persistence strategy which persists the attachment's file to the local filesystem.
TODO Enhance to allow specifying a network share location. Currently file storage is always
on the local file system relative to webapp directory.
- Author:
- James Wennmacher, jwennmacher@unicon.net
-
Constructor Summary
Constructors Constructor Description FileSystemPersistenceStrategy() -
Method Summary
Modifier and Type Method Description 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.
-
Constructor Details
-
FileSystemPersistenceStrategy
public FileSystemPersistenceStrategy()
-
-
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
-
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.
-