Package org.apache.wiki
Class WikiEngine
java.lang.Object
org.apache.wiki.WikiEngine
- All Implemented Interfaces:
Engine
Main implementation for
Engine
.
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
FieldsModifier and TypeFieldDescriptionStores 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
ConstructorsModifierConstructorDescriptionWikiEngine
(Properties properties) Instantiate the WikiEngine using a given set of properties.protected
WikiEngine
(javax.servlet.ServletContext context, 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
Modifier and TypeMethodDescriptionfinal void
addWikiEventListener
(WikiEventListener listener) decodeName
(String pagerequest) encodeName
(String pagename) protected final void
fireEvent
(int type) Fires a WikiEngineEvent to all registered listeners.protected final void
firePageEvent
(int type, String pageName) Fires a WikiPageEvent to all registered listeners.Deprecated.Deprecated.usegetManager( AdminBeanManager.class )
instead.Deprecated.usegetManager( AttachmentManager.class )
instead.<T> T
getAttribute
(String key) Deprecated.usegetManager( AuthenticationManager.class )
instead.Deprecated.usegetManager( AuthorizationManager.class )
instead.Deprecated.usegetManager( CommandResolver.class )
instead.Deprecated.usegetManager( DifferenceManager.class )
instead.Deprecated.usegetManager( EditorManager.class )
instead.Deprecated.usegetManager( FilterManager.class )
instead.getFinalPageName
(String page) Deprecated.usegetManager( GroupManager.class )
instead.static WikiEngine
getInstance
(javax.servlet.ServletConfig config) Gets a WikiEngine related to this servlet.static WikiEngine
getInstance
(javax.servlet.ServletConfig config, Properties props) Gets a WikiEngine related to the servlet.static WikiEngine
getInstance
(javax.servlet.ServletContext context, Properties props) Gets a WikiEngine related to the servlet.Deprecated.usegetManager( InternationalizationManager.class )
instead.getInterWikiURL
(String wikiName) <T> T
getManager
(Class<T> manager) <T> List<T>
getManagers
(Class<T> manager) Deprecated.usegetManager( PageManager.class )
instead.Deprecated.usegetManager( PageRenamer.class )
instead.Deprecated.usegetManager( PluginManager.class )
instead.Deprecated.usegetManager( ProgressManager.class )
instead.Deprecated.usegetManager( ReferenceManager.class )
instead.Deprecated.usegetManager( RenderingManager.class )
instead.Deprecated.usegetManager( RSSGenerator.class )
instead.Deprecated.usegetManager( SearchManager.class )
instead.javax.servlet.ServletContext
getSpecialPageReference
(String original) Deprecated.usegetManager( TaskManager.class )
instead.Deprecated.usegetManager( TemplateManager.class )
instead.Deprecated.usegetManager( URLConstructor.class )
instead.Deprecated.usegetManager( UserManager.class )
instead.Deprecated.usegetManager( VariableManager.class )
instead.Deprecated.usegetManager( WorkflowManager.class )
instead.void
initialize
(Properties props) Does all the real initialization.void
Initializes the reference manager.boolean
<T> T
removeAttribute
(String key) final void
removeWikiEventListener
(WikiEventListener listener) void
setAttribute
(String key, Object value) void
shutdown()
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 Details
-
managers
Stores WikiEngine's associated managers.
-
-
Constructor Details
-
WikiEngine
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
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 Details
-
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
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, 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
Does all the real initialization.- Specified by:
initialize
in interfaceEngine
- Throws:
WikiException
-
getManager
- Specified by:
getManager
in interfaceEngine
-
getManagers
- Specified by:
getManagers
in interfaceEngine
-
isConfigured
- Specified by:
isConfigured
in interfaceEngine
-
initReferenceManager
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
- Specified by:
getWikiProperties
in interfaceEngine
-
getWorkDir
- Specified by:
getWorkDir
in interfaceEngine
-
getTemplateDir
- Specified by:
getTemplateDir
in interfaceEngine
-
getStartTime
- Specified by:
getStartTime
in interfaceEngine
-
getBaseURL
- Specified by:
getBaseURL
in interfaceEngine
-
getGlobalRSSURL
- Specified by:
getGlobalRSSURL
in interfaceEngine
-
getInterWikiURL
- Specified by:
getInterWikiURL
in interfaceEngine
-
getURL
-
getFrontPage
- Specified by:
getFrontPage
in interfaceEngine
-
getServletContext
- Specified by:
getServletContext
in interfaceEngine
-
getAllInterWikiLinks
- Specified by:
getAllInterWikiLinks
in interfaceEngine
-
getAllInlinedImagePatterns
- Specified by:
getAllInlinedImagePatterns
in interfaceEngine
-
getSpecialPageReference
- Specified by:
getSpecialPageReference
in interfaceEngine
-
getApplicationName
- Specified by:
getApplicationName
in interfaceEngine
-
getFinalPageName
- Specified by:
getFinalPageName
in interfaceEngine
- Throws:
ProviderException
-
encodeName
- Specified by:
encodeName
in interfaceEngine
-
decodeName
- Specified by:
decodeName
in interfaceEngine
-
getContentEncoding
- Specified by:
getContentEncoding
in interfaceEngine
-
shutdown
It is called by
WikiServlet.destroy()
. When this method is called, it fires a "shutdown" WikiEngineEvent to all registered listeners. -
getTemplateManager
Deprecated.usegetManager( TemplateManager.class )
instead.Returns the current TemplateManager.- Returns:
- A TemplateManager instance.
-
getWorkflowManager
Deprecated.usegetManager( WorkflowManager.class )
instead.Returns theWorkflowManager
associated with this WikiEngine. If the WikiEngine has not been initialized, this method will returnnull
.- Returns:
- the task queue
-
getReferenceManager
Deprecated.usegetManager( ReferenceManager.class )
instead.Returns this object's ReferenceManager.- Returns:
- The current ReferenceManager instance.
- Since:
- 1.6.1
-
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.usegetManager( PluginManager.class )
instead.Returns the current plugin manager.- Returns:
- The current PluginManager instance
- Since:
- 1.6.1
-
getVariableManager
Deprecated.usegetManager( VariableManager.class )
instead.Returns the current variable manager.- Returns:
- The current VariableManager.
-
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.usegetManager( CommandResolver.class )
instead.Returns the CommandResolver for this wiki engine.- Returns:
- the resolver
-
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.usegetManager( AuthorizationManager.class )
instead.Returns the currently used authorization manager.- Returns:
- The current AuthorizationManager instance.
-
getAuthenticationManager
Deprecated.usegetManager( AuthenticationManager.class )
instead.Returns the currently used authentication manager.- Returns:
- The current AuthenticationManager instance.
-
getFilterManager
Deprecated.usegetManager( FilterManager.class )
instead.Returns the manager responsible for the filters.- Returns:
- The current FilterManager instance.
- Since:
- 2.1.88
-
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.usegetManager( ProgressManager.class )
instead.Returns the progress manager we're using- Returns:
- A ProgressManager.
- Since:
- 2.6
-
getRootPath
- Specified by:
getRootPath
in interfaceEngine
-
getURLConstructor
Deprecated.usegetManager( URLConstructor.class )
instead.- Returns:
- the URL constructor.
- Since:
- 2.2.6
-
getRSSGenerator
Deprecated.usegetManager( RSSGenerator.class )
instead.Returns the RSSGenerator. If the propertyjspwiki.rss.generate
has 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.usegetManager( PageRenamer.class )
instead.Returns the PageRenamer employed by this WikiEngine.- Returns:
- The current PageRenamer instance.
- Since:
- 2.5.141
-
getUserManager
Deprecated.usegetManager( UserManager.class )
instead.Returns the UserManager employed by this WikiEngine.- Returns:
- The current UserManager instance.
- Since:
- 2.3
-
getTasksManager
Deprecated.usegetManager( TaskManager.class )
instead.Returns the TasksManager employed by this WikiEngine.- Returns:
- The current TasksManager instance.
-
getGroupManager
Deprecated.usegetManager( GroupManager.class )
instead.Returns the GroupManager employed by this WikiEngine.- Returns:
- The current GroupManager instance.
- Since:
- 2.3
-
getAdminBeanManager
Deprecated.usegetManager( AdminBeanManager.class )
instead.Returns the currentAdminBeanManager
.- Returns:
- The current
AdminBeanManager
. - Since:
- 2.6
-
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.usegetManager( DifferenceManager.class )
instead.Returns the DifferenceManager so that texts can be compared.- Returns:
- the difference manager.
-
getEditorManager
Deprecated.usegetManager( EditorManager.class )
instead.Returns the current EditorManager instance.- Returns:
- The current EditorManager.
-
getInternationalizationManager
Deprecated.usegetManager( InternationalizationManager.class )
instead.Returns the current i18n manager.- Returns:
- The current Intertan... Interante... Internatatializ... Whatever.
-
addWikiEventListener
- Specified by:
addWikiEventListener
in interfaceEngine
-
removeWikiEventListener
- Specified by:
removeWikiEventListener
in interfaceEngine
-
fireEvent
Fires a WikiEngineEvent to all registered listeners.- Parameters:
type
- the event type
-
firePageEvent
Fires a WikiPageEvent to all registered listeners.- Parameters:
type
- the event type
-
setAttribute
- Specified by:
setAttribute
in interfaceEngine
-
getAttribute
- Specified by:
getAttribute
in interfaceEngine
-
removeAttribute
- Specified by:
removeAttribute
in interfaceEngine
-
getManager( AclManager.class )
instead.