Writing a Settings Storage Provider

Modified on Sun, 14 Feb 2010 15:05 by Dario Solera — Categorized as: Development, dotNET Development, Plugins and Providers

This page is a considered complete and accurate. However, if you find an error, please take the time report it.

In this short article we are going to learn how to write a simple Settings Storage Provider for ScrewTurn Wiki 3.0 (STW from now on). A Settings Storage Provider is a type of plugin that handles storage of system data and configuration.

Introduction to Settings Storage Providers

This brief section assumes you have already a general knowledge on STW providers.

The main tasks a Settings Storage Provider performs are:


For its nature, a Settings Storage Provider cannot be read-only.

Important note: all providers should be totally thread-safe.

System Configuration

System configuration consists in a list of key, value entries, both strings, not allowing new-lines or pipes.

The following methods are used by the wiki application for managing system configuration:


Log Management

The log consists in a list of entries, each represented by an instance of the LogEntry class, that contains a message, the user associated with the logged operation, the level (Error, Warning, General) and the date/time the entry was recorded.

The following methods are used by the wiki application to manage the log:


Meta Data Items Management

Meta data items are pieces of content like the header, sidebar and footer. They're namespace-specific, thus each method that handles them has a "tag" parameter that is generally used for distinguishing the namespace (but might be used for other purposes in the future). Valid items are defined in the MetaDataItem enumeration.

The wiki application calls the following methods:


Recent Changes Management

Recent changes describe the last activities performed by users in the wiki, such as page editing. Each entry, represented by the RecentChange class, contains information such as the date/time of the change, the author, the page affected, the title of the page or the subject of the message (if the change refers to a message rather than a page), and so on. Any of these properties might be null, depending on the information available when the entry is generated by the application.

The following methods are used by the wiki engine to manage recent changes:


Plugins Management

Plugin assemblies are stored by the Settings Storage Provider, which also handles plugins configuration.

The following methods take part into the plugins management:




ACL Management

ACL management is done via the provider's AclManager read-only property, that returns an instance of a class that implements the IAclManager interface. Such interface allows the wiki engine to store and retrieve instances of the AclEntry class, containing:


The IAclManager interface defines the following methods:


Page Links Graph Management

The wiki application stores an (oriented, possibly cyclic) graph of links between pages. Such graph is managed using the following methods:


Miscellanea

The following methods are also defined and used: