Class FileSystemProvider

All Implemented Interfaces:
PageProvider, 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.

  • Field Details

  • Constructor Details

  • Method Details

    • putPageText

      public void putPageText​(Page page, java.lang.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 PageProvider
      putPageText in class AbstractFileProvider
      page - The WikiPage to save
      text - The text to save.
      ProviderException - If something goes wrong.
    • getPageInfo

      public Page getPageInfo​(java.lang.String page, int version) throws ProviderException
      Always returns the latest version, since FileSystemProvider does not support versioning. Returns info about the page.
      Specified by:
      getPageInfo in interface PageProvider
      getPageInfo in class AbstractFileProvider
      page - The page name
      version - The version number
      A filled WikiPage.
      ProviderException - If something goes wrong.
    • deletePage

      public void deletePage​(java.lang.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 PageProvider
      deletePage in class AbstractFileProvider
      pageName - Name of the page to be removed completely.
      ProviderException - If the page could not be removed for some reason.
    • movePage

      public void movePage​(java.lang.String from, java.lang.String to) throws ProviderException
      Move a page
      from - Name of the page to move.
      to - New name of the page.
      ProviderException - If the page could not be moved for some reason.