Class WikiEngine

  • All Implemented Interfaces:
    Engine

    public class WikiEngine
    extends java.lang.Object
    implements 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 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.
      • 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.
      • getURL

        public java.lang.String getURL​(java.lang.String context,
                                       java.lang.String pageName,
                                       java.lang.String params)
        Specified by:
        getURL in interface Engine
      • decodeName

        public java.lang.String decodeName​(java.lang.String pagerequest)
        Specified by:
        decodeName in interface Engine
      • getTemplateManager

        @Deprecated
        public TemplateManager getTemplateManager()
        Deprecated.
        use getManager( TemplateManager.class ) instead.
        Returns the current TemplateManager.
        Returns:
        A TemplateManager instance.
      • getWorkflowManager

        @Deprecated
        public WorkflowManager getWorkflowManager()
        Deprecated.
        use getManager( WorkflowManager.class ) instead.
        Returns the WorkflowManager associated with this WikiEngine. If the WikiEngine has not been initialized, this method will return null.
        Returns:
        the task queue
      • getReferenceManager

        @Deprecated
        public ReferenceManager getReferenceManager()
        Deprecated.
        use getManager( ReferenceManager.class ) instead.
        Returns this object's ReferenceManager.
        Returns:
        The current ReferenceManager instance.
        Since:
        1.6.1
      • getRenderingManager

        @Deprecated
        public RenderingManager getRenderingManager()
        Deprecated.
        use getManager( 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.
        use getManager( PluginManager.class ) instead.
        Returns the current plugin manager.
        Returns:
        The current PluginManager instance
        Since:
        1.6.1
      • getVariableManager

        @Deprecated
        public VariableManager getVariableManager()
        Deprecated.
        use getManager( VariableManager.class ) instead.
        Returns the current variable manager.
        Returns:
        The current VariableManager.
      • getPageManager

        @Deprecated
        public PageManager getPageManager()
        Deprecated.
        use getManager( 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.
        use getManager( CommandResolver.class ) instead.
        Returns the CommandResolver for this wiki engine.
        Returns:
        the resolver
      • getAttachmentManager

        @Deprecated
        public AttachmentManager getAttachmentManager()
        Deprecated.
        use getManager( 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.
        use getManager( AuthorizationManager.class ) instead.
        Returns the currently used authorization manager.
        Returns:
        The current AuthorizationManager instance.
      • getAuthenticationManager

        @Deprecated
        public AuthenticationManager getAuthenticationManager()
        Deprecated.
        use getManager( AuthenticationManager.class ) instead.
        Returns the currently used authentication manager.
        Returns:
        The current AuthenticationManager instance.
      • getFilterManager

        @Deprecated
        public FilterManager getFilterManager()
        Deprecated.
        use getManager( 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.
        use getManager( 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.
        use getManager( ProgressManager.class ) instead.
        Returns the progress manager we're using
        Returns:
        A ProgressManager.
        Since:
        2.6
      • getURLConstructor

        @Deprecated
        public URLConstructor getURLConstructor()
        Deprecated.
        use getManager( URLConstructor.class ) instead.
        Returns:
        the URL constructor.
        Since:
        2.2.6
      • getRSSGenerator

        @Deprecated
        public RSSGenerator getRSSGenerator()
        Deprecated.
        use getManager( RSSGenerator.class ) instead.
        Returns the RSSGenerator. If the property jspwiki.rss.generate has not been set to true, this method will return null, and callers should check for this value.
        Returns:
        the RSS generator
        Since:
        2.1.165
      • getPageRenamer

        @Deprecated
        public PageRenamer getPageRenamer()
        Deprecated.
        use getManager( 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.
        use getManager( UserManager.class ) instead.
        Returns the UserManager employed by this WikiEngine.
        Returns:
        The current UserManager instance.
        Since:
        2.3
      • getTasksManager

        @Deprecated
        public TasksManager getTasksManager()
        Deprecated.
        use getManager( TaskManager.class ) instead.
        Returns the TasksManager employed by this WikiEngine.
        Returns:
        The current TasksManager instance.
      • getGroupManager

        @Deprecated
        public GroupManager getGroupManager()
        Deprecated.
        use getManager( GroupManager.class ) instead.
        Returns the GroupManager employed by this WikiEngine.
        Returns:
        The current GroupManager instance.
        Since:
        2.3
      • getAclManager

        @Deprecated
        public AclManager getAclManager()
        Deprecated.
        use getManager( 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.
        use getManager( DifferenceManager.class ) instead.
        Returns the DifferenceManager so that texts can be compared.
        Returns:
        the difference manager.
      • getEditorManager

        @Deprecated
        public EditorManager getEditorManager()
        Deprecated.
        use getManager( EditorManager.class ) instead.
        Returns the current EditorManager instance.
        Returns:
        The current EditorManager.
      • getInternationalizationManager

        @Deprecated
        public InternationalizationManager getInternationalizationManager()
        Deprecated.
        use getManager( InternationalizationManager.class ) instead.
        Returns the current i18n manager.
        Returns:
        The current Intertan... Interante... Internatatializ... Whatever.
      • 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