|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.emfstore.internal.client.model.filetransfer.FileTransferCacheManager
public class FileTransferCacheManager
This class manages the locally cached files for file transfers. A cache manager instance is contained in every FileTransferManager. No other cache managers should be created.
Field Summary | |
---|---|
static String |
ATTACHMENT_FOLDER
Attachment folder for uploads and downloads. |
static String |
FILE_NAME_DELIMITER
The delimiter that separates file attachment id, file version and file name in an uploaded file. |
static String |
PROJECT_FOLDER_PREFIX
project folder prefix. |
static String |
TEMP_FOLDER
Temporary folder for file uploads to server. |
Constructor Summary | |
---|---|
FileTransferCacheManager(ProjectSpace projectSpaceImpl)
Default constructor for a specific project space. |
Method Summary | |
---|---|
File |
cacheFile(File input,
FileIdentifier id)
Adds a file to the cache using a given id. |
File |
createTempFile(FileIdentifier id)
Creates a file in the temporary cache folder for a specified file id and returns it. |
File |
getCachedFile(FileIdentifier identifier)
Returns a cached file with a given identifier. |
static String |
getCacheFolder(ProjectSpace projectSpace)
Returns the default file cache folder of a given projectspace. |
boolean |
hasCachedFile(FileIdentifier identifier)
Returns true iff a file with this identifier is present in the cache. |
File |
moveTempFileToCache(FileIdentifier id)
This method moves a file from the temporary folder into the cache. |
File |
moveTempFileToCache(FileIdentifier id,
boolean overwrite)
This method moves a file from the temporary folder into the cache. |
boolean |
removeCachedFile(FileIdentifier fileIdentifier)
Removes a file from the cache. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TEMP_FOLDER
public static final String PROJECT_FOLDER_PREFIX
public static final String ATTACHMENT_FOLDER
public static final String FILE_NAME_DELIMITER
Constructor Detail |
---|
public FileTransferCacheManager(ProjectSpace projectSpaceImpl)
projectSpaceImpl
- the project space to which this cache belongs.Method Detail |
---|
public static String getCacheFolder(ProjectSpace projectSpace)
projectSpace
- the projectSpace
public boolean hasCachedFile(FileIdentifier identifier)
identifier
- the identifier of the file
public File getCachedFile(FileIdentifier identifier) throws FileTransferException
identifier
- the identifier of the file
FileTransferException
- if the file is not present in the cachepublic File cacheFile(File input, FileIdentifier id) throws IOException
input
- the file to be cachedid
- the id to be used for the file.
IOException
- any IO Exception that can occur during copying a filepublic File createTempFile(FileIdentifier id) throws FileTransferException
id
- the file id for which to create a temporary file
FileTransferException
- if an IO exception occurred during the creation of a new filepublic File moveTempFileToCache(FileIdentifier id) throws FileTransferException
id
- the id of the file which is to be moved
FileTransferException
- thrown if the temporary file does not exist, the final file
already exists, or if the rename operation which moves the
file failspublic File moveTempFileToCache(FileIdentifier id, boolean overwrite) throws FileTransferException
id
- the id of the file which is to be movedoverwrite
- whether to overwrite an existing file, if one with the given id is found
FileTransferException
- thrown if the temporary file does not exist, the final file
already exists, or if the rename operation which moves the
file failspublic boolean removeCachedFile(FileIdentifier fileIdentifier)
fileIdentifier
- the identifier of the file to be removed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |