org.xwiki.store.filesystem.internal
Interface FilesystemStoreTools

All Known Implementing Classes:
DefaultFilesystemStoreTools

@Role
public interface FilesystemStoreTools

Tools for getting files to store data in the filesystem. These APIs are in flux and may change at any time without warning. This should be replaced by a module which provides a secure extension of java.io.File.

Since:
3.0M2

Method Summary
 Map<String,Map<Date,DeletedAttachmentFileProvider>> deletedAttachmentsForDocument(DocumentReference docRef)
          Get a map of dates of deletion by the document where the attachment was attached.
 AttachmentFileProvider getAttachmentFileProvider(XWikiAttachment attachment)
          Get an instance of AttachmentFileProvider which will save everything to do with an attachment in a separate location which is repeatable only with the same attachment name, and containing document.
 File getBackupFile(File storageFile)
          Get a backup file which for a given storage file.
 DeletedAttachmentFileProvider getDeletedAttachmentFileProvider(String pathToDirectory)
          Get a deleted attachment file provider from a path to the deleted attachment directory.
 DeletedAttachmentFileProvider getDeletedAttachmentFileProvider(XWikiAttachment attachment, Date deleteDate)
          Get an instance of AttachmentFileProvider which will save everything to do with an attachment in a separate location which is repeatable only with the same attachment name, containing document, and date of deletion.
 File getGlobalFile(String name)
          Get a file which is global for the entire installation.
 ReadWriteLock getLockForFile(File toLock)
          Get a ReadWriteLock which is unique to the given file.
 String getStorageLocationPath()
           
 File getTempFile(File storageFile)
          Get a temporary file which for a given storage file.
 

Method Detail

getBackupFile

File getBackupFile(File storageFile)
Get a backup file which for a given storage file. This file name will never collide with any other file gotten through this interface.

Parameters:
storageFile - the file to get a backup file for.
Returns:
a backup file with a name based on the name of the given file.

getTempFile

File getTempFile(File storageFile)
Get a temporary file which for a given storage file. This file name will never collide with any other file gotten through this interface.

Parameters:
storageFile - the file to get a temporary file for.
Returns:
a temporary file with a name based on the name of the given file.

getAttachmentFileProvider

AttachmentFileProvider getAttachmentFileProvider(XWikiAttachment attachment)
Get an instance of AttachmentFileProvider which will save everything to do with an attachment in a separate location which is repeatable only with the same attachment name, and containing document.

Parameters:
attachment - the attachment to get a tools for.
Returns:
a provider which will provide files with collision free path and repeatable with same inputs.

getDeletedAttachmentFileProvider

DeletedAttachmentFileProvider getDeletedAttachmentFileProvider(XWikiAttachment attachment,
                                                               Date deleteDate)
Get an instance of AttachmentFileProvider which will save everything to do with an attachment in a separate location which is repeatable only with the same attachment name, containing document, and date of deletion.

Parameters:
attachment - the attachment to get a tools for.
deleteDate - the date the attachment was deleted.
Returns:
a provider which will provide files with collision free path and repeatable with same inputs.

deletedAttachmentsForDocument

Map<String,Map<Date,DeletedAttachmentFileProvider>> deletedAttachmentsForDocument(DocumentReference docRef)
Get a map of dates of deletion by the document where the attachment was attached.

Parameters:
docRef - a reference to the document to get deleted attachments for.
Returns:
a map of maps which provide FileProviders by deletion dates and filenames.

getStorageLocationPath

String getStorageLocationPath()
Returns:
the absolute path to the directory where the files are stored.

getGlobalFile

File getGlobalFile(String name)
Get a file which is global for the entire installation.

Parameters:
name - a unique identifier for the file.
Returns:
a file unique to the given name.

getDeletedAttachmentFileProvider

DeletedAttachmentFileProvider getDeletedAttachmentFileProvider(String pathToDirectory)
Get a deleted attachment file provider from a path to the deleted attachment directory.

Parameters:
pathToDirectory - a relitive path to the directory where the deleted attachment is.
Returns:
a DeletedAttachmentFileProvider which will provide files for that deleted attachment.

getLockForFile

ReadWriteLock getLockForFile(File toLock)
Get a ReadWriteLock which is unique to the given file. This method will always return the same lock for the path on the filesystem even if the File object is different.

Parameters:
toLock - the file to get a lock for.
Returns:
a lock for the given file.