com.ecyrd.jspwiki
Class PageManager

java.lang.Object
  |
  +--com.ecyrd.jspwiki.PageManager

public class PageManager
extends java.lang.Object

Manages the WikiPages. This class functions as an unified interface towards the page providers. It handles initialization and management of the providers, and provides utility methods for accessing the contents.

Since:
2.0
Author:
Janne Jalkanen

Field Summary
static java.lang.String PROP_LOCKEXPIRY
           
static java.lang.String PROP_PAGEPROVIDER
           
static java.lang.String PROP_USECACHE
           
 
Constructor Summary
PageManager(java.util.Properties props)
          Creates a new PageManager.
 
Method Summary
 java.util.Collection findPages(QueryItem[] query)
           
 java.util.List getActiveLocks()
          Returns a list of currently applicable locks.
 java.util.Collection getAllPages()
           
 PageLock getCurrentLock(WikiPage page)
          Returns the current lock owner of a page.
 WikiPage getPageInfo(java.lang.String pageName, int version)
           
 java.lang.String getPageText(java.lang.String pageName, int version)
           
 WikiPageProvider getProvider()
          Returns the page provider currently in use.
 java.lang.String getProviderDescription()
           
 int getTotalPageCount()
           
 java.util.List getVersionHistory(java.lang.String pageName)
          Gets a version history of page.
 PageLock lockPage(WikiPage page, java.lang.String user)
          Locks page for editing.
 boolean pageExists(java.lang.String pageName)
           
 void putPageText(WikiPage page, java.lang.String content)
           
 void unlockPage(PageLock lock)
          Marks a page free to be written again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_PAGEPROVIDER

public static final java.lang.String PROP_PAGEPROVIDER
See Also:
Constant Field Values

PROP_USECACHE

public static final java.lang.String PROP_USECACHE
See Also:
Constant Field Values

PROP_LOCKEXPIRY

public static final java.lang.String PROP_LOCKEXPIRY
See Also:
Constant Field Values
Constructor Detail

PageManager

public PageManager(java.util.Properties props)
            throws WikiException
Creates a new PageManager.

Throws:
WikiException - If anything goes wrong, you get this.
Method Detail

getProvider

public WikiPageProvider getProvider()
Returns the page provider currently in use.


getAllPages

public java.util.Collection getAllPages()
                                 throws ProviderException
ProviderException

getPageText

public java.lang.String getPageText(java.lang.String pageName,
                                    int version)
                             throws ProviderException
ProviderException

putPageText

public void putPageText(WikiPage page,
                        java.lang.String content)
                 throws ProviderException
ProviderException

lockPage

public PageLock lockPage(WikiPage page,
                         java.lang.String user)
Locks page for editing. Note, however, that the PageManager will in no way prevent you from actually editing this page; the lock is just for information.

Returns:
null, if page could not be locked.

unlockPage

public void unlockPage(PageLock lock)
Marks a page free to be written again. If there has not been a lock, will fail quietly.

Parameters:
lock - A lock acquired in lockPage(). Safe to be null.

getCurrentLock

public PageLock getCurrentLock(WikiPage page)
Returns the current lock owner of a page. If the page is not locked, will return null.

Returns:
Current lock.

getActiveLocks

public java.util.List getActiveLocks()
Returns a list of currently applicable locks. Note that by the time you get the list, the locks may have already expired, so use this only for informational purposes.

Returns:
List of PageLock objects, detailing the locks. If no locks exist, returns an empty list.
Since:
2.0.22.

findPages

public java.util.Collection findPages(QueryItem[] query)

getPageInfo

public WikiPage getPageInfo(java.lang.String pageName,
                            int version)
                     throws ProviderException
ProviderException

getVersionHistory

public java.util.List getVersionHistory(java.lang.String pageName)
                                 throws ProviderException
Gets a version history of page. Each element in the returned List is a WikiPage.

Returns:
If the page does not exist, returns null, otherwise a List of WikiPages.
ProviderException

getProviderDescription

public java.lang.String getProviderDescription()

getTotalPageCount

public int getTotalPageCount()

pageExists

public boolean pageExists(java.lang.String pageName)