Package org.apache.wiki.providers
Class VersioningFileProvider
java.lang.Object
org.apache.wiki.providers.AbstractFileProvider
org.apache.wiki.providers.VersioningFileProvider
- All Implemented Interfaces:
PageProvider,WikiProvider
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
FieldsModifier and TypeFieldDescriptionstatic final StringName of the directory where the old versions are stored.static final StringName 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_PAGEDIRFields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeletePage(String page) Removes the relevant page directory under "OLD" -directory as well, but does not remove any extra subdirectories from it.voiddeleteVersion(String page, int version) Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy".getPageInfo(String page, int version) Always returns the latest version, since FileSystemProvider does not support versioning.getPageText(String page, int version) This implementation just returns the current version, as filesystem does not provide versioning information for now.getVersionHistory(String page) The FileSystemProvider provides only one version.voidinitialize(Engine engine, Properties properties) voidbooleanpageExists(String pageName, int version) voidputPageText(Page page, String text) Methods inherited from class org.apache.wiki.providers.AbstractFileProvider
addCustomProperties, findPage, findPages, getAllChangedSince, getCustomProperties, getPageCount, mangleName, pageExists, setCustomProperties, unmangleName, validateCustomPageProperties
-
Field Details
-
PAGEDIR
Name of the directory where the old versions are stored.- See Also:
-
PROPERTYFILE
Name of the property file which stores the metadata.- See Also:
-
-
Constructor Details
-
VersioningFileProvider
public VersioningFileProvider()
-
-
Method Details
-
initialize
public void initialize(Engine engine, Properties properties) throws NoRequiredPropertyException, IOException - Specified by:
initializein interfaceWikiProvider- Overrides:
initializein classAbstractFileProvider- Throws:
FileNotFoundException- If the specified page directory does not exist.IOException- In case the specified page directory is a file, not a directory.NoRequiredPropertyException
-
getPageText
This implementation just returns the current version, as filesystem does not provide versioning information for now.- Specified by:
getPageTextin interfacePageProvider- Overrides:
getPageTextin classAbstractFileProvider- Throws:
ProviderException
-
putPageText
- Specified by:
putPageTextin interfacePageProvider- Overrides:
putPageTextin classAbstractFileProvider- Throws:
ProviderException
-
getPageInfo
Always returns the latest version, since FileSystemProvider does not support versioning.- Specified by:
getPageInfoin interfacePageProvider- Overrides:
getPageInfoin classAbstractFileProvider- Throws:
ProviderException
-
pageExists
- Specified by:
pageExistsin interfacePageProvider- Overrides:
pageExistsin classAbstractFileProvider
-
getVersionHistory
The FileSystemProvider provides only one version.- Specified by:
getVersionHistoryin interfacePageProvider- Overrides:
getVersionHistoryin classAbstractFileProvider- Throws:
ProviderException
-
deletePage
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:
deletePagein interfacePageProvider- Overrides:
deletePagein classAbstractFileProvider- Parameters:
page-- Throws:
ProviderException
-
deleteVersion
Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy". Using deleteVersion() is definitely not recommended.- Specified by:
deleteVersionin interfacePageProvider- Overrides:
deleteVersionin classAbstractFileProvider- Throws:
ProviderException
-
getAllPages
- Specified by:
getAllPagesin interfacePageProvider- Overrides:
getAllPagesin classAbstractFileProvider- Throws:
ProviderException
-
getProviderInfo
- Specified by:
getProviderInfoin interfaceWikiProvider- Overrides:
getProviderInfoin classAbstractFileProvider
-
movePage
-