ScrewTurn Wiki is looking for volunteers.
Head to
our blog
for details.
Search:
»
Welcome,
Guest
•
Login
Jump to
<root>
Customize
Dev
Help
Download
Help + Forum
Customize
Develop
Blog
ScrewTurn Wiki Hosting
Issue Tracker
Plugins and Providers
Themes
Back
Writing a Files Storage Provider
Modified on Sun, 14 Feb 2010 12:40
by
Dario Solera
Categorized as
Development
,
dotNET Development
,
Plugins and Providers
{s:Complete} In this short article we are going to learn how to write a simple Files Storage Provider for ScrewTurn Wiki 3.0 (STW from now on). A Files Storage Provider is a type of plugin that handles files-related data such as uploaded files/directories and page attachments ==Introduction to Files Storage Providers== This brief section assumes you have already a [ProvidersIntro|general knowledge] on STW providers. The main task a Files Storage Provider performs is handling the following data on behalf of the wiki application: * upload directories * upload files * page attachments. '''Note''': in case of ''read-only'' data ({{ReadOnly}} property returning {{true}}) the wiki application should never call methods that are intended for altering data. However, such methods that return collections should return empty collections instead of {{null}}. Methods that return single elements should return {{null}} instead. All paths are specified in a UNIX-like format, for example {{/path/to/file.txt}}, but all paths are ''case-insensitive''. All paths must start with a slash, and all directory paths must end with a slash too. ((('''Important note''': all providers should be totally '''thread-safe'''.))) ==Directories Management== The following methods are called by the wiki application to manage directories: * {{ListDirectories}} lists directories inside the specified directory * {{CreateDirectory}} creates a directory inside the specified directory * {{DeleteDirectory}} deletes a directory and all data inside it (files and sub-directories) * {{RenameDirectory}} renames a directory. ==Files Management== The following methods are called by the wiki application to manage files: * {{ListFiles}} lists files inside the specified directory * {{StoreFile}} stores a file inside the specified directory, reading from a source {{Stream}} and optionally counting the download * {{RetrieveFile}} retrieves a file, writing into a destination {{Stream}} * {{GetFileDetails}} returns an instance of {{FileDetails}} (or {{null}} if the file does not exist) containing information about the file (such as the size and number of downloads) * {{SetFileRetrievalCount}} sets the number of times a file has been downloaded * {{DeleteFile}} deletes a file and its download count * {{RenameFile}} renames a file, preserving its download count. ==Page Attachment Management== The following methods are called by the wiki application to manage page attachments: * {{GetPagesWithAttachments}} lists the names of the pages that have at least one attachment * {{ListPageAttachments}} lists the attachments a page has * {{StorePageAttachment}} stores an attachment for the specified page, reading from a source {{Stream}} * {{RetrievePageAttachment}} retrieves an attachment for the specified page, writing to a destination {{Stream}} and optionally counting the download * {{GetPageAttachmentDetails}} returns an instance of {{FileDetails}} (or {{null}} if the attachment does not exist}} containing information about the attachment (such as the size and number of downloads) * {{SetPageAttachmentRetrievalCount}} sets the number of time an attachment has been downloaded * {{DeletePageAttachment}} deletes a page attachment and its download count * {{RenamePageAttachment}} renames a page attachment, preserving its download count * {{NotifyPageRenaming}} is called when a page is renamed (the provider should use this information to preserve the attachments data as well as their download count).
Meta Keywords:
Meta Description:
Change Comment:
Side Projects
¶
RESX Synchronizer
allows to synchronize multi-language
.resx
files (used for the development of ScrewTurn Wiki).
Pixel Picker
enables to pick the color of pixels on your screen — very handy for day-to-day graphics-related activities.
About
¶
Copyright ©2006-2012 Dario Solera, Matteo Tomasini and
contributors
. All rights reserved. Some of the icons created by
FamFamFam
.
Contact us
See our
Privacy Policy
.
Powered by ScrewTurn Wiki 3.0.5.613.
This namespace contains 11 pages.