|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wiki.providers.CachingProvider
public class CachingProvider

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.
| Field Summary | |
|---|---|
static String |
CACHE_NAME
Name of the regular page cache. |
static int |
DEFAULT_CACHECAPACITY
The capacity of the caches, if you want something else, tweak ehcache.xml. |
static String |
HISTORYCACHE_NAME
Name of the page history cache. |
static String |
TEXTCACHE_NAME
Name of the page text cache. |
| Fields inherited from interface org.apache.wiki.WikiProvider |
|---|
LATEST_VERSION |
| Constructor Summary | |
|---|---|
CachingProvider()
|
|
| 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 pageName,
int version)
Returns info about the page. |
String |
getPageText(String pageName,
int version)
Gets a specific version out of the repository. |
String |
getProviderInfo()
Gets the provider class name, and cache statistics (misscount and hitcount of page cache and history cache). |
WikiPageProvider |
getRealProvider()
Returns the actual used provider. |
List |
getVersionHistory(String pageName)
Returns version history. |
void |
initialize(WikiEngine engine,
Properties properties)
Initializes the page provider. |
void |
movePage(String from,
String to)
Move a page |
boolean |
pageExists(String pageName)
Return true, if page exists. |
boolean |
pageExists(String pageName,
int version)
Return true, if page with a particular version exists. |
void |
putPageText(WikiPage page,
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 |
| Field Detail |
|---|
public static final String CACHE_NAME
public static final String TEXTCACHE_NAME
public static final String HISTORYCACHE_NAME
public static final int DEFAULT_CACHECAPACITY
| Constructor Detail |
|---|
public CachingProvider()
| Method Detail |
|---|
public void initialize(WikiEngine engine,
Properties properties)
throws NoRequiredPropertyException,
IOException
initialize in interface WikiProviderengine - WikiEngine to own this providerproperties - A set of properties used to initialize this provider
NoRequiredPropertyException - If the provider needs a property which is not found in the property set
IOException - If there is an IO problem
public boolean pageExists(String pageName,
int version)
pageExists in interface WikiPageProviderpageName - The page name to check forversion - The version to check
public boolean pageExists(String pageName)
pageExists in interface WikiPageProviderpageName - The page name.
public String getPageText(String pageName,
int version)
throws ProviderException
getPageText in interface WikiPageProviderpageName - Name of the page to fetch.version - Version of the page to fetch.
ProviderException - If something goes wrong.
public void putPageText(WikiPage page,
String text)
throws ProviderException
putPageText in interface WikiPageProviderpage - The WikiPage to savetext - The text to save.
ProviderException - If something goes wrong.
public Collection getAllPages()
throws ProviderException
getAllPages in interface WikiPageProviderProviderException - If something goes wrong.public Collection getAllChangedSince(Date date)
getAllChangedSince in interface WikiPageProviderdate - The date to check from
public int getPageCount()
throws ProviderException
getPageCount in interface WikiPageProviderProviderException - If something goes wrongpublic Collection findPages(QueryItem[] query)
This method should really be a part of the FastSearch IF.
findPages in interface WikiPageProviderquery - An array of QueryItems to match
public WikiPage getPageInfo(String pageName,
int version)
throws ProviderException
getPageInfo in interface WikiPageProviderpageName - The page nameversion - The version number
ProviderException - If something goes wrong.
public List getVersionHistory(String pageName)
throws ProviderException
getVersionHistory in interface WikiPageProviderpageName - The name of the page to get the history from.
ProviderException - If something goes wrong.public String getProviderInfo()
getProviderInfo in interface WikiProvider
public void deleteVersion(String pageName,
int version)
throws ProviderException
deleteVersion in interface WikiPageProviderpageName - Name of the page to be removed.version - Version of the page to be removed. May be LATEST_VERSION.
ProviderException - If the page cannot be removed for some reason.
public void deletePage(String pageName)
throws ProviderException
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...
deletePage in interface WikiPageProviderpageName - Name of the page to be removed completely.
ProviderException - If the page could not be removed for some reason.
public void movePage(String from,
String to)
throws ProviderException
movePage in interface WikiPageProviderfrom - Name of the page to move.to - New name of the page.
ProviderException - If the page could not be moved for some reason.public WikiPageProvider getRealProvider()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||