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

Provides a simple directory based repository for Wiki pages.
All files have ".txt" appended to make life easier for those who insist on using Windows or other software which makes assumptions on the files contents based on its name.
This class functions as a superclass to all file based providers.
| Nested Class Summary | |
|---|---|
static class |
AbstractFileProvider.WikiFileFilter
A simple filter which filters only those filenames which correspond to the file extension used. |
| Field Summary | |
|---|---|
static String |
DEFAULT_ENCODING
The default encoding. |
static String |
FILE_EXT
All files should have this extension to be recognized as JSPWiki files. |
protected String |
m_encoding
|
protected WikiEngine |
m_engine
|
static String |
PROP_PAGEDIR
Name of the property that defines where page directories are. |
| Fields inherited from interface org.apache.wiki.WikiProvider |
|---|
LATEST_VERSION |
| Constructor Summary | |
|---|---|
AbstractFileProvider()
|
|
| 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. |
protected File |
findPage(String page)
Finds a Wiki page from the page repository. |
Collection |
findPages(QueryItem[] query)
Iterates through all WikiPages, matches them against the given query, and returns a Collection of SearchResult objects. |
Collection |
getAllChangedSince(Date date)
Does not work. |
Collection |
getAllPages()
Returns all pages. |
int |
getPageCount()
Gets the number of pages. |
WikiPage |
getPageInfo(String page,
int version)
Always returns the latest version, since FileSystemProvider does not support versioning. |
String |
getPageText(String page,
int version)
This implementation just returns the current version, as filesystem does not provide versioning information for now. |
String |
getProviderInfo()
Return a valid HTML string for information. |
List |
getVersionHistory(String page)
The FileSystemProvider provides only one version. |
void |
initialize(WikiEngine engine,
Properties properties)
Initializes the page provider. |
protected String |
mangleName(String pagename)
This makes sure that the queried page name is still readable by the file system. |
boolean |
pageExists(String page)
Return true, if page exists. |
boolean |
pageExists(String page,
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". |
protected String |
unmangleName(String filename)
This makes the reverse of mangleName. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.wiki.providers.WikiPageProvider |
|---|
movePage |
| Field Detail |
|---|
protected String m_encoding
protected WikiEngine m_engine
public static final String PROP_PAGEDIR
public static final String FILE_EXT
public static final String DEFAULT_ENCODING
| Constructor Detail |
|---|
public AbstractFileProvider()
| Method Detail |
|---|
public void initialize(WikiEngine engine,
Properties properties)
throws NoRequiredPropertyException,
IOException,
FileNotFoundException
initialize in interface WikiProviderengine - WikiEngine to own this providerproperties - A set of properties used to initialize this provider
FileNotFoundException - If the specified page directory does not exist.
IOException - In case the specified page directory is a file, not a directory.
NoRequiredPropertyException - If the provider needs a property which is not found in the property setprotected String mangleName(String pagename)
pagename - The name to mangle
protected String unmangleName(String filename)
filename - The filename to unmangle
protected File findPage(String page)
page - The name of the page.
public boolean pageExists(String page)
pageExists in interface WikiPageProviderpage - The page name.
public boolean pageExists(String page,
int version)
pageExists in interface WikiPageProviderpage - The page name to check forversion - The version to check
public String getPageText(String page,
int version)
throws ProviderException
getPageText in interface WikiPageProviderpage - Name of the page to fetch.version - Version of the page to fetch.
{@inheritDoc}
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()
getPageCount in interface WikiPageProviderpublic Collection findPages(QueryItem[] query)
findPages in interface WikiPageProviderquery - An array of QueryItems to match
public WikiPage getPageInfo(String page,
int version)
throws ProviderException
getPageInfo in interface WikiPageProviderpage - The page nameversion - The version number
{@inheritDoc}
ProviderException - If something goes wrong.
public List getVersionHistory(String page)
throws ProviderException
getVersionHistory in interface WikiPageProviderpage - The name of the page to get the history from.
{@inheritDoc}
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||