Welcome Guest, you are in: Login

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

A provider in ScrewTurn Wiki v.5 (STW from now on) is a component that you can install in the wiki application and let it perform some work.

There are several types of providers, each defined by a specific .NET interface:

  • Formatter Provider (IFormatterProviderV50): add customized processing steps for altering/rendering page content.
  • Settings Storage Provider (ISettingsStorageProviderV50): store custom settings and log storage provider
  • Global Settings Storage Provider (IGlobalSettingsStorageProviderV50): store global application configuration settings
  • Index Directory Provider (IIndexDirectoryProviderV50): it is the interface that must be implemented in order to create a custom Index Directory Provider for search engine
  • Files Storage Provider (IFilesStorageProviderV50): stores files and page attachments
  • Pages Storage Provider (IPagesStorageProviderV50): stores pages and related data
  • Users Storage Provider (IUsersStorageProviderV50): stores user accounts and groups and related data
  • Themes Storage Provider (IThemesStorageProviderV50): stores custom Theme

Except for Settings Storage Providers (SSP) and Global Settings Storage Providers (GSP), you can install and load any number of providers for each type. SSP and GSP are single-instance components.

Common Members

Provider interfaces all inherit from the top interface IProviderV50, which defines the following members:

void Init(IHostV50 host, string config, string wiki);

void SetUp(IHostV50 host, string config);

ComponentInformation Information { get; }

string ConfigHelpHtml { get; }

Storage-related providers also have one or more boolean properties indicating whether the provider is read-only.

The Init method is invoked by the wiki runtime when the plugin is initialized: host is an instance of a class implementing the IHostV50 interface, allowing access to several wiki services; the config parameter is the plugin's custom configuration string as set by the system administrator. The Init method should throw an InvalidConfigurationException if the config parameter is invalid, specifying the reason of the failure in the exception message.

The SSetUp method is invoked when the plugin is being sets up the Storage Provider.

The Information property returns an instance of the ComponentInformation class, whose only purpose is to contain information about the plugin (see below for more information)

ConfigHelpHtml can optionally return a piece of HTML that is displayed to the system administrator when she is configuring the provider. The HTML can contain a very brief configuration reference and a link to a page containing detailed instructions. If not needed, the property can return null.

ComponentInformation

The ComponentInformation class is simply a data holder that contains the following information:

  • provider name (string)
  • provider author (string)
  • provider version (string)
  • provider info URL (string, optional)
  • provider update URL (string, optional).

The provider update URL, if present, should point to a text document with the following content:

V0|V1|V2|...|V_LAST
[URL_TO_UP_TO_DATE_DLL]

where V0, ..., V_LAST in the first line are the versions of the provider that have been sequentially released (V_LAST is the most up-to-date). The second line in the file is optional: if present, it should contain the URL of the most up-to-date DLL. If the provider update URL is specified, the wiki administration interface shows the update status of the provider. If the update file (published at the provider update URL) also contains the URL of the up-do-date DLL, then it is possible to update the provider in the administration interface, without any manual step.

A complete example of the update information file follows.

1.0.0|1.0.1|1.0.2
http://www.myserver.com/update/myplugins/MyPlugins.dll

Status

A provider can either be enabled or disabled and the status is preserved between application recycles. When transitioning from disabled to enabled or when loading an enabled provider the Init method is called.
By default, a provider is set to enabled the very first time it is loaded after installation: if either the constructor or Init throw an exception, then the provider is then set as disabled until any manual action.

Providers can be enabled and disabled from the administration interface of the wiki application.

Both enabled and disabled providers are kept in memory by the wiki runtime.

The IHostV50 Interface

The IHostV50 interface defines several methods and properties for performing the following activities:

  • getting configuration settings
  • finding pages, namespaces, categories, snippets and navigation paths
  • finding users and user groups
  • listing files, directories and page attachments
  • checking whether actions for certain resources (namespaces, pages, file directories, etc.) are allowed for a user
  • formatting content and preparing content for indexing in the search engine
  • performing searches
  • sending emails
  • logging messages
  • retrieving providers and their configuration.

The IHostV50 interface also defines events that can be subscribed to in order to listen for changes to users, pages, namespaces and files.

Implementing a Provider

As a general rule, you can create a custom provider by simply writing a .NET class that implements the appropriate interface and packaging it in a .NET class library (DLL file). A DLL can contain one or more providers of any type.

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

To get detailed information about implementing specific types of providers, please refer to the following pages:

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