Package org.apache.wiki.providers
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
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
-
Field Summary
Fields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeletePage(String pageName) voiddeleteVersion(String pageName, int version) Collection<org.apache.wiki.api.search.SearchResult>findPages(org.apache.wiki.api.search.QueryItem[] query) Collection<org.apache.wiki.api.core.Page>getAllChangedSince(Date date) Collection<org.apache.wiki.api.core.Page>intorg.apache.wiki.api.core.PagegetPageInfo(String pageName, int version) getPageText(String pageName, int version) Gets the provider class name, and cache statistics (misscount and hitcount of page cache and history cache).org.apache.wiki.api.providers.PageProviderReturns the actual used provider.List<org.apache.wiki.api.core.Page>getVersionHistory(String pageName) voidinitialize(org.apache.wiki.api.core.Engine engine, Properties properties) voidbooleanpageExists(String pageName) booleanpageExists(String pageName, int version) voidputPageText(org.apache.wiki.api.core.Page page, String text)
-
Constructor Details
-
CachingProvider
public CachingProvider()
-
-
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:
initializein interfaceorg.apache.wiki.api.providers.WikiProvider- Throws:
org.apache.wiki.api.exceptions.NoRequiredPropertyExceptionIOException
-
pageExists
- Specified by:
pageExistsin interfaceorg.apache.wiki.api.providers.PageProvider
-
pageExists
- Specified by:
pageExistsin interfaceorg.apache.wiki.api.providers.PageProvider
-
getPageText
public String getPageText(String pageName, int version) throws org.apache.wiki.api.exceptions.ProviderException - Specified by:
getPageTextin interfaceorg.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:
putPageTextin interfaceorg.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:
getAllPagesin interfaceorg.apache.wiki.api.providers.PageProvider- Throws:
org.apache.wiki.api.exceptions.ProviderException
-
getAllChangedSince
- Specified by:
getAllChangedSincein interfaceorg.apache.wiki.api.providers.PageProvider
-
getPageCount
- Specified by:
getPageCountin interfaceorg.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:
findPagesin interfaceorg.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:
getPageInfoin interfaceorg.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:
getVersionHistoryin interfaceorg.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:
getProviderInfoin interfaceorg.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:
deleteVersionin interfaceorg.apache.wiki.api.providers.PageProvider- Throws:
org.apache.wiki.api.exceptions.ProviderException
-
deletePage
- Specified by:
deletePagein interfaceorg.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:
movePagein interfaceorg.apache.wiki.api.providers.PageProvider- Throws:
org.apache.wiki.api.exceptions.ProviderException
-
getRealProvider
Returns the actual used provider.- Returns:
- The real provider.
- Since:
- 2.0
-