|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wiki.modules.ModuleManager org.apache.wiki.PageManager
public class PageManager
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.
Saving a page is a two-stage Task; first the pre-save operations and then the actual save. See the descriptions of the tasks for further information.
Nested Class Summary | |
---|---|
static class |
PageManager.PreSaveWikiPageTask
Inner class that handles the page pre-save actions. |
static class |
PageManager.SaveWikiPageTask
Inner class that handles the actual page save and post-save actions. |
Field Summary | |
---|---|
static String |
FACT_CURRENT_TEXT
Fact name for storing the current text. |
static String |
FACT_DIFF_TEXT
Fact name for storing a diff text. |
static String |
FACT_IS_AUTHENTICATED
Fact name for storing whether the user is authenticated or not. |
static String |
FACT_PAGE_NAME
Fact name for storing the page name. |
static String |
FACT_PROPOSED_TEXT
Fact name for storing the proposed (edited) text. |
protected HashMap<String,PageLock> |
m_pageLocks
|
static String |
PRESAVE_TASK_MESSAGE_KEY
The message key for storing the text for the presave task. |
static String |
PRESAVE_WIKI_CONTEXT
The workflow attribute which stores the wikiContext. |
static String |
PROP_LOCKEXPIRY
The property value for setting the amount of time before the page locks expire. |
static String |
PROP_PAGEPROVIDER
The property value for setting the current page provider. |
static String |
PROP_USECACHE
The property value for setting the cache on/off. |
static String |
SAVE_APPROVER
The name of the key from jspwiki.properties which defines who shall approve the workflow of storing a wikipage. |
static String |
SAVE_DECISION_MESSAGE_KEY
The message key for storing the Decision text for saving a page. |
static String |
SAVE_REJECT_MESSAGE_KEY
The message key for rejecting the decision to save the page. |
static String |
SAVE_TASK_MESSAGE_KEY
The message key of the text to finally approve a page save. |
Fields inherited from class org.apache.wiki.modules.ModuleManager |
---|
PLUGIN_RESOURCE_LOCATION |
Constructor Summary | |
---|---|
PageManager(WikiEngine engine,
Properties props)
Creates a new PageManager. |
Method Summary | |
---|---|
void |
actionPerformed(WikiEvent event)
Listens for WikiSecurityEvent.PROFILE_NAME_CHANGED
events. |
protected boolean |
changeAcl(WikiPage page,
Principal[] oldPrincipals,
Principal newPrincipal)
For a single wiki page, replaces all Acl entries matching a supplied array of Principals with a new Principal. |
void |
deletePage(WikiPage page)
Deletes an entire page, all versions, all traces. |
void |
deleteVersion(WikiPage page)
Deletes only a specific version of a WikiPage. |
protected void |
fireEvent(int type,
String pagename)
Fires a WikiPageEvent of the provided type and page name to all registered listeners. |
List<PageLock> |
getActiveLocks()
Returns a list of currently applicable locks. |
Collection |
getAllPages()
Returns all pages in some random order. |
PageLock |
getCurrentLock(WikiPage page)
Returns the current lock owner of a page. |
WikiEngine |
getEngine()
Returns the WikiEngine to which this PageManager belongs to. |
WikiPage |
getPageInfo(String pageName,
int version)
Finds a WikiPage object describing a particular page and version. |
String |
getPageText(String pageName,
int version)
Fetches the page text from the repository. |
WikiPageProvider |
getProvider()
Returns the page provider currently in use. |
String |
getProviderDescription()
Returns a human-readable description of the current provider. |
int |
getTotalPageCount()
Returns the total count of all pages in the repository. |
List |
getVersionHistory(String pageName)
Gets a version history of page. |
PageLock |
lockPage(WikiPage page,
String user)
Locks page for editing. |
Collection |
modules()
Returns a collection of modules currently managed by this ModuleManager. |
boolean |
pageExists(String pageName)
Returns true, if the page exists (any version). |
boolean |
pageExists(String pageName,
int version)
Checks for existence of a specific page and version. |
void |
putPageText(WikiPage page,
String content)
Puts the page text into the repository. |
void |
unlockPage(PageLock lock)
Marks a page free to be written again. |
Methods inherited from class org.apache.wiki.modules.ModuleManager |
---|
checkCompatibility |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROP_PAGEPROVIDER
public static final String PROP_USECACHE
public static final String PROP_LOCKEXPIRY
public static final String PRESAVE_TASK_MESSAGE_KEY
public static final String PRESAVE_WIKI_CONTEXT
public static final String SAVE_APPROVER
public static final String SAVE_DECISION_MESSAGE_KEY
public static final String SAVE_REJECT_MESSAGE_KEY
public static final String SAVE_TASK_MESSAGE_KEY
public static final String FACT_PAGE_NAME
public static final String FACT_DIFF_TEXT
public static final String FACT_CURRENT_TEXT
public static final String FACT_PROPOSED_TEXT
public static final String FACT_IS_AUTHENTICATED
protected HashMap<String,PageLock> m_pageLocks
Constructor Detail |
---|
public PageManager(WikiEngine engine, Properties props) throws WikiException
engine
- WikiEngine instanceprops
- Properties to use for initialization
WikiException
- If anything goes wrong, you get this.Method Detail |
---|
public WikiPageProvider getProvider()
public Collection getAllPages() throws ProviderException
ReferenceManager.findCreated()
, which is probably a lot
faster. This method may cause repository access.
ProviderException
- If the backend has problems.public String getPageText(String pageName, int version) throws ProviderException
pageName
- The name of the page to fetch.version
- The version to find
ProviderException
- If the backend has issues.public WikiEngine getEngine()
public void putPageText(WikiPage page, String content) throws ProviderException
page
- Page to savecontent
- Wikimarkup to save
ProviderException
- If something goes wrong in the saving phasepublic PageLock lockPage(WikiPage page, String user)
page
- WikiPage to lockuser
- Username to use for locking
public void unlockPage(PageLock lock)
lock
- A lock acquired in lockPage(). Safe to be null.public PageLock getCurrentLock(WikiPage page)
page
- The page to check the lock for
public List<PageLock> getActiveLocks()
public WikiPage getPageInfo(String pageName, int version) throws ProviderException
pageName
- The name of the pageversion
- A version number
ProviderException
- If there is something wrong with the page
name or the repositorypublic List getVersionHistory(String pageName) throws ProviderException
pageName
- The name of the page to fetch history for
ProviderException
- If the repository fails.public String getProviderDescription()
public int getTotalPageCount()
public boolean pageExists(String pageName) throws ProviderException
pageName
- Name of the page.
ProviderException
- If the backend fails or the name is illegal.public boolean pageExists(String pageName, int version) throws ProviderException
pageName
- Name of the pageversion
- The version to check
true
if the page exists, false
otherwise
ProviderException
- If backend fails or name is illegalpublic void deleteVersion(WikiPage page) throws ProviderException
page
- The page to delete.
ProviderException
- if the page failspublic void deletePage(WikiPage page) throws ProviderException
page
- The WikiPage to delete
ProviderException
- If the repository operation failsprotected final void fireEvent(int type, String pagename)
type
- the event type to be firedpagename
- the wiki page name as a StringWikiPageEvent
public Collection modules()
modules
in class ModuleManager
public void actionPerformed(WikiEvent event)
WikiSecurityEvent.PROFILE_NAME_CHANGED
events. If a user profile's name changes, each page ACL is inspected. If an entry contains
a name that has changed, it is replaced with the new one. No events are emitted
as a consequence of this method, because the page contents are still the same; it is
only the representations of the names within the ACL that are changing.
actionPerformed
in interface WikiEventListener
event
- The eventprotected boolean changeAcl(WikiPage page, Principal[] oldPrincipals, Principal newPrincipal)
page
- the wiki page whose Acl is to be modifiedoldPrincipals
- an array of Principals to replace; all AclEntry objects whose
AclEntry.getPrincipal()
method returns one of these Principals will be replacednewPrincipal
- the Principal that should receive the old Principals' permissions
true
if the Acl was actually changed; false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |