com.ecyrd.jspwiki.providers
Interface WikiPageProvider

All Superinterfaces:
WikiProvider
All Known Implementing Classes:
AbstractFileProvider, CachingProvider, FileSystemProvider, RCSFileProvider, VersioningFileProvider

public interface WikiPageProvider
extends WikiProvider

Each Wiki page provider should implement this interface.

You can build whatever page providers based on this, just leave the unused methods do something useful.

WikiPageProvider uses Strings and ints to refer to pages. This may be a bit odd, since WikiAttachmentProviders all use Attachment instead of name/version. We will perhaps modify these in the future. In the mean time, name/version is quite sufficient.

FIXME: In reality we should have an AbstractWikiPageProvider, which would provide intelligent backups for subclasses.

Author:
Janne Jalkanen

Field Summary
 
Fields inherited from interface com.ecyrd.jspwiki.WikiProvider
LATEST_VERSION
 
Method Summary
 void deletePage(String pageName)
          Removes an entire page from the repository.
 void deleteVersion(String pageName, int version)
          Removes a specific version from the repository.
 Collection findPages(QueryItem[] query)
          Finds pages based on the query.
 Collection getAllChangedSince(Date date)
          Gets a list of recent changes.
 Collection getAllPages()
          Returns all pages.
 int getPageCount()
          Gets the number of pages.
 WikiPage getPageInfo(String page, int version)
          Returns info about the page.
 String getPageText(String page, int version)
          Gets a specific version out of the repository.
 List getVersionHistory(String page)
          Returns version history.
 void movePage(String from, String to)
          Move a page
 boolean pageExists(String page)
          Return true, if page exists.
 void putPageText(WikiPage page, String text)
          Attempts to save the page text for page "page".
 
Methods inherited from interface com.ecyrd.jspwiki.WikiProvider
getProviderInfo, initialize
 

Method Detail

putPageText

void putPageText(WikiPage page,
                 String text)
                 throws ProviderException
Attempts to save the page text for page "page".

Throws:
ProviderException

pageExists

boolean pageExists(String page)
Return true, if page exists.


findPages

Collection findPages(QueryItem[] query)
Finds pages based on the query.


getPageInfo

WikiPage getPageInfo(String page,
                     int version)
                     throws ProviderException
Returns info about the page.

Throws:
ProviderException

getAllPages

Collection getAllPages()
                       throws ProviderException
Returns all pages. Each element in the returned Collection should be a WikiPage.

Throws:
ProviderException

getAllChangedSince

Collection getAllChangedSince(Date date)
Gets a list of recent changes.

Since:
1.6.4

getPageCount

int getPageCount()
                 throws ProviderException
Gets the number of pages.

Throws:
ProviderException
Since:
1.6.4

getVersionHistory

List getVersionHistory(String page)
                       throws ProviderException
Returns version history. Each element should be a WikiPage.

Returns:
A collection of wiki pages.
Throws:
ProviderException

getPageText

String getPageText(String page,
                   int version)
                   throws ProviderException
Gets a specific version out of the repository.

Parameters:
page - Name of the page to fetch.
version - Version of the page to fetch.
Returns:
The content of the page, or null, if the page does not exist.
Throws:
ProviderException

deleteVersion

void deleteVersion(String pageName,
                   int version)
                   throws ProviderException
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.

Parameters:
pageName - Name of the page to be removed.
version - Version of the page to be removed. May be LATEST_VERSION.
Throws:
ProviderException - If the page cannot be removed for some reason.
Since:
2.0.17.

deletePage

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...

Parameters:
pageName - Name of the page to be removed completely.
Throws:
ProviderException - If the page could not be removed for some reason.
Since:
2.0.17.

movePage

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.