public class DefaultPageManager extends ModuleManager implements PageManager
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentHashMap<String,PageLock> |
m_pageLocks |
m_engine, PLUGIN_RESOURCE_LOCATIONPROP_LOCKEXPIRY, PROP_PAGEPROVIDER, PROP_USECACHE| Constructor and Description |
|---|
DefaultPageManager(WikiEngine engine,
Properties props)
Creates a new PageManager.
|
| Modifier and Type | Method and Description |
|---|---|
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<WikiPage> |
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.
|
WikiModuleInfo |
getModuleInfo(String moduleName)
Returns null!
|
WikiPage |
getPageInfo(String pageName,
int version)
Finds a WikiPage object describing a particular page and version.
|
PageSorter |
getPageSorter()
Returns the configured
PageSorter. |
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<WikiPage> |
getVersionHistory(String pageName)
Gets a version history of page.
|
PageLock |
lockPage(WikiPage page,
String user)
Locks page for editing.
|
Collection<WikiModuleInfo> |
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.
|
checkCompatibility, modulesprotected ConcurrentHashMap<String,PageLock> m_pageLocks
public DefaultPageManager(WikiEngine engine, Properties props) throws NoSuchElementException, WikiException
engine - WikiEngine instanceprops - Properties to use for initializationNoSuchElementException - property not found on WikiEngine propertiesWikiException - If anything goes wrong, you get this.public WikiPageProvider getProvider()
PageManagergetProvider in interface PageManagerpublic Collection<WikiPage> getAllPages() throws ProviderException
PageManagerReferenceManager#findCreated(), which is probably a lot
faster. This method may cause repository access.getAllPages in interface PageManagerProviderException - If the backend has problems.public String getPageText(String pageName, int version) throws ProviderException
PageManagergetPageText in interface PageManagerpageName - The name of the page to fetch.version - The version to findProviderException - If the backend has issues.public WikiEngine getEngine()
PageManagergetEngine in interface PageManagerpublic void putPageText(WikiPage page, String content) throws ProviderException
PageManagerputPageText in interface PageManagerpage - Page to savecontent - Wikimarkup to saveProviderException - If something goes wrong in the saving phasepublic PageLock lockPage(WikiPage page, String user)
PageManagerlockPage in interface PageManagerpage - WikiPage to lockuser - Username to use for lockingpublic void unlockPage(PageLock lock)
PageManagerunlockPage in interface PageManagerlock - A lock acquired in lockPage(). Safe to be null.public PageLock getCurrentLock(WikiPage page)
PageManagergetCurrentLock in interface PageManagerpage - The page to check the lock forpublic List<PageLock> getActiveLocks()
PageManagergetActiveLocks in interface PageManagerpublic WikiPage getPageInfo(String pageName, int version) throws ProviderException
PageManagergetPageInfo in interface PageManagerpageName - The name of the pageversion - A version numberProviderException - If there is something wrong with the page
name or the repositorypublic List<WikiPage> getVersionHistory(String pageName) throws ProviderException
PageManagergetVersionHistory in interface PageManagerpageName - The name of the page to fetch history forProviderException - If the repository fails.public String getProviderDescription()
PageManagergetProviderDescription in interface PageManagerpublic int getTotalPageCount()
PageManagergetTotalPageCount in interface PageManagerpublic boolean pageExists(String pageName) throws ProviderException
PageManagerpageExists in interface PageManagerpageName - Name of the page.ProviderException - If the backend fails or the name is illegal.public boolean pageExists(String pageName, int version) throws ProviderException
PageManagerpageExists in interface PageManagerpageName - Name of the pageversion - The version to checktrue if the page exists, false otherwiseProviderException - If backend fails or name is illegalpublic void deleteVersion(WikiPage page) throws ProviderException
PageManagerdeleteVersion in interface PageManagerpage - The page to delete.ProviderException - if the page failspublic void deletePage(WikiPage page) throws ProviderException
PageManagerdeletePage in interface PageManagerpage - The WikiPage to deleteProviderException - 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 StringWikiPageEventpublic Collection<WikiModuleInfo> modules()
modules in class ModuleManagerpublic WikiModuleInfo getModuleInfo(String moduleName)
WikiModuleInfo information about the provided moduleName.getModuleInfo in class ModuleManagerpublic void actionPerformed(WikiEvent event)
PageManagerWikiSecurityEvent.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 WikiEventListeneractionPerformed in interface PageManagerevent - 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' permissionstrue if the Acl was actually changed; false otherwisepublic PageSorter getPageSorter()
PageManagerPageSorter.getPageSorter in interface PageManagerPageSorter.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.