cluster5.server.managers
Class FileManager

java.lang.Object
  extended by cluster5.server.managers.FileManager

public class FileManager
extends java.lang.Object


Field Summary
static java.lang.String FILES_SAVE_PATH
           
 
Method Summary
 boolean deleteFile(java.lang.Long fileId)
          Deletes specified file from the database and the filesystem.
 SharedFile getFile(java.lang.Long fileId)
           
 byte[] getFileData(java.lang.Long fileId)
           
static FileManager getInstance()
           
 java.util.List<SharedFile> listAllFiles()
          Lists all files in the database without loading binary data.
 java.util.List<java.lang.Long> listFileIds(java.lang.String token, java.lang.Long projectId)
           
 void saveFile(java.lang.String token, java.lang.Long projectId, SharedFile file)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILES_SAVE_PATH

public static final java.lang.String FILES_SAVE_PATH
See Also:
Constant Field Values
Method Detail

getInstance

public static FileManager getInstance()

saveFile

public void saveFile(java.lang.String token,
                     java.lang.Long projectId,
                     SharedFile file)

getFile

public SharedFile getFile(java.lang.Long fileId)
Parameters:
fileId -
Returns:
file by ID; null if there is no such file

deleteFile

public boolean deleteFile(java.lang.Long fileId)
Deletes specified file from the database and the filesystem.

Parameters:
fileId -
Returns:
true if operation was successful

listFileIds

public java.util.List<java.lang.Long> listFileIds(java.lang.String token,
                                                  java.lang.Long projectId)
Parameters:
token -
projectId -
Returns:
list of shared file IDs according to specified parameters

listAllFiles

public java.util.List<SharedFile> listAllFiles()
Lists all files in the database without loading binary data.

Returns:
list of SharedFile or an empty list if there are none

getFileData

public byte[] getFileData(java.lang.Long fileId)
Parameters:
fileId - ID of a SharedFile
Returns:
binary data of a file by its ID or null