com.ecyrd.jspwiki.providers
Class CachingProvider

java.lang.Object
  |
  +--com.ecyrd.jspwiki.providers.CachingProvider
All Implemented Interfaces:
WikiPageProvider, WikiProvider

public class CachingProvider
extends java.lang.Object
implements WikiPageProvider

Heavily based on ideas by Chris Brooking.

Since:
1.6.4
Author:
Janne Jalkanen

Field Summary
 
Fields inherited from interface com.ecyrd.jspwiki.WikiProvider
LATEST_VERSION
 
Constructor Summary
CachingProvider()
           
 
Method Summary
 void deletePage(java.lang.String pageName)
          Removes an entire page from the repository.
 void deleteVersion(java.lang.String pageName, int version)
          Removes a specific version from the repository.
 java.util.Collection findPages(QueryItem[] query)
          Finds pages based on the query.
 java.util.Collection getAllChangedSince(java.util.Date date)
          Gets a list of recent changes.
 java.util.Collection getAllPages()
          Returns all pages.
 int getPageCount()
          Gets the number of pages.
 WikiPage getPageInfo(java.lang.String page, int version)
          Returns info about the page.
 java.lang.String getPageText(java.lang.String page, int version)
          Gets a specific version out of the repository.
 java.lang.String getProviderInfo()
          Return a valid HTML string for information.
 WikiPageProvider getRealProvider()
          Returns the actual used provider.
 java.util.List getVersionHistory(java.lang.String page)
          Returns version history.
 void initialize(java.util.Properties properties)
          Initializes the page provider.
 boolean pageExists(java.lang.String page)
          Return true, if page exists.
 void putPageText(WikiPage page, java.lang.String text)
          Attempts to save the page text for page "page".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingProvider

public CachingProvider()
Method Detail

initialize

public void initialize(java.util.Properties properties)
                throws NoRequiredPropertyException,
                       java.io.IOException
Description copied from interface: WikiProvider
Initializes the page provider.

Specified by:
initialize in interface WikiProvider
NoRequiredPropertyException
java.io.IOException

pageExists

public boolean pageExists(java.lang.String page)
Description copied from interface: WikiPageProvider
Return true, if page exists.

Specified by:
pageExists in interface WikiPageProvider

getPageText

public java.lang.String getPageText(java.lang.String page,
                                    int version)
                             throws ProviderException
Description copied from interface: WikiPageProvider
Gets a specific version out of the repository.

Specified by:
getPageText in interface WikiPageProvider
Parameters:
page - Name of the page to fetch.
version - Version of the page to fetch.
ProviderException

putPageText

public void putPageText(WikiPage page,
                        java.lang.String text)
                 throws ProviderException
Description copied from interface: WikiPageProvider
Attempts to save the page text for page "page".

Specified by:
putPageText in interface WikiPageProvider
ProviderException

getAllPages

public java.util.Collection getAllPages()
                                 throws ProviderException
Description copied from interface: WikiPageProvider
Returns all pages. Each element in the returned Collection should be a WikiPage.

Specified by:
getAllPages in interface WikiPageProvider
ProviderException

getAllChangedSince

public java.util.Collection getAllChangedSince(java.util.Date date)
Description copied from interface: WikiPageProvider
Gets a list of recent changes.

Specified by:
getAllChangedSince in interface WikiPageProvider

getPageCount

public int getPageCount()
                 throws ProviderException
Description copied from interface: WikiPageProvider
Gets the number of pages.

Specified by:
getPageCount in interface WikiPageProvider
ProviderException

findPages

public java.util.Collection findPages(QueryItem[] query)
Description copied from interface: WikiPageProvider
Finds pages based on the query.

Specified by:
findPages in interface WikiPageProvider

getPageInfo

public WikiPage getPageInfo(java.lang.String page,
                            int version)
                     throws ProviderException
Description copied from interface: WikiPageProvider
Returns info about the page.

Specified by:
getPageInfo in interface WikiPageProvider
ProviderException

getVersionHistory

public java.util.List getVersionHistory(java.lang.String page)
                                 throws ProviderException
Description copied from interface: WikiPageProvider
Returns version history. Each element should be a WikiPage.

Specified by:
getVersionHistory in interface WikiPageProvider
Returns:
A collection of wiki pages.
ProviderException

getProviderInfo

public java.lang.String getProviderInfo()
Description copied from interface: WikiProvider
Return a valid HTML string for information. May be anything.

Specified by:
getProviderInfo in interface WikiProvider

deleteVersion

public void deleteVersion(java.lang.String pageName,
                          int version)
                   throws ProviderException
Description copied from interface: WikiPageProvider
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.

Specified by:
deleteVersion in interface WikiPageProvider
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.

deletePage

public void deletePage(java.lang.String pageName)
                throws ProviderException
Description copied from interface: WikiPageProvider
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
Parameters:
pageName - Name of the page to be removed completely.
Throws:
ProviderException - If the page could not be removed for some reason.

getRealProvider

public WikiPageProvider getRealProvider()
Returns the actual used provider.

Since:
2.0