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.propertiesIn 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 String
Name of the directory where the old versions are stored.static final String
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
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".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.void
initialize
(Engine engine, Properties properties) void
boolean
pageExists
(String pageName, int version) void
putPageText
(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:
initialize
in interfaceWikiProvider
- Overrides:
initialize
in 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:
getPageText
in interfacePageProvider
- Overrides:
getPageText
in classAbstractFileProvider
- Throws:
ProviderException
-
putPageText
- Specified by:
putPageText
in interfacePageProvider
- Overrides:
putPageText
in classAbstractFileProvider
- Throws:
ProviderException
-
getPageInfo
Always returns the latest version, since FileSystemProvider does not support versioning.- Specified by:
getPageInfo
in interfacePageProvider
- Overrides:
getPageInfo
in classAbstractFileProvider
- Throws:
ProviderException
-
pageExists
- Specified by:
pageExists
in interfacePageProvider
- Overrides:
pageExists
in classAbstractFileProvider
-
getVersionHistory
The FileSystemProvider provides only one version.- Specified by:
getVersionHistory
in interfacePageProvider
- Overrides:
getVersionHistory
in 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:
deletePage
in interfacePageProvider
- Overrides:
deletePage
in 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:
deleteVersion
in interfacePageProvider
- Overrides:
deleteVersion
in classAbstractFileProvider
- Throws:
ProviderException
-
getAllPages
- Specified by:
getAllPages
in interfacePageProvider
- Overrides:
getAllPages
in classAbstractFileProvider
- Throws:
ProviderException
-
getProviderInfo
- Specified by:
getProviderInfo
in interfaceWikiProvider
- Overrides:
getProviderInfo
in classAbstractFileProvider
-
movePage
-