using System; using System.Collections.Generic; using System.Text; using System.IO; namespace ScrewTurn.Wiki.PluginFramework { /// /// It is the interface that must be implemented in order to create a custom Files Storage Provider for ScrewTurn Wiki. /// /// A class that implements this interface should not have any kind of data caching. /// All directory paths are specified in a UNIX-like fashion, for example "/my/directory/myfile.jpg". /// All paths must start with '/'. All Directory paths must end with '/'. /// All paths are case-insensitive. public interface IFilesStorageProviderV30 : IStorageProviderV30 { /// /// Lists the Files in the specified Directory. /// /// The full directory name, for example "/my/directory". Null, empty or "/" for the root directory. /// The list of Files in the directory. /// If does not exist. string[] ListFiles(string directory); /// /// Lists the Directories in the specified directory. /// /// The full directory name, for example "/my/directory". Null, empty or "/" for the root directory. /// The list of Directories in the Directory. /// If does not exist. string[] ListDirectories(string directory); /// /// Stores a file. /// /// The full name of the file. /// A Stream object used as source of a byte stream, /// i.e. the method reads from the Stream and stores the content properly. /// true to overwrite an existing file. /// true if the File is stored, false otherwise. /// If overwrite is false and File already exists, the method returns false. /// If os are null. /// If is empty or does not support reading. bool StoreFile(string fullName, Stream sourceStream, bool overwrite); /// /// Retrieves a File. /// /// The full name of the File. /// A Stream object used as destination of a byte stream, /// i.e. the method writes to the Stream the file content. /// A value indicating whether or not to count this retrieval in the statistics. /// true if the file is retrieved, false otherwise. /// If os are null. /// If is empty or does not support writing, or if does not exist. bool RetrieveFile(string fullName, Stream destinationStream, bool countHit); /// /// Sets the number of times a file was retrieved. /// /// The full name of the file. /// The count to set. /// If is null. /// If is empty. /// If is less than zero. void SetFileRetrievalCount(string fullName, int count); /// /// Gets the details of a file. /// /// The full name of the file. /// The details, or null if the file does not exist. /// If is null. /// If is empty. FileDetails GetFileDetails(string fullName); /// /// Deletes a File. /// /// The full name of the File. /// true if the File is deleted, false otherwise. /// If is null. /// If is empty or it does not exist. bool DeleteFile(string fullName); /// /// Renames or moves a File. /// /// The old full name of the File. /// The new full name of the File. /// true if the File is renamed, false otherwise. /// If or are null. /// If or are empty, or if the old file does not exist, or if the new file already exist. bool RenameFile(string oldFullName, string newFullName); /// /// Creates a new Directory. /// /// The path to create the new Directory in. /// The name of the new Directory. /// true if the Directory is created, false otherwise. /// If path is "/my/directory" and name is "newdir", a new directory named "/my/directory/newdir" is created. /// If or are null. /// If is empty or if the directory does not exist, or if the new directory already exists. bool CreateDirectory(string path, string name); /// /// Deletes a Directory and all of its content. /// /// The full path of the Directory. /// true if the Directory is delete, false otherwise. /// If is null. /// If is empty or if it equals '/' or it does not exist. bool DeleteDirectory(string fullPath); /// /// Renames or moves a Directory. /// /// The old full path of the Directory. /// The new full path of the Directory. /// true if the Directory is renamed, false otherwise. /// If or are null. /// If or are empty or equal to '/', /// or if the old directory does not exist or the new directory already exists. bool RenameDirectory(string oldFullPath, string newFullPath); /// /// The the names of the pages with attachments. /// /// The names of the pages with attachments. string[] GetPagesWithAttachments(); /// /// Returns the names of the Attachments of a Page. /// /// The Page Info object that owns the Attachments. /// The names, or an empty list. /// If is null. string[] ListPageAttachments(PageInfo pageInfo); /// /// Stores a Page Attachment. /// /// The Page Info that owns the Attachment. /// The name of the Attachment, for example "myfile.jpg". /// A Stream object used as source of a byte stream, /// i.e. the method reads from the Stream and stores the content properly. /// true to overwrite an existing Attachment. /// true if the Attachment is stored, false otherwise. /// If overwrite is false and Attachment already exists, the method returns false. /// If , or are null. /// If is empty or if does not support reading. bool StorePageAttachment(PageInfo pageInfo, string name, Stream sourceStream, bool overwrite); /// /// Retrieves a Page Attachment. /// /// The Page Info that owns the Attachment. /// The name of the Attachment, for example "myfile.jpg". /// A Stream object used as destination of a byte stream, /// i.e. the method writes to the Stream the file content. /// A value indicating whether or not to count this retrieval in the statistics. /// true if the Attachment is retrieved, false otherwise. /// If , or are null. /// If is empty or if does not support writing, /// or if the page does not have attachments or if the attachment does not exist. bool RetrievePageAttachment(PageInfo pageInfo, string name, Stream destinationStream, bool countHit); /// /// Sets the number of times a page attachment was retrieved. /// /// The page. /// The name of the attachment. /// The count to set. /// If or are null. /// If is empty. /// If is less than zero. void SetPageAttachmentRetrievalCount(PageInfo pageInfo, string name, int count); /// /// Gets the details of a page attachment. /// /// The page that owns the attachment. /// The name of the attachment, for example "myfile.jpg". /// The details of the attachment, or null if the attachment does not exist. /// If or are null. /// If is empty. FileDetails GetPageAttachmentDetails(PageInfo pageInfo, string name); /// /// Deletes a Page Attachment. /// /// The Page Info that owns the Attachment. /// The name of the Attachment, for example "myfile.jpg". /// true if the Attachment is deleted, false otherwise. /// If or are null. /// If is empty or if the page or attachment do not exist. bool DeletePageAttachment(PageInfo pageInfo, string name); /// /// Renames a Page Attachment. /// /// The Page Info that owns the Attachment. /// The old name of the Attachment. /// The new name of the Attachment. /// true if the Attachment is renamed, false otherwise. /// If , or are null. /// If , or are empty, /// or if the page or old attachment do not exist, or the new attachment name already exists. bool RenamePageAttachment(PageInfo pageInfo, string oldName, string newName); /// /// Notifies the Provider that a Page has been renamed. /// /// The old Page Info object. /// The new Page Info object. /// If or are null. /// If the new page is already in use. void NotifyPageRenaming(PageInfo oldPage, PageInfo newPage); } }