Class CachingProvider

java.lang.Object
org.apache.wiki.providers.CachingProvider
All Implemented Interfaces:
org.apache.wiki.api.providers.PageProvider, org.apache.wiki.api.providers.WikiProvider

public class CachingProvider extends Object implements org.apache.wiki.api.providers.PageProvider
Provides a caching page provider. This class rests on top of a real provider class and provides a cache to speed things up. Only if the cache copy of the page text has expired, we fetch it from the provider.

This class does not detect if someone has modified the page externally, not through JSPWiki routines.

Heavily based on ideas by Chris Brooking.

Since 2.10 uses the Ehcache library.

Since:
1.6.4
  • Constructor Details

  • Method Details

    • initialize

      public void initialize(org.apache.wiki.api.core.Engine engine, Properties properties) throws org.apache.wiki.api.exceptions.NoRequiredPropertyException, IOException
      Specified by:
      initialize in interface org.apache.wiki.api.providers.WikiProvider
      Throws:
      org.apache.wiki.api.exceptions.NoRequiredPropertyException
      IOException
    • pageExists

      public boolean pageExists(String pageName, int version)
      Specified by:
      pageExists in interface org.apache.wiki.api.providers.PageProvider
    • pageExists

      public boolean pageExists(String pageName)
      Specified by:
      pageExists in interface org.apache.wiki.api.providers.PageProvider
    • getPageText

      public String getPageText(String pageName, int version) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getPageText in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • putPageText

      public void putPageText(org.apache.wiki.api.core.Page page, String text) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      putPageText in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getAllPages

      public Collection<org.apache.wiki.api.core.Page> getAllPages() throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getAllPages in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getAllChangedSince

      public Collection<org.apache.wiki.api.core.Page> getAllChangedSince(Date date)
      Specified by:
      getAllChangedSince in interface org.apache.wiki.api.providers.PageProvider
    • getPageCount

      public int getPageCount() throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getPageCount in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • findPages

      public Collection<org.apache.wiki.api.search.SearchResult> findPages(org.apache.wiki.api.search.QueryItem[] query)
      Specified by:
      findPages in interface org.apache.wiki.api.providers.PageProvider
    • getPageInfo

      public org.apache.wiki.api.core.Page getPageInfo(String pageName, int version) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getPageInfo in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getVersionHistory

      public List<org.apache.wiki.api.core.Page> getVersionHistory(String pageName) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      getVersionHistory in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getProviderInfo

      Gets the provider class name, and cache statistics (misscount and hitcount of page cache and history cache).
      Specified by:
      getProviderInfo in interface org.apache.wiki.api.providers.WikiProvider
      Returns:
      A plain string with all the above-mentioned values.
    • deleteVersion

      public void deleteVersion(String pageName, int version) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      deleteVersion in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • deletePage

      public void deletePage(String pageName) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      deletePage in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • movePage

      public void movePage(String from, String to) throws org.apache.wiki.api.exceptions.ProviderException
      Specified by:
      movePage in interface org.apache.wiki.api.providers.PageProvider
      Throws:
      org.apache.wiki.api.exceptions.ProviderException
    • getRealProvider

      public org.apache.wiki.api.providers.PageProvider getRealProvider()
      Returns the actual used provider.
      Returns:
      The real provider.
      Since:
      2.0