Package org.apache.wiki
Class WikiEngine
- java.lang.Object
-
- org.apache.wiki.WikiEngine
-
- All Implemented Interfaces:
Engine
public class WikiEngine extends java.lang.Object implements Engine
Main implementation forEngine.Using this class: Always get yourself an instance from JSP page by using the
WikiEngine.getInstance(..)method. Never create a new WikiEngine() from scratch, unless you're writing tests.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Class<?>,java.lang.Object>managersStores WikiEngine's associated managers.-
Fields inherited from interface org.apache.wiki.api.core.Engine
DEFAULT_INLINEPATTERN, DEFAULT_TEMPLATE_NAME, PREFS_COOKIE_NAME, PROP_ACL_MANAGER_IMPL, PROP_ALLOW_CREATION_OF_EMPTY_PAGES, PROP_APPNAME, PROP_ENCODING, PROP_FRONTPAGE, PROP_INLINEIMAGEPTRN, PROP_INTERWIKIREF, PROP_MATCHPLURALS, PROP_NO_FILTER_ENCODING, PROP_REF_MANAGER_IMPL, PROP_SEARCHPATH, PROP_STOREUSERNAME, PROP_TEMPLATEDIR, PROP_URLCONSTRUCTOR, PROP_WORKDIR
-
-
Constructor Summary
Constructors Modifier Constructor Description WikiEngine(java.util.Properties properties)Instantiate the WikiEngine using a given set of properties.protectedWikiEngine(javax.servlet.ServletContext context, java.lang.String appid)Instantiate using this method when you're running as a servlet and WikiEngine will figure out where to look for the property file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddWikiEventListener(WikiEventListener listener)java.lang.StringdecodeName(java.lang.String pagerequest)java.lang.StringencodeName(java.lang.String pagename)protected voidfireEvent(int type)Fires a WikiEngineEvent to all registered listeners.protected voidfirePageEvent(int type, java.lang.String pageName)Fires a WikiPageEvent to all registered listeners.AclManagergetAclManager()Deprecated.usegetManager( AclManager.class )instead.AdminBeanManagergetAdminBeanManager()Deprecated.usegetManager( AdminBeanManager.class )instead.java.util.Collection<java.lang.String>getAllInlinedImagePatterns()java.util.Collection<java.lang.String>getAllInterWikiLinks()java.lang.StringgetApplicationName()AttachmentManagergetAttachmentManager()Deprecated.usegetManager( AttachmentManager.class )instead.<T> TgetAttribute(java.lang.String key)AuthenticationManagergetAuthenticationManager()Deprecated.usegetManager( AuthenticationManager.class )instead.AuthorizationManagergetAuthorizationManager()Deprecated.usegetManager( AuthorizationManager.class )instead.java.lang.StringgetBaseURL()CommandResolvergetCommandResolver()Deprecated.usegetManager( CommandResolver.class )instead.java.nio.charset.CharsetgetContentEncoding()DifferenceManagergetDifferenceManager()Deprecated.usegetManager( DifferenceManager.class )instead.EditorManagergetEditorManager()Deprecated.usegetManager( EditorManager.class )instead.FilterManagergetFilterManager()Deprecated.usegetManager( FilterManager.class )instead.java.lang.StringgetFinalPageName(java.lang.String page)java.lang.StringgetFrontPage()java.lang.StringgetGlobalRSSURL()GroupManagergetGroupManager()Deprecated.usegetManager( GroupManager.class )instead.static WikiEnginegetInstance(javax.servlet.ServletConfig config)Gets a WikiEngine related to this servlet.static WikiEnginegetInstance(javax.servlet.ServletConfig config, java.util.Properties props)Gets a WikiEngine related to the servlet.static WikiEnginegetInstance(javax.servlet.ServletContext context, java.util.Properties props)Gets a WikiEngine related to the servlet.InternationalizationManagergetInternationalizationManager()Deprecated.usegetManager( InternationalizationManager.class )instead.java.lang.StringgetInterWikiURL(java.lang.String wikiName)<T> TgetManager(java.lang.Class<T> manager)<T> java.util.List<T>getManagers(java.lang.Class<T> manager)PageManagergetPageManager()Deprecated.usegetManager( PageManager.class )instead.PageRenamergetPageRenamer()Deprecated.usegetManager( PageRenamer.class )instead.PluginManagergetPluginManager()Deprecated.usegetManager( PluginManager.class )instead.ProgressManagergetProgressManager()Deprecated.usegetManager( ProgressManager.class )instead.ReferenceManagergetReferenceManager()Deprecated.usegetManager( ReferenceManager.class )instead.RenderingManagergetRenderingManager()Deprecated.usegetManager( RenderingManager.class )instead.java.lang.StringgetRootPath()RSSGeneratorgetRSSGenerator()Deprecated.usegetManager( RSSGenerator.class )instead.SearchManagergetSearchManager()Deprecated.usegetManager( SearchManager.class )instead.javax.servlet.ServletContextgetServletContext()java.lang.StringgetSpecialPageReference(java.lang.String original)java.util.DategetStartTime()TasksManagergetTasksManager()Deprecated.usegetManager( TaskManager.class )instead.java.lang.StringgetTemplateDir()TemplateManagergetTemplateManager()Deprecated.usegetManager( TemplateManager.class )instead.java.lang.StringgetURL(java.lang.String context, java.lang.String pageName, java.lang.String params)URLConstructorgetURLConstructor()Deprecated.usegetManager( URLConstructor.class )instead.UserManagergetUserManager()Deprecated.usegetManager( UserManager.class )instead.VariableManagergetVariableManager()Deprecated.usegetManager( VariableManager.class )instead.java.util.PropertiesgetWikiProperties()java.lang.StringgetWorkDir()WorkflowManagergetWorkflowManager()Deprecated.usegetManager( WorkflowManager.class )instead.voidinitialize(java.util.Properties props)Does all the real initialization.voidinitReferenceManager()Initializes the reference manager.booleanisConfigured()<T> TremoveAttribute(java.lang.String key)voidremoveWikiEventListener(WikiEventListener listener)voidsetAttribute(java.lang.String key, java.lang.Object value)voidshutdown()-
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.api.core.Engine
adapt, findConfigFile, getPluginSearchPath, start, stop
-
-
-
-
Field Detail
-
managers
protected final java.util.Map<java.lang.Class<?>,java.lang.Object> managers
Stores WikiEngine's associated managers.
-
-
Constructor Detail
-
WikiEngine
public WikiEngine(java.util.Properties properties) throws WikiException
Instantiate the WikiEngine using a given set of properties. Use this constructor for testing purposes only.- Parameters:
properties- A set of properties to use to initialize this WikiEngine.- Throws:
WikiException- If the initialization fails.
-
WikiEngine
protected WikiEngine(javax.servlet.ServletContext context, java.lang.String appid) throws WikiException
Instantiate using this method when you're running as a servlet and WikiEngine will figure out where to look for the property file. Do not use this method - use WikiEngine.getInstance() instead.- Parameters:
context- A ServletContext.appid- An Application ID. This application is a unique random string which is used to recognize this WikiEngine.- Throws:
WikiException- If the WikiEngine construction fails.
-
-
Method Detail
-
getInstance
public static WikiEngine getInstance(javax.servlet.ServletConfig config) throws InternalWikiException
Gets a WikiEngine related to this servlet. Since this method is only called from JSP pages (and JspInit()) to be specific, we throw a RuntimeException if things don't work.- Parameters:
config- The ServletConfig object for this servlet.- Returns:
- A WikiEngine instance.
- Throws:
InternalWikiException- in case something fails. This is a RuntimeException, so be prepared for it.
-
getInstance
public static WikiEngine getInstance(javax.servlet.ServletConfig config, java.util.Properties props)
Gets a WikiEngine related to the servlet. Works like getInstance(ServletConfig), but does not force the Properties object. This method is just an optional way of initializing a WikiEngine for embedded JSPWiki applications; normally, you should use getInstance(ServletConfig).- Parameters:
config- The ServletConfig of the webapp servlet/JSP calling this method.props- A set of properties, or null, if we are to load JSPWiki's default jspwiki.properties (this is the usual case).- Returns:
- One well-behaving WikiEngine instance.
-
getInstance
public static WikiEngine getInstance(javax.servlet.ServletContext context, java.util.Properties props) throws InternalWikiException
Gets a WikiEngine related to the servlet. Works just like getInstance( ServletConfig )- Parameters:
context- The ServletContext of the webapp servlet/JSP calling this method.props- A set of properties, or null, if we are to load JSPWiki's default jspwiki.properties (this is the usual case).- Returns:
- One fully functional, properly behaving WikiEngine.
- Throws:
InternalWikiException- If the WikiEngine instantiation fails.
-
initialize
public void initialize(java.util.Properties props) throws WikiException
Does all the real initialization.- Specified by:
initializein interfaceEngine- Throws:
WikiException
-
getManager
public <T> T getManager(java.lang.Class<T> manager)
- Specified by:
getManagerin interfaceEngine
-
getManagers
public <T> java.util.List<T> getManagers(java.lang.Class<T> manager)
- Specified by:
getManagersin interfaceEngine
-
isConfigured
public boolean isConfigured()
- Specified by:
isConfiguredin interfaceEngine
-
initReferenceManager
public void initReferenceManager() throws WikiException
Initializes the reference manager. Scans all existing WikiPages for internal links and adds them to the ReferenceManager object.- Throws:
WikiException- If the reference manager initialization fails.
-
getWikiProperties
public java.util.Properties getWikiProperties()
- Specified by:
getWikiPropertiesin interfaceEngine
-
getWorkDir
public java.lang.String getWorkDir()
- Specified by:
getWorkDirin interfaceEngine
-
getTemplateDir
public java.lang.String getTemplateDir()
- Specified by:
getTemplateDirin interfaceEngine
-
getStartTime
public java.util.Date getStartTime()
- Specified by:
getStartTimein interfaceEngine
-
getBaseURL
public java.lang.String getBaseURL()
- Specified by:
getBaseURLin interfaceEngine
-
getGlobalRSSURL
public java.lang.String getGlobalRSSURL()
- Specified by:
getGlobalRSSURLin interfaceEngine
-
getInterWikiURL
public java.lang.String getInterWikiURL(java.lang.String wikiName)
- Specified by:
getInterWikiURLin interfaceEngine
-
getURL
public java.lang.String getURL(java.lang.String context, java.lang.String pageName, java.lang.String params)
-
getFrontPage
public java.lang.String getFrontPage()
- Specified by:
getFrontPagein interfaceEngine
-
getServletContext
public javax.servlet.ServletContext getServletContext()
- Specified by:
getServletContextin interfaceEngine
-
getAllInterWikiLinks
public java.util.Collection<java.lang.String> getAllInterWikiLinks()
- Specified by:
getAllInterWikiLinksin interfaceEngine
-
getAllInlinedImagePatterns
public java.util.Collection<java.lang.String> getAllInlinedImagePatterns()
- Specified by:
getAllInlinedImagePatternsin interfaceEngine
-
getSpecialPageReference
public java.lang.String getSpecialPageReference(java.lang.String original)
- Specified by:
getSpecialPageReferencein interfaceEngine
-
getApplicationName
public java.lang.String getApplicationName()
- Specified by:
getApplicationNamein interfaceEngine
-
getFinalPageName
public java.lang.String getFinalPageName(java.lang.String page) throws ProviderException
- Specified by:
getFinalPageNamein interfaceEngine- Throws:
ProviderException
-
encodeName
public java.lang.String encodeName(java.lang.String pagename)
- Specified by:
encodeNamein interfaceEngine
-
decodeName
public java.lang.String decodeName(java.lang.String pagerequest)
- Specified by:
decodeNamein interfaceEngine
-
getContentEncoding
public java.nio.charset.Charset getContentEncoding()
- Specified by:
getContentEncodingin interfaceEngine
-
shutdown
public void shutdown()
It is called by
WikiServlet.destroy(). When this method is called, it fires a "shutdown" WikiEngineEvent to all registered listeners.
-
getTemplateManager
@Deprecated public TemplateManager getTemplateManager()
Deprecated.usegetManager( TemplateManager.class )instead.Returns the current TemplateManager.- Returns:
- A TemplateManager instance.
-
getWorkflowManager
@Deprecated public WorkflowManager getWorkflowManager()
Deprecated.usegetManager( WorkflowManager.class )instead.Returns theWorkflowManagerassociated with this WikiEngine. If the WikiEngine has not been initialized, this method will returnnull.- Returns:
- the task queue
-
getReferenceManager
@Deprecated public ReferenceManager getReferenceManager()
Deprecated.usegetManager( ReferenceManager.class )instead.Returns this object's ReferenceManager.- Returns:
- The current ReferenceManager instance.
- Since:
- 1.6.1
-
getRenderingManager
@Deprecated public RenderingManager getRenderingManager()
Deprecated.usegetManager( RenderingManager.class )instead.Returns the current rendering manager for this wiki application.- Returns:
- A RenderingManager object.
- Since:
- 2.3.27
-
getPluginManager
@Deprecated public PluginManager getPluginManager()
Deprecated.usegetManager( PluginManager.class )instead.Returns the current plugin manager.- Returns:
- The current PluginManager instance
- Since:
- 1.6.1
-
getVariableManager
@Deprecated public VariableManager getVariableManager()
Deprecated.usegetManager( VariableManager.class )instead.Returns the current variable manager.- Returns:
- The current VariableManager.
-
getPageManager
@Deprecated public PageManager getPageManager()
Deprecated.usegetManager( PageManager.class )instead.Returns the current PageManager which is responsible for storing and managing WikiPages.- Returns:
- The current PageManager instance.
-
getCommandResolver
@Deprecated public CommandResolver getCommandResolver()
Deprecated.usegetManager( CommandResolver.class )instead.Returns the CommandResolver for this wiki engine.- Returns:
- the resolver
-
getAttachmentManager
@Deprecated public AttachmentManager getAttachmentManager()
Deprecated.usegetManager( AttachmentManager.class )instead.Returns the current AttachmentManager, which is responsible for storing and managing attachments.- Returns:
- The current AttachmentManager instance
- Since:
- 1.9.31.
-
getAuthorizationManager
@Deprecated public AuthorizationManager getAuthorizationManager()
Deprecated.usegetManager( AuthorizationManager.class )instead.Returns the currently used authorization manager.- Returns:
- The current AuthorizationManager instance.
-
getAuthenticationManager
@Deprecated public AuthenticationManager getAuthenticationManager()
Deprecated.usegetManager( AuthenticationManager.class )instead.Returns the currently used authentication manager.- Returns:
- The current AuthenticationManager instance.
-
getFilterManager
@Deprecated public FilterManager getFilterManager()
Deprecated.usegetManager( FilterManager.class )instead.Returns the manager responsible for the filters.- Returns:
- The current FilterManager instance.
- Since:
- 2.1.88
-
getSearchManager
@Deprecated public SearchManager getSearchManager()
Deprecated.usegetManager( SearchManager.class )instead.Returns the manager responsible for searching the Wiki.- Returns:
- The current SearchManager instance.
- Since:
- 2.2.21
-
getProgressManager
@Deprecated public ProgressManager getProgressManager()
Deprecated.usegetManager( ProgressManager.class )instead.Returns the progress manager we're using- Returns:
- A ProgressManager.
- Since:
- 2.6
-
getRootPath
public java.lang.String getRootPath()
- Specified by:
getRootPathin interfaceEngine
-
getURLConstructor
@Deprecated public URLConstructor getURLConstructor()
Deprecated.usegetManager( URLConstructor.class )instead.- Returns:
- the URL constructor.
- Since:
- 2.2.6
-
getRSSGenerator
@Deprecated public RSSGenerator getRSSGenerator()
Deprecated.usegetManager( RSSGenerator.class )instead.Returns the RSSGenerator. If the propertyjspwiki.rss.generatehas not been set totrue, this method will returnnull, and callers should check for this value.- Returns:
- the RSS generator
- Since:
- 2.1.165
-
getPageRenamer
@Deprecated public PageRenamer getPageRenamer()
Deprecated.usegetManager( PageRenamer.class )instead.Returns the PageRenamer employed by this WikiEngine.- Returns:
- The current PageRenamer instance.
- Since:
- 2.5.141
-
getUserManager
@Deprecated public UserManager getUserManager()
Deprecated.usegetManager( UserManager.class )instead.Returns the UserManager employed by this WikiEngine.- Returns:
- The current UserManager instance.
- Since:
- 2.3
-
getTasksManager
@Deprecated public TasksManager getTasksManager()
Deprecated.usegetManager( TaskManager.class )instead.Returns the TasksManager employed by this WikiEngine.- Returns:
- The current TasksManager instance.
-
getGroupManager
@Deprecated public GroupManager getGroupManager()
Deprecated.usegetManager( GroupManager.class )instead.Returns the GroupManager employed by this WikiEngine.- Returns:
- The current GroupManager instance.
- Since:
- 2.3
-
getAdminBeanManager
@Deprecated public AdminBeanManager getAdminBeanManager()
Deprecated.usegetManager( AdminBeanManager.class )instead.Returns the currentAdminBeanManager.- Returns:
- The current
AdminBeanManager. - Since:
- 2.6
-
getAclManager
@Deprecated public AclManager getAclManager()
Deprecated.usegetManager( AclManager.class )instead.Returns the AclManager employed by this WikiEngine. The AclManager is lazily initialized.The AclManager implementing class may be set by the System property
Engine.PROP_ACL_MANAGER_IMPL.- Returns:
- The current AclManager.
- Since:
- 2.3
-
getDifferenceManager
@Deprecated public DifferenceManager getDifferenceManager()
Deprecated.usegetManager( DifferenceManager.class )instead.Returns the DifferenceManager so that texts can be compared.- Returns:
- the difference manager.
-
getEditorManager
@Deprecated public EditorManager getEditorManager()
Deprecated.usegetManager( EditorManager.class )instead.Returns the current EditorManager instance.- Returns:
- The current EditorManager.
-
getInternationalizationManager
@Deprecated public InternationalizationManager getInternationalizationManager()
Deprecated.usegetManager( InternationalizationManager.class )instead.Returns the current i18n manager.- Returns:
- The current Intertan... Interante... Internatatializ... Whatever.
-
addWikiEventListener
public final void addWikiEventListener(WikiEventListener listener)
- Specified by:
addWikiEventListenerin interfaceEngine
-
removeWikiEventListener
public final void removeWikiEventListener(WikiEventListener listener)
- Specified by:
removeWikiEventListenerin interfaceEngine
-
fireEvent
protected final void fireEvent(int type)
Fires a WikiEngineEvent to all registered listeners.- Parameters:
type- the event type
-
firePageEvent
protected final void firePageEvent(int type, java.lang.String pageName)
Fires a WikiPageEvent to all registered listeners.- Parameters:
type- the event type
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)
- Specified by:
setAttributein interfaceEngine
-
getAttribute
public <T> T getAttribute(java.lang.String key)
- Specified by:
getAttributein interfaceEngine
-
removeAttribute
public <T> T removeAttribute(java.lang.String key)
- Specified by:
removeAttributein interfaceEngine
-
-