org.loom.persistence.file
Class ExternalFileManager

java.lang.Object
  extended by org.loom.persistence.file.ExternalFileManager
All Implemented Interfaces:
FileManager

public class ExternalFileManager
extends java.lang.Object
implements FileManager

Stores file data in a database table, and file contents in a configured system folder.


Constructor Summary
ExternalFileManager()
           
 
Method Summary
 void afterPropertiesSet()
           
 PersistentFile find(java.lang.Integer id)
           
 java.io.File getContainingFolder(int id)
           
protected  java.io.File getFileLocation(PersistentFile file)
          Return the file location of a persistent file.
 int getMaxFilesPerFolder()
           
 java.io.File getRootFolder()
           
 PersistentFile merge(FileParameter parameter)
          Stores a file in the database and return the persistent instance
 PersistentFile merge(PersistentFile file)
          Stores a file in the database and return the persistent instance
 PersistentFile remove(java.lang.Integer id)
          Removes a persistent file from the database
 void setEntityManager(ExtendedEntityManager entityManager)
           
 void setMaxFilesPerFolder(int maxFilesPerFolder)
           
 void setRootFolder(java.io.File rootFolder)
           
 void setRootFolderLocation(java.lang.String location)
           
 void setStorageRoot(java.lang.String storageRoot)
          Deprecated. use setRootFolderLocation() instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalFileManager

public ExternalFileManager()
Method Detail

afterPropertiesSet

@PostConstruct
public void afterPropertiesSet()
                        throws java.lang.Exception
Throws:
java.lang.Exception

merge

@Transactional
public PersistentFile merge(FileParameter parameter)
Description copied from interface: FileManager
Stores a file in the database and return the persistent instance

Specified by:
merge in interface FileManager
Parameters:
parameter - the uploaded parameter file
Returns:
the persisted instance

merge

@Transactional
public PersistentFile merge(PersistentFile file)
Description copied from interface: FileManager
Stores a file in the database and return the persistent instance

Specified by:
merge in interface FileManager
Parameters:
file - the modified file to store
Returns:
the persisted instance

getFileLocation

protected java.io.File getFileLocation(PersistentFile file)
Return the file location of a persistent file. this implementation just returns the file ID, relative to the repository root.


getContainingFolder

public java.io.File getContainingFolder(int id)

find

public PersistentFile find(java.lang.Integer id)
Specified by:
find in interface FileManager
Parameters:
id - the persistent file id
Returns:
the persistent file entity

remove

@Transactional
public PersistentFile remove(java.lang.Integer id)
Description copied from interface: FileManager
Removes a persistent file from the database

Specified by:
remove in interface FileManager
Parameters:
id - the file id to remove
Returns:
the removed file entity

setStorageRoot

public void setStorageRoot(java.lang.String storageRoot)
Deprecated. use setRootFolderLocation() instead


setRootFolderLocation

public void setRootFolderLocation(java.lang.String location)

setEntityManager

public void setEntityManager(ExtendedEntityManager entityManager)

getRootFolder

public java.io.File getRootFolder()

setRootFolder

public void setRootFolder(java.io.File rootFolder)

getMaxFilesPerFolder

public int getMaxFilesPerFolder()

setMaxFilesPerFolder

public void setMaxFilesPerFolder(int maxFilesPerFolder)