|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ecyrd.jspwiki.providers.AbstractFileProvider
com.ecyrd.jspwiki.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.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 com.ecyrd.jspwiki.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 com.ecyrd.jspwiki.providers.AbstractFileProvider |
---|
DEFAULT_ENCODING, FILE_EXT, m_encoding, m_engine, PROP_PAGEDIR |
Fields inherited from interface com.ecyrd.jspwiki.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. The implementations should really do no more security checks, since that is the domain of the PageManager. Just delete it as efficiently as you can. Deleting versions has never really worked, JSPWiki assumes that version histories are "not gappy". |
Collection |
getAllPages()
Returns all pages. Each element in the returned Collection should be a WikiPage. |
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. May be anything. |
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". Note that the provider creates a new version regardless of what the version parameter of the WikiPage is. |
Methods inherited from class com.ecyrd.jspwiki.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 WikiProvider
initialize
in class AbstractFileProvider
engine
- 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 WikiPageProvider
getPageText
in class AbstractFileProvider
page
- 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 WikiPageProvider
putPageText
in class AbstractFileProvider
page
- 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 WikiPageProvider
getPageInfo
in class AbstractFileProvider
page
- The page nameversion
- The version number
ProviderException
- If something goes wrong.public boolean pageExists(String pageName, int version)
pageExists
in interface VersioningProvider
pageName
- The page name to check forversion
- The version to check
public List getVersionHistory(String page) throws ProviderException
getVersionHistory
in interface WikiPageProvider
getVersionHistory
in class AbstractFileProvider
page
- 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 WikiPageProvider
deletePage
in class AbstractFileProvider
page
- 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 WikiPageProvider
deleteVersion
in class AbstractFileProvider
page
- 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 WikiPageProvider
getAllPages
in class AbstractFileProvider
ProviderException
- If something goes wrong.public String getProviderInfo()
getProviderInfo
in interface WikiProvider
getProviderInfo
in class AbstractFileProvider
public void movePage(String from, String to) throws ProviderException
movePage
in interface WikiPageProvider
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 |