public class VersioningFileProvider extends AbstractFileProvider
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.
AbstractFileProvider.WikiFileFilter| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PAGEDIR
Name of the directory where the old versions are stored.
|
static java.lang.String |
PROPERTYFILE
Name of the property file which stores the metadata.
|
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_PAGEDIRLATEST_VERSION| Constructor and Description |
|---|
VersioningFileProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
deletePage(java.lang.String page)
Removes the relevant page directory under "OLD" -directory as well, but does not remove any extra subdirectories from it.
|
void |
deleteVersion(java.lang.String page,
int version)
Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy".
|
java.util.Collection<Page> |
getAllPages() |
Page |
getPageInfo(java.lang.String page,
int version)
Always returns the latest version, since FileSystemProvider
does not support versioning.
|
java.lang.String |
getPageText(java.lang.String page,
int version)
This implementation just returns the current version, as filesystem does not provide versioning information for now.
|
java.lang.String |
getProviderInfo() |
java.util.List<Page> |
getVersionHistory(java.lang.String page)
The FileSystemProvider provides only one version.
|
void |
initialize(Engine engine,
java.util.Properties properties) |
void |
movePage(java.lang.String from,
java.lang.String to) |
boolean |
pageExists(java.lang.String pageName,
int version) |
void |
putPageText(Page page,
java.lang.String text) |
addCustomProperties, findPage, findPages, getAllChangedSince, getCustomProperties, getPageCount, mangleName, pageExists, setCustomProperties, unmangleName, validateCustomPagePropertiespublic static final java.lang.String PAGEDIR
public static final java.lang.String PROPERTYFILE
public VersioningFileProvider()
public void initialize(Engine engine, java.util.Properties properties) throws NoRequiredPropertyException, java.io.IOException
initialize in interface WikiProviderinitialize in class AbstractFileProviderjava.io.FileNotFoundException - If the specified page directory does not exist.java.io.IOException - In case the specified page directory is a file, not a directory.NoRequiredPropertyExceptionpublic java.lang.String getPageText(java.lang.String page, int version) throws ProviderException
getPageText in interface PageProvidergetPageText in class AbstractFileProviderProviderExceptionpublic void putPageText(Page page, java.lang.String text) throws ProviderException
putPageText in interface PageProviderputPageText in class AbstractFileProviderProviderExceptionpublic Page getPageInfo(java.lang.String page, int version) throws ProviderException
getPageInfo in interface PageProvidergetPageInfo in class AbstractFileProviderProviderExceptionpublic boolean pageExists(java.lang.String pageName, int version)
pageExists in interface PageProviderpageExists in class AbstractFileProviderpublic java.util.List<Page> getVersionHistory(java.lang.String page) throws ProviderException
getVersionHistory in interface PageProvidergetVersionHistory in class AbstractFileProviderProviderExceptionpublic void deletePage(java.lang.String page) throws ProviderException
deletePage in interface PageProviderdeletePage in class AbstractFileProviderpage - {@inheritDoc}ProviderExceptionpublic void deleteVersion(java.lang.String page, int version) throws ProviderException
deleteVersion in interface PageProviderdeleteVersion in class AbstractFileProviderProviderExceptionpublic java.util.Collection<Page> getAllPages() throws ProviderException
getAllPages in interface PageProvidergetAllPages in class AbstractFileProviderProviderExceptionpublic java.lang.String getProviderInfo()
getProviderInfo in interface WikiProvidergetProviderInfo in class AbstractFileProviderpublic void movePage(java.lang.String from, java.lang.String to)
Copyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.