org.apache.wiki.providers
Class FileSystemProvider

java.lang.Object
  extended by org.apache.wiki.providers.AbstractFileProvider
      extended by org.apache.wiki.providers.FileSystemProvider
All Implemented Interfaces:
WikiPageProvider, WikiProvider

public class FileSystemProvider
extends AbstractFileProvider

Provides a simple directory based repository for Wiki pages.

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 PROP_EXT
          All metadata is stored in a file with this extension.
 
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
FileSystemProvider()
           
 
Method Summary
 void deletePage(String pageName)
          Removes an entire page from the repository.
 WikiPage getPageInfo(String page, int version)
          Always returns the latest version, since FileSystemProvider does not support versioning.
 void movePage(String from, String to)
          Move a page
 void putPageText(WikiPage page, String text)
          Attempts to save the page text for page "page".
 
Methods inherited from class org.apache.wiki.providers.AbstractFileProvider
deleteVersion, findPage, findPages, getAllChangedSince, getAllPages, getPageCount, getPageText, getProviderInfo, getVersionHistory, initialize, mangleName, pageExists, pageExists, unmangleName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_EXT

public static final String PROP_EXT
All metadata is stored in a file with this extension.

See Also:
Constant Field Values
Constructor Detail

FileSystemProvider

public FileSystemProvider()
Method Detail

putPageText

public void putPageText(WikiPage page,
                        String text)
                 throws ProviderException
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.

Specified by:
putPageText in interface WikiPageProvider
Overrides:
putPageText in class AbstractFileProvider
Parameters:
page - The WikiPage to save
text - The text to save.
Throws:
ProviderException - If something goes wrong.

getPageInfo

public WikiPage getPageInfo(String page,
                            int version)
                     throws ProviderException
Always returns the latest version, since FileSystemProvider does not support versioning.

Specified by:
getPageInfo in interface WikiPageProvider
Overrides:
getPageInfo in class AbstractFileProvider
Parameters:
page - The page name
version - The version number
Returns:
A filled WikiPage.
Throws:
ProviderException - If something goes wrong.

deletePage

public void deletePage(String pageName)
                throws ProviderException
Removes an entire page 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. You should also delete any auxiliary files that belong to this page, IF they were created by this provider.

The reason why this is named differently from deleteVersion() (logically, this method should be an overloaded version) is that I want to be absolutely sure I don't accidentally use the wrong method. With overloading something like that happens sometimes...

Specified by:
deletePage in interface WikiPageProvider
Overrides:
deletePage in class AbstractFileProvider
Parameters:
pageName - Name of the page to be removed completely.
Throws:
ProviderException - If the page could not be removed for some reason.

movePage

public void movePage(String from,
                     String to)
              throws ProviderException
Move a page

Parameters:
from - Name of the page to move.
to - New name of the page.
Throws:
ProviderException - If the page could not be moved for some reason.


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.