Package org.apache.wiki.providers

# Class VersioningFileProvider

java.lang.Object
org.apache.wiki.providers.AbstractFileProvider
org.apache.wiki.providers.VersioningFileProvider

All Implemented Interfaces:
  `org.apache.wiki.api.providers.PageProvider`, `org.apache.wiki.api.providers.WikiProvider`

public class VersioningFileProvider extends AbstractFileProvider
Provides a simple directory based repository for Wiki pages. Pages are held in a directory structure:

        Main.txt
        Foobar.txt
        OLD/
           Main/
              1.txt
              2.txt
              page.properties
           Foobar/
              page.properties

In this case, "Main" has three versions, and "Foobar" just one version.

The properties file contains the necessary metainformation (such as author) information of the page. DO NOT MESS WITH IT!

All files have ".txt" appended to make life easier for those who insist on using Windows or other software which makes assumptions on the files contents based on its name.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.wiki.providers.AbstractFileProvider

`AbstractFileProvider.WikiFileFilter`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`PAGEDIR`
Name of the directory where the old versions are stored.
`static final String`
`PROPERTYFILE`
Name of the property file which stores the metadata.

### Fields inherited from class org.apache.wiki.providers.AbstractFileProvider

`DEFAULT_ENCODING, DEFAULT_MAX_PROPKEYLENGTH, DEFAULT_MAX_PROPLIMIT, DEFAULT_MAX_PROPVALUELENGTH, FILE_EXT, m_encoding, m_engine, MAX_PROPKEYLENGTH, MAX_PROPLIMIT, MAX_PROPVALUELENGTH, PROP_CUSTOMPROP_MAXKEYLENGTH, PROP_CUSTOMPROP_MAXLIMIT, PROP_CUSTOMPROP_MAXVALUELENGTH, PROP_PAGEDIR`

### Fields inherited from interface org.apache.wiki.api.providers.WikiProvider

`LATEST_VERSION`

## Constructor Summary

Constructors
Constructor
Description
`VersioningFileProvider()`

## Method Summary

Modifier and Type
Method
Description
`void`
`deletePage(String page)`
Removes the relevant page directory under "OLD" -directory as well, but does not remove any extra subdirectories from it.
`void`
`deleteVersion(String page, int version)`
Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy".
`Collection<org.apache.wiki.api.core.Page>`
`getAllPages()`
`org.apache.wiki.api.core.Page`
`getPageInfo(String page, int version)`
Always returns the latest version, since FileSystemProvider does not support versioning.
`String`
`getPageText(String page, int version)`
This implementation just returns the current version, as filesystem does not provide versioning information for now.
`String`
`getProviderInfo()`
`List<org.apache.wiki.api.core.Page>`
`getVersionHistory(String page)`
The FileSystemProvider provides only one version.
`void`
`initialize(org.apache.wiki.api.core.Engine engine, Properties properties)`
`void`
`movePage(String from, String to)`
`boolean`
`pageExists(String pageName, int version)`
`void`
`putPageText(org.apache.wiki.api.core.Page page, String text)`

### Methods inherited from class org.apache.wiki.providers.AbstractFileProvider

`addCustomProperties, deobfuscate, findPage, findPages, getAllChangedSince, getCustomProperties, getPageCount, mangleName, obfuscate, pageExists, setCustomProperties, unmangleName, validateCustomPageProperties`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### PAGEDIR

public static final String PAGEDIR
Name of the directory where the old versions are stored.

See Also:
  - Constant Field Values

### PROPERTYFILE

public static final String PROPERTYFILE
Name of the property file which stores the metadata.

See Also:
  - Constant Field Values

## Constructor Details

### VersioningFileProvider

public VersioningFileProvider()

## Method Details

### initialize

public void initialize(org.apache.wiki.api.core.Engine engine, Properties properties) throws org.apache.wiki.api.exceptions.NoRequiredPropertyException, IOException

Specified by:
  `initialize` in interface `org.apache.wiki.api.providers.WikiProvider`
Overrides:
  `initialize` in class `AbstractFileProvider`
Throws:
  `FileNotFoundException` - If the specified page directory does not exist.
  `IOException` - In case the specified page directory is a file, not a directory.
  `org.apache.wiki.api.exceptions.NoRequiredPropertyException`

### getPageText

public String getPageText(String page, int version) throws org.apache.wiki.api.exceptions.ProviderException
This implementation just returns the current version, as filesystem does not provide versioning information for now.

Specified by:
  `getPageText` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `getPageText` in class `AbstractFileProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### putPageText

public void putPageText(org.apache.wiki.api.core.Page page, String text) throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `putPageText` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `putPageText` in class `AbstractFileProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### getPageInfo

public org.apache.wiki.api.core.Page getPageInfo(String page, int version) throws org.apache.wiki.api.exceptions.ProviderException
Always returns the latest version, since FileSystemProvider does not support versioning.

Specified by:
  `getPageInfo` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `getPageInfo` in class `AbstractFileProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### pageExists

public boolean pageExists(String pageName, int version)

Specified by:
  `pageExists` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `pageExists` in class `AbstractFileProvider`

### getVersionHistory

public List<org.apache.wiki.api.core.Page> getVersionHistory(String page) throws org.apache.wiki.api.exceptions.ProviderException
The FileSystemProvider provides only one version.

Specified by:
  `getVersionHistory` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `getVersionHistory` in class `AbstractFileProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### deletePage

public void deletePage(String page) throws org.apache.wiki.api.exceptions.ProviderException
Removes the relevant page directory under "OLD" -directory as well, but does not remove any extra subdirectories from it. It will only touch those files that it thinks to be WikiPages.

Specified by:
  `deletePage` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `deletePage` in class `AbstractFileProvider`
Parameters:
  `page` -
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### deleteVersion

public void deleteVersion(String page, int version) throws org.apache.wiki.api.exceptions.ProviderException
Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy". Using deleteVersion() is definitely not recommended.

Specified by:
  `deleteVersion` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `deleteVersion` in class `AbstractFileProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### getAllPages

public Collection<org.apache.wiki.api.core.Page> getAllPages() throws org.apache.wiki.api.exceptions.ProviderException

Specified by:
  `getAllPages` in interface `org.apache.wiki.api.providers.PageProvider`
Overrides:
  `getAllPages` in class `AbstractFileProvider`
Throws:
  `org.apache.wiki.api.exceptions.ProviderException`

### getProviderInfo

public String getProviderInfo()

Specified by:
  `getProviderInfo` in interface `org.apache.wiki.api.providers.WikiProvider`
Overrides:
  `getProviderInfo` in class `AbstractFileProvider`

### movePage

public void movePage(String from, String to)