|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wiki.providers.AbstractFileProvider
org.apache.wiki.providers.VersioningFileProvider
public class VersioningFileProvider

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 | |
|---|---|
static String |
PAGEDIR
Name of the directory where the old versions are stored. |
static String |
PROPERTYFILE
Name of the property file which stores the metadata. |
| Fields inherited from class org.apache.wiki.providers.AbstractFileProvider |
|---|
DEFAULT_ENCODING, FILE_EXT, m_encoding, m_engine, PROP_PAGEDIR |
| Fields inherited from interface org.apache.wiki.WikiProvider |
|---|
LATEST_VERSION |
| Constructor Summary | |
|---|---|
VersioningFileProvider()
|
|
| Method Summary | |
|---|---|
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)
Removes a specific version from the repository. |
Collection |
getAllPages()
Returns all pages. |
WikiPage |
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()
Return a valid HTML string for information. |
List |
getVersionHistory(String page)
The FileSystemProvider provides only one version. |
void |
initialize(WikiEngine engine,
Properties properties)
Initializes the page provider. |
void |
movePage(String from,
String to)
Move a page |
boolean |
pageExists(String pageName,
int version)
Return true, if page with a particular version exists. |
void |
putPageText(WikiPage page,
String text)
Attempts to save the page text for page "page". |
| Methods inherited from class org.apache.wiki.providers.AbstractFileProvider |
|---|
findPage, findPages, getAllChangedSince, getPageCount, mangleName, pageExists, unmangleName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PAGEDIR
public static final String PROPERTYFILE
| Constructor Detail |
|---|
public VersioningFileProvider()
| Method Detail |
|---|
public void initialize(WikiEngine engine,
Properties properties)
throws NoRequiredPropertyException,
IOException
initialize in interface WikiProviderinitialize in class AbstractFileProviderengine - WikiEngine to own this providerproperties - A set of properties used to initialize this provider
NoRequiredPropertyException - If the provider needs a property which is not found in the property set
FileNotFoundException - If the specified page directory does not exist.
IOException - In case the specified page directory is a file, not a directory.
public String getPageText(String page,
int version)
throws ProviderException
getPageText in interface WikiPageProvidergetPageText in class AbstractFileProviderpage - Name of the page to fetch.version - Version of the page to fetch.
ProviderException - If something goes wrong.
public void putPageText(WikiPage page,
String text)
throws ProviderException
putPageText in interface WikiPageProviderputPageText in class AbstractFileProviderpage - The WikiPage to savetext - The text to save.
ProviderException - If something goes wrong.
public WikiPage getPageInfo(String page,
int version)
throws ProviderException
getPageInfo in interface WikiPageProvidergetPageInfo in class AbstractFileProviderpage - The page nameversion - The version number
ProviderException - If something goes wrong.
public boolean pageExists(String pageName,
int version)
pageExists in interface WikiPageProviderpageExists in class AbstractFileProviderpageName - The page name to check forversion - The version to check
public List getVersionHistory(String page)
throws ProviderException
getVersionHistory in interface WikiPageProvidergetVersionHistory in class AbstractFileProviderpage - The name of the page to get the history from.
ProviderException - If something goes wrong.
public void deletePage(String page)
throws ProviderException
deletePage in interface WikiPageProviderdeletePage in class AbstractFileProviderpage - Name of the page to be removed completely.
{@inheritDoc}
ProviderException - If the page could not be removed for some reason.
public void deleteVersion(String page,
int version)
throws ProviderException
deleteVersion in interface WikiPageProviderdeleteVersion in class AbstractFileProviderpage - Name of the page to be removed.version - Version of the page to be removed. May be LATEST_VERSION.
ProviderException - If the page cannot be removed for some reason.
public Collection getAllPages()
throws ProviderException
getAllPages in interface WikiPageProvidergetAllPages in class AbstractFileProviderProviderException - If something goes wrong.public String getProviderInfo()
getProviderInfo in interface WikiProvidergetProviderInfo in class AbstractFileProvider
public void movePage(String from,
String to)
throws ProviderException
from - Name of the page to move.to - New name of the page.
ProviderException - If the page could not be moved for some reason.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||