You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/03/24 22:10:16 UTC

[jspwiki] branch master updated (207a68f -> 1e6e4f3)

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git.


    from 207a68f  deprecate all getXYZManager() methods; use getManager( XYZ.class ) instead + fix sonar issue. No version bump
     new 0f6994c  apply format suggested by intellij
     new 49af134  JSPWIKI-303: add Pages' ACLs
     new 58101a7  use Page instead of WikiPage whenever possible
     new d8c40d9  use Engine instead of WikiEngine
     new 6a25735  mimic goals on apache-release profile to see if we can pinpoint weird maven-javadoc-plugin issue at builds.apache.org
     new 01523b5  update JUnit to 5.6.1 and Apache Lucene to 8.5.0
     new f438047  use o.a.w.api.core.Attachment instead of o.a.w.attachment.Attachment
     new 0743c53  add Engine to EditorManager#initialize(..) method. It will be unused but will allow us to extract an Initializable interface later on
     new 24f4a6b  homogenize engine's components creation and ensure components' instances can have method scope, so we can get rid of them later on
     new 95c78ce  retrieve all pages and attachments only if we have to build the reference manager
     new 668718f  fix title
     new fc6d971  added Initializable interface on public api
     new 3b8bb07  Refactor WikiEngine initialization (somewhat related to JSPWIKI-806)
     new 7295054  extend / implement Initializable
     new 1e6e4f3  2.11.0-M7-git-15

The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog.md                                       |  15 ++
 .../src/main/java/org/apache/wiki/api/Release.java |   2 +-
 .../main/java/org/apache/wiki/api/core/Acl.java    |   4 +-
 .../main/java/org/apache/wiki/api/core/Page.java   |   4 +-
 .../java/org/apache/wiki/api/core/package.html     |   2 +-
 .../org/apache/wiki/api/engine/Initializable.java  |  24 +-
 .../java/org/apache/wiki/api/engine}/package.html  |   4 +-
 .../src/main/java/org/apache/wiki/WikiEngine.java  | 263 ++++++---------------
 .../src/main/java/org/apache/wiki/WikiPage.java    | 231 +++++++++---------
 .../apache/wiki/attachment/AttachmentServlet.java  |   4 +-
 .../apache/wiki/auth/AuthenticationManager.java    |  16 +-
 .../org/apache/wiki/auth/AuthorizationManager.java |  18 +-
 .../wiki/auth/DefaultAuthorizationManager.java     |  16 +-
 .../java/org/apache/wiki/auth/UserManager.java     |  13 +-
 .../main/java/org/apache/wiki/auth/acl/Acl.java    | 116 ++++-----
 .../java/org/apache/wiki/auth/acl/AclEntry.java    |  87 +------
 .../java/org/apache/wiki/auth/acl/AclImpl.java     | 110 +++------
 .../java/org/apache/wiki/auth/acl/AclManager.java  |  23 +-
 .../apache/wiki/auth/acl/DefaultAclManager.java    |  18 +-
 .../apache/wiki/auth/authorize/GroupManager.java   |   3 +-
 .../java/org/apache/wiki/filters/SpamFilter.java   |   3 +-
 .../org/apache/wiki/pages/DefaultPageManager.java  |  12 +-
 .../apache/wiki/parser/JSPWikiMarkupParser.java    |   2 +-
 .../org/apache/wiki/plugin/BugReportHandler.java   |   2 +-
 .../apache/wiki/plugin/RecentChangesPlugin.java    |   3 +-
 .../wiki/providers/BasicAttachmentProvider.java    |   2 +-
 .../apache/wiki/providers/FileSystemProvider.java  |  11 +-
 .../wiki/render/DefaultRenderingManager.java       |   3 +
 .../org/apache/wiki/render/RenderingManager.java   |  18 +-
 .../org/apache/wiki/rss/DefaultRSSGenerator.java   |   8 +-
 .../java/org/apache/wiki/rss/RSSGenerator.java     |  13 +-
 .../apache/wiki/search/LuceneSearchProvider.java   |   2 +-
 .../apache/wiki/tags/AttachmentsIteratorTag.java   |   4 +-
 .../java/org/apache/wiki/tags/CalendarTag.java     |   6 +-
 .../java/org/apache/wiki/tags/CheckLockTag.java    |   4 +-
 .../java/org/apache/wiki/tags/CheckVersionTag.java |   3 +-
 .../java/org/apache/wiki/tags/CommentLinkTag.java  |  59 ++---
 .../org/apache/wiki/tags/HasAttachmentsTag.java    |   4 +-
 .../org/apache/wiki/tags/HistoryIteratorTag.java   |  14 +-
 .../java/org/apache/wiki/tags/InsertPageTag.java   |   3 +-
 .../java/org/apache/wiki/tags/IteratorTag.java     |  15 +-
 .../main/java/org/apache/wiki/tags/LinkTag.java    |   3 +-
 .../java/org/apache/wiki/tags/LinkToParentTag.java |  44 ++--
 .../main/java/org/apache/wiki/tags/LinkToTag.java  | 112 ++++-----
 .../java/org/apache/wiki/tags/NextVersionTag.java  |  24 +-
 .../java/org/apache/wiki/tags/PageDateTag.java     |  74 +++---
 .../java/org/apache/wiki/tags/PageInfoLinkTag.java |   4 +-
 .../java/org/apache/wiki/tags/PageTypeTag.java     |  37 +--
 .../java/org/apache/wiki/tags/PageVersionTag.java  |  36 ++-
 .../org/apache/wiki/tags/PreviousVersionTag.java   |  21 +-
 .../apache/wiki/tasks/pages/SaveWikiPageTask.java  |   8 +-
 .../org/apache/wiki/ui/DefaultEditorManager.java   |   8 +-
 .../java/org/apache/wiki/ui/EditorManager.java     |  11 +-
 .../java/org/apache/wiki/url/URLConstructor.java   |  13 +-
 .../wiki/workflow/DefaultWorkflowManager.java      |   6 +
 .../org/apache/wiki/workflow/WorkflowManager.java  |  18 +-
 .../java/org/apache/wiki/xmlrpc/RPCHandler.java    |   5 +-
 .../wiki/auth/acl/DefaultAclManagerTest.java       |  10 +-
 .../java/org/apache/wiki/plugin/IfPluginTest.java  |   5 +-
 .../AccessRuleLinkNodePostProcessorState.java      |   6 +-
 jspwiki-war/src/main/webapp/admin/Admin.jsp        |  22 +-
 pom.xml                                            |   8 +-
 62 files changed, 617 insertions(+), 1022 deletions(-)
 copy jspwiki-main/src/main/java/org/apache/wiki/parser/ParseException.java => jspwiki-api/src/main/java/org/apache/wiki/api/engine/Initializable.java (57%)
 copy {jspwiki-it-tests/jspwiki-selenide-tests/src/main/java/org/apache/wiki/its => jspwiki-api/src/main/java/org/apache/wiki/api/engine}/package.html (92%)


[jspwiki] 10/15: retrieve all pages and attachments only if we have to build the reference manager

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 95c78ce6502d0da7f5ba85f7a914f9fcab650eee
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 17:33:58 2020 +0100

    retrieve all pages and attachments only if we have to build the reference manager
---
 jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
index 8b963e7..54441db 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
@@ -584,15 +584,16 @@ public class WikiEngine implements Engine {
      */
     public void initReferenceManager() throws WikiException {
         try {
-            final ArrayList< Page > pages = new ArrayList<>();
-            pages.addAll( getManager( PageManager.class ).getAllPages() );
-            pages.addAll( getManager( AttachmentManager.class ).getAllAttachments() );
-
             // Build a new manager with default key lists.
             if( getManager( ReferenceManager.class ) == null ) {
-                m_referenceManager = ClassUtil.getMappedObject(ReferenceManager.class.getName(), this );
-                m_referenceManager.initialize( pages );
+                final ArrayList< Page > pages = new ArrayList<>();
+                pages.addAll( getManager( PageManager.class ).getAllPages() );
+                pages.addAll( getManager( AttachmentManager.class ).getAllAttachments() );
+
+                m_referenceManager = ClassUtil.getMappedObject( ReferenceManager.class.getName(), this );
                 managers.put( ReferenceManager.class, m_referenceManager );
+
+                m_referenceManager.initialize( pages );
             }
 
         } catch( final ProviderException e ) {


[jspwiki] 14/15: extend / implement Initializable

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 72950542993534925e0984508ad3e73e51a1138c
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 23:02:49 2020 +0100

    extend / implement Initializable
---
 .../org/apache/wiki/auth/AuthenticationManager.java    | 16 ++--------------
 .../org/apache/wiki/auth/AuthorizationManager.java     | 16 ++--------------
 .../apache/wiki/auth/DefaultAuthorizationManager.java  |  6 +++++-
 .../main/java/org/apache/wiki/auth/UserManager.java    | 13 ++-----------
 .../main/java/org/apache/wiki/auth/acl/AclManager.java | 14 ++------------
 .../org/apache/wiki/auth/authorize/GroupManager.java   |  3 ++-
 .../apache/wiki/render/DefaultRenderingManager.java    |  3 +++
 .../java/org/apache/wiki/render/RenderingManager.java  | 18 ++----------------
 .../java/org/apache/wiki/rss/DefaultRSSGenerator.java  |  6 +++++-
 .../main/java/org/apache/wiki/rss/RSSGenerator.java    | 13 ++-----------
 .../java/org/apache/wiki/ui/DefaultEditorManager.java  |  6 +++++-
 .../main/java/org/apache/wiki/ui/EditorManager.java    | 13 ++-----------
 .../main/java/org/apache/wiki/url/URLConstructor.java  | 13 ++-----------
 .../apache/wiki/workflow/DefaultWorkflowManager.java   |  6 ++++++
 .../java/org/apache/wiki/workflow/WorkflowManager.java | 18 ++----------------
 15 files changed, 44 insertions(+), 120 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
index 143c180..72a93f9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
@@ -18,9 +18,8 @@
  */
 package org.apache.wiki.auth;
 
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Session;
-import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.auth.authorize.Role;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventManager;
@@ -32,7 +31,6 @@ import javax.security.auth.spi.LoginModule;
 import javax.servlet.http.HttpServletRequest;
 import java.security.Principal;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 
@@ -47,7 +45,7 @@ import java.util.Set;
  * 
  * @since 2.3
  */
-public interface AuthenticationManager {
+public interface AuthenticationManager extends Initializable {
 
     /** If this jspwiki.properties property is <code>true</code>, logs the IP address of the editor on saving. */
     String PROP_STOREIPADDRESS = "jspwiki.storeIPAddress";
@@ -68,16 +66,6 @@ public interface AuthenticationManager {
     String PROP_LOGIN_MODULE = "jspwiki.loginModule.class";
 
     /**
-     * Creates an AuthenticationManager instance for the given Engine and
-     * the specified set of properties. All initialization for the modules is
-     * done here.
-     * @param engine the wiki engine
-     * @param props the properties used to initialize the wiki engine
-     * @throws WikiException if the AuthenticationManager cannot be initialized
-     */
-    void initialize( Engine engine, Properties props ) throws WikiException;
-
-    /**
      * Returns true if this Engine uses container-managed authentication. This method is used primarily for cosmetic purposes in the
      * JSP tier, and performs no meaningful security function per se. Delegates to
      * {@link org.apache.wiki.auth.authorize.WebContainerAuthorizer#isContainerAuthorized()},
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
index 328d266..74e11de 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
@@ -19,9 +19,8 @@
 package org.apache.wiki.auth;
 
 import org.apache.wiki.api.core.Context;
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Session;
-import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.auth.authorize.Role;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventManager;
@@ -32,7 +31,6 @@ import java.io.IOException;
 import java.security.AccessController;
 import java.security.Permission;
 import java.security.Principal;
-import java.util.Properties;
 
 
 /**
@@ -59,7 +57,7 @@ import java.util.Properties;
  * @since 2.3
  * @see AuthenticationManager
  */
-public interface AuthorizationManager {
+public interface AuthorizationManager extends Initializable {
 
     /** The default external Authorizer is the {@link org.apache.wiki.auth.authorize.WebContainerAuthorizer} */
     String DEFAULT_AUTHORIZER = "org.apache.wiki.auth.authorize.WebContainerAuthorizer";
@@ -198,16 +196,6 @@ public interface AuthorizationManager {
     boolean hasAccess( final Context context, final HttpServletResponse response, final boolean redirect ) throws IOException;
 
     /**
-     * Initializes AuthorizationManager with an engine and set of properties. Expects to find property 'jspwiki.authorizer' with a valid
-     * Authorizer implementation name to take care of role lookup operations.
-     *
-     * @param engine the wiki engine
-     * @param properties the set of properties used to initialize the wiki engine
-     * @throws WikiException if the AuthorizationManager cannot be initialized
-     */
-    void initialize( final Engine engine, final Properties properties ) throws WikiException;
-
-    /**
      * Checks to see if the local security policy allows a particular static Permission.
      * Do not use this method for normal permission checks; use {@link #checkPermission(Session, Permission)} instead.
      *
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java
index fef2949..3e5de32 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java
@@ -225,7 +225,11 @@ public class DefaultAuthorizationManager implements AuthorizationManager {
         return allowed;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * Expects to find property 'jspwiki.authorizer' with a valid Authorizer implementation name to take care of role lookup operations.
+     */
     @Override
     public void initialize( final Engine engine, final Properties properties ) throws WikiException {
         m_engine = engine;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/UserManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/UserManager.java
index 266cbe4..953f811 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/UserManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/UserManager.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.auth;
 
 import org.apache.wiki.api.core.Context;
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Session;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.user.DuplicateUserException;
 import org.apache.wiki.auth.user.UserDatabase;
@@ -30,7 +30,6 @@ import org.apache.wiki.event.WikiEventManager;
 import org.apache.wiki.event.WikiSecurityEvent;
 
 import java.security.Principal;
-import java.util.Properties;
 
 
 /**
@@ -38,7 +37,7 @@ import java.util.Properties;
  *
  * @since 2.3
  */
-public interface UserManager {
+public interface UserManager extends Initializable {
 
     /** Message key for the "save profile" message. */
     String PROP_DATABASE = "jspwiki.userdatabase";
@@ -46,14 +45,6 @@ public interface UserManager {
     String JSON_USERS = "users";
 
     /**
-     * Initializes the engine for its nefarious purposes.
-     *
-     * @param engine the current wiki engine
-     * @param props the wiki engine initialization properties
-     */
-    void initialize( final Engine engine, final Properties props );
-
-    /**
      * Returns the UserDatabase employed by this Engine. The UserDatabase is lazily initialized by this method, if it does
      * not exist yet. If the initialization fails, this method will use the inner class DummyUserDatabase as a default (which
      * is enough to get JSPWiki running).
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java
index 357db2e..d6f2825 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java
@@ -19,26 +19,16 @@
 package org.apache.wiki.auth.acl;
 
 import org.apache.wiki.api.core.Acl;
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.auth.WikiSecurityException;
 
-import java.util.Properties;
-
 /**
  *  Specifies how to parse and return ACLs from wiki pages.
  *
  *  @since 2.3
  */
-public interface AclManager {
-
-    /**
-     * Initializes the AclManager with a supplied wiki engine and properties.
-     *
-     * @param engine the wiki engine
-     * @param props the initialization properties
-     */
-    void initialize( Engine engine, Properties props );
+public interface AclManager extends Initializable {
 
     /**
      * A helper method for parsing textual AccessControlLists. The line is in form
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
index 3deea3a..e2816eb 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
@@ -20,6 +20,7 @@ package org.apache.wiki.auth.authorize;
 
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Session;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.auth.Authorizer;
 import org.apache.wiki.auth.NoSuchPrincipalException;
 import org.apache.wiki.auth.WikiSecurityException;
@@ -41,7 +42,7 @@ import javax.servlet.http.HttpServletRequest;
  * </p>
  * @since 2.4.19
  */
-public interface GroupManager extends Authorizer, WikiEventListener {
+public interface GroupManager extends Initializable, Authorizer, WikiEventListener {
 
     /** Key used for adding UI messages to a user's Session. */
     String MESSAGES_KEY = "group";
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java b/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java
index 9578916..a140f3a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java
@@ -98,6 +98,9 @@ public class DefaultRenderingManager implements RenderingManager {
 
     /**
      *  {@inheritDoc}
+     *
+     *  Checks for cache size settings, initializes the document cache. Looks for alternative WikiRenderers, initializes one, or the
+     *  default XHTMLRenderer, for use.
      */
     @Override
     public void initialize( final Engine engine, final Properties properties ) throws WikiException {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java b/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java
index d049ea7..36ecc32 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java
@@ -21,9 +21,8 @@ package org.apache.wiki.render;
 import org.apache.log4j.Logger;
 import org.apache.wiki.StringTransmutator;
 import org.apache.wiki.api.core.Context;
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
-import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.api.providers.PageProvider;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.modules.InternalModule;
@@ -31,7 +30,6 @@ import org.apache.wiki.parser.MarkupParser;
 import org.apache.wiki.parser.WikiDocument;
 
 import java.io.IOException;
-import java.util.Properties;
 
 
 /**
@@ -44,7 +42,7 @@ import java.util.Properties;
  *
  *  @since  2.4
  */
-public interface RenderingManager extends WikiEventListener, InternalModule {
+public interface RenderingManager extends WikiEventListener, InternalModule, Initializable {
 
     /** markup parser property. */
     String PROP_PARSER = "jspwiki.renderingManager.markupParser";
@@ -61,18 +59,6 @@ public interface RenderingManager extends WikiEventListener, InternalModule {
     String DOCUMENTCACHE_NAME = "jspwiki.renderingCache";
 
     /**
-     *  Initializes the RenderingManager.
-     *  Checks for cache size settings, initializes the document cache.
-     *  Looks for alternative WikiRenderers, initializes one, or the default
-     *  XHTMLRenderer, for use.
-     *
-     *  @param engine A Engine instance.
-     *  @param properties A list of properties to get parameters from.
-     *  @throws WikiException If the manager could not be initialized.
-     */
-    void initialize( Engine engine, Properties properties ) throws WikiException;
-
-    /**
      *  Beautifies the title of the page by appending spaces in suitable places, if the user has so decreed in the properties when
      *  constructing this Engine.  However, attachment names are only beautified by the name.
      *
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
index 12ee384..c0fa0cd 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
@@ -76,7 +76,11 @@ public class DefaultRSSGenerator implements RSSGenerator {
         m_rssFile = TextUtil.getStringProperty( properties, DefaultRSSGenerator.PROP_RSSFILE, "rss.rdf" );
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * Start the RSS generator & generator thread
+     */
     @Override
     public void initialize( final Engine engine, final Properties properties ) {
         final File rssFile;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/RSSGenerator.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/RSSGenerator.java
index e44a7ff..a501a4b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/RSSGenerator.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/RSSGenerator.java
@@ -19,12 +19,11 @@
 package org.apache.wiki.rss;
 
 import org.apache.wiki.api.core.Context;
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.util.TextUtil;
 
 import java.util.List;
-import java.util.Properties;
 
 /**
  *  The master class for generating different kinds of Feeds (including RSS1.0, 2.0 and Atom).
@@ -40,7 +39,7 @@ import java.util.Properties;
  *
  *  @since  1.7.5.
  */
-public interface RSSGenerator {
+public interface RSSGenerator extends Initializable {
 
     /** Parameter value to represent RSS 1.0 feeds.  Value is <tt>{@value}</tt>. */
     String RSS10 = "rss10";
@@ -105,14 +104,6 @@ public interface RSSGenerator {
     String PROP_RSS_AUTHOREMAIL = "jspwiki.rss.author.email";
 
     /**
-     * Start the RSS generator & generator thread
-     *
-     * @param engine the engine
-     * @param properties the properties
-     */
-    void initialize( Engine engine, Properties properties );
-
-    /**
      *  Generates the RSS resource.  You probably want to output this result into a file or something, or serve as output from a servlet.
      *
      *  @return A RSS 1.0 feed in the "full" mode.
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
index 77d42e3..9d74621 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
@@ -66,7 +66,11 @@ public class DefaultEditorManager extends BaseModuleManager implements EditorMan
         super( engine );
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * Initializes the EditorManager.  It also registers any editors it can find.
+     */
     @Override
     public void initialize( final Engine engine, final Properties props ) {
         registerEditors();
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
index 706ab3d..3c1236a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
@@ -19,11 +19,10 @@
 package org.apache.wiki.ui;
 
 import org.apache.wiki.api.core.Context;
-import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.modules.ModuleManager;
 
 import javax.servlet.jsp.PageContext;
-import java.util.Properties;
 
 
 /**
@@ -44,7 +43,7 @@ import java.util.Properties;
  *
  *  @since 2.4
  */
-public interface EditorManager extends ModuleManager {
+public interface EditorManager extends ModuleManager, Initializable {
 
     /** The property name for setting the editor. Current value is "jspwiki.editor" - not used anymore: replaced by defaultpref.template.editor */
     String PROP_EDITORTYPE = "jspwiki.editor";
@@ -65,14 +64,6 @@ public interface EditorManager extends ModuleManager {
     String ATTR_EDITEDTEXT = REQ_EDITEDTEXT;
 
     /**
-     * Initializes the EditorManager.  It also registers any editors it can find.
-     *
-     * @param engine engine performing the initialization.
-     * @param props  Properties for setup.
-     */
-    void initialize( Engine engine, Properties props );
-
-    /**
      *  Returns an editor for the current context.  The editor names are matched in a case insensitive manner.  At the moment, the only
      *  place that this method looks in is the property file, but in the future this will also look at user preferences.
      *  <p>
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/url/URLConstructor.java b/jspwiki-main/src/main/java/org/apache/wiki/url/URLConstructor.java
index e41f140..8853394 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/url/URLConstructor.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/url/URLConstructor.java
@@ -18,12 +18,11 @@
  */
 package org.apache.wiki.url;
 
-import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.engine.Initializable;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.nio.charset.Charset;
-import java.util.Properties;
 
 
 /**
@@ -33,15 +32,7 @@ import java.util.Properties;
  *
  *  @since 2.2
  */
-public interface URLConstructor {
-    /**
-     *  Initializes.  Note that the engine is not fully initialized at this
-     *  point, so don't do anything fancy here - use lazy init, if you have to.
-     *
-     *  @param  engine The Engine that this URLConstructor belongs to
-     *  @param properties Properties used to initialize
-     */
-    void initialize( Engine engine, Properties properties );
+public interface URLConstructor extends Initializable {
 
     /**
      *  Constructs the URL with a bunch of parameters.
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java b/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java
index 8ba0838..4703763 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/DefaultWorkflowManager.java
@@ -92,6 +92,12 @@ public class DefaultWorkflowManager implements WorkflowManager {
 
     /**
      * {@inheritDoc}
+     *
+     * Any properties that begin with {@link #PROPERTY_APPROVER_PREFIX} will be assumed to be Decisions that require approval. For a given
+     * property key, everything after the prefix denotes the Decision's message key. The property value indicates the Principal (Role,
+     * GroupPrincipal, WikiPrincipal) that must approve the Decision. For example, if the property key/value pair is
+     * {@code jspwiki.approver.workflow.saveWikiPage=Admin}, the Decision's message key is <code>workflow.saveWikiPage</code>. The Principal
+     * <code>Admin</code> will be resolved via {@link org.apache.wiki.auth.AuthorizationManager#resolvePrincipal(String)}.
      */
     @Override
     public void initialize( final Engine engine, final Properties props ) {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java b/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
index 6e803c0..a0cfdd2 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
@@ -18,14 +18,13 @@
  */
 package org.apache.wiki.workflow;
 
-import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Session;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.event.WikiEventListener;
 
 import java.security.Principal;
 import java.util.List;
-import java.util.Properties;
 import java.util.Set;
 
 
@@ -35,7 +34,7 @@ import java.util.Set;
  * particular Workflows.
  * </p>
  */
-public interface WorkflowManager extends WikiEventListener {
+public interface WorkflowManager extends WikiEventListener, Initializable {
 
     /** The workflow attribute which stores the wikiContext. */
     String WF_WP_SAVE_ATTR_PRESAVE_WIKI_CONTEXT = "wikiContext";
@@ -98,19 +97,6 @@ public interface WorkflowManager extends WikiEventListener {
     List< Workflow > getCompletedWorkflows();
 
     /**
-     * Initializes the WorkflowManager using a specfied Engine and properties. Any properties that begin with
-     * {@link #PROPERTY_APPROVER_PREFIX} will be assumed to be Decisions that require approval. For a given property key, everything
-     * after the prefix denotes the Decision's message key. The property value indicates the Principal (Role, GroupPrincipal, WikiPrincipal)
-     * that must approve the Decision. For example, if the property key/value pair is {@code jspwiki.approver.workflow.saveWikiPage=Admin},
-     * the Decision's message key is <code>workflow.saveWikiPage</code>. The Principal <code>Admin</code> will be resolved via
-     * {@link org.apache.wiki.auth.AuthorizationManager#resolvePrincipal(String)}.
-     *
-     * @param engine the wiki engine to associate with this WorkflowManager
-     * @param props the wiki engine's properties
-     */
-    void initialize( Engine engine, Properties props );
-
-    /**
      * Returns <code>true</code> if a workflow matching a particular key contains an approval step.
      *
      * @param messageKey the name of the workflow; corresponds to the value returned by {@link Workflow#getMessageKey()}.


[jspwiki] 12/15: added Initializable interface on public api

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit fc6d971687ab1f243ddb1661d6474da13fbf5d16
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 21:49:06 2020 +0100

    added Initializable interface on public api
---
 .../org/apache/wiki/api/engine/Initializable.java  | 42 ++++++++++++++++++++++
 .../java/org/apache/wiki/api/engine/package.html   | 34 ++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/engine/Initializable.java b/jspwiki-api/src/main/java/org/apache/wiki/api/engine/Initializable.java
new file mode 100644
index 0000000..39092a8
--- /dev/null
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/engine/Initializable.java
@@ -0,0 +1,42 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+ */
+package org.apache.wiki.api.engine;
+
+import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.exceptions.WikiException;
+
+import java.util.Properties;
+
+
+/**
+ * Marker interface for Engine's components that can be initialized.
+ */
+public interface Initializable {
+
+    /**
+     * <p>Initializes this Engine component. Note that the engine is not fully initialized at this
+     * point, so don't do anything fancy here - use lazy init, if you have to.<br/>&nbsp;</p>
+     *
+     * @param engine Engine performing the initialization.
+     * @param props Properties for setup.
+     * @throws WikiException if an exception occurs while initializing the component.
+     */
+    void initialize( Engine engine, Properties props ) throws WikiException;
+
+}
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/engine/package.html b/jspwiki-api/src/main/java/org/apache/wiki/api/engine/package.html
new file mode 100644
index 0000000..cdc935d
--- /dev/null
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/engine/package.html
@@ -0,0 +1,34 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Engine Components</title>
+</head>
+<body>
+JSPWiki's Engine's component related classes.
+
+<h3>Package Specification</h3>
+
+<h3>Related Documentation</h3>
+
+</body>
+</html>
\ No newline at end of file


[jspwiki] 06/15: update JUnit to 5.6.1 and Apache Lucene to 8.5.0

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 01523b5b2604dc95bad3b86b12d87e3afb1ee73e
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 15:48:47 2020 +0100

    update JUnit to 5.6.1 and Apache Lucene to 8.5.0
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5b14f23..29fc2e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,9 +64,9 @@
     <jdom2.version>2.0.6</jdom2.version>
     <jetty.version>8.1.15.v20140411</jetty.version>
     <jrcs-diff.version>0.4.2</jrcs-diff.version>
-    <junit.version>5.6.0</junit.version>
+    <junit.version>5.6.1</junit.version>
     <log4j.version>1.2.17</log4j.version>
-    <lucene.version>8.4.1</lucene.version>
+    <lucene.version>8.5.0</lucene.version>
     <nekohtml.version>1.9.22</nekohtml.version>
     <oro.version>2.0.8</oro.version>
     <sandler.version>0.5</sandler.version>


[jspwiki] 09/15: homogenize engine's components creation and ensure components' instances can have method scope, so we can get rid of them later on

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 24f4a6b34f1c8db22be13a319c110fe92207e842
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 16:48:25 2020 +0100

    homogenize engine's components creation and ensure components' instances can have method scope, so we can get rid of them later on
---
 .../src/main/java/org/apache/wiki/WikiEngine.java  | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
index dcfc5f5..8b963e7 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
@@ -403,7 +403,7 @@ public class WikiEngine implements Engine {
             m_commandResolver = ClassUtil.getMappedObject( CommandResolver.class.getName(), this, props );
             managers.put( CommandResolver.class, m_commandResolver );
 
-            m_urlConstructor = ( URLConstructor ) urlclass.getDeclaredConstructor().newInstance();
+            m_urlConstructor = ClassUtil.getMappedObject( urlclass.getName() );
             m_urlConstructor.initialize( this, props );
             managers.put( URLConstructor.class, m_urlConstructor );
 
@@ -442,14 +442,14 @@ public class WikiEngine implements Engine {
             managers.put( GroupManager.class, m_groupManager );
 
             m_editorManager         = ClassUtil.getMappedObject( EditorManager.class.getName(), this );
-            m_editorManager.initialize( props );
+            m_editorManager.initialize( this, props );
             managers.put( EditorManager.class, m_editorManager );
 
             m_progressManager       = ClassUtil.getMappedObject( ProgressManager.class.getName(), this );
             managers.put( ProgressManager.class, m_progressManager );
 
             m_aclManager = ClassUtil.getMappedObject( aclClassName );
-            m_aclManager.initialize( this, m_properties );
+            m_aclManager.initialize( this, props );
             managers.put( AclManager.class, m_aclManager );
 
             // Start the Workflow manager
@@ -487,8 +487,8 @@ public class WikiEngine implements Engine {
             initReferenceManager();
 
             //  Hook the different manager routines into the system.
-            m_filterManager.addPageFilter( m_referenceManager, -1001 );
-            m_filterManager.addPageFilter( m_searchManager, -1002 );
+            m_filterManager.addPageFilter( getManager( ReferenceManager.class ), -1001 );
+            m_filterManager.addPageFilter( getManager( SearchManager.class ), -1002 );
         } catch( final RuntimeException e ) {
             // RuntimeExceptions may occur here, even if they shouldn't.
             log.fatal( "Failed to start managers.", e );
@@ -585,11 +585,11 @@ public class WikiEngine implements Engine {
     public void initReferenceManager() throws WikiException {
         try {
             final ArrayList< Page > pages = new ArrayList<>();
-            pages.addAll( m_pageManager.getAllPages() );
-            pages.addAll( m_attachmentManager.getAllAttachments() );
+            pages.addAll( getManager( PageManager.class ).getAllPages() );
+            pages.addAll( getManager( AttachmentManager.class ).getAllAttachments() );
 
             // Build a new manager with default key lists.
-            if( m_referenceManager == null ) {
+            if( getManager( ReferenceManager.class ) == null ) {
                 m_referenceManager = ClassUtil.getMappedObject(ReferenceManager.class.getName(), this );
                 m_referenceManager.initialize( pages );
                 managers.put( ReferenceManager.class, m_referenceManager );
@@ -635,8 +635,9 @@ public class WikiEngine implements Engine {
     /** {@inheritDoc} */
     @Override
     public String getGlobalRSSURL() {
-        if( m_rssGenerator != null && m_rssGenerator.isEnabled() ) {
-            return getBaseURL() + "/" + m_rssGenerator.getRssFile();
+        final RSSGenerator rssGenerator = getManager( RSSGenerator.class );
+        if( rssGenerator != null && rssGenerator.isEnabled() ) {
+            return getBaseURL() + "/" + rssGenerator.getRssFile();
         }
 
         return null;
@@ -654,7 +655,8 @@ public class WikiEngine implements Engine {
         if( pageName == null ) {
             pageName = getFrontPage();
         }
-        return m_urlConstructor.makeURL( context, pageName, params );
+        final URLConstructor urlConstructor = getManager( URLConstructor.class );
+        return urlConstructor.makeURL( context, pageName, params );
     }
 
     /** {@inheritDoc} */
@@ -704,7 +706,7 @@ public class WikiEngine implements Engine {
     /** {@inheritDoc} */
     @Override
     public String getSpecialPageReference( final String original ) {
-        return m_commandResolver.getSpecialPageReference( original );
+        return getManager( CommandResolver.class ).getSpecialPageReference( original );
     }
 
     /** {@inheritDoc} */
@@ -718,7 +720,7 @@ public class WikiEngine implements Engine {
     /** {@inheritDoc} */
     @Override
     public String getFinalPageName( final String page ) throws ProviderException {
-        return m_commandResolver.getFinalPageName( page );
+        return getManager( CommandResolver.class ).getFinalPageName( page );
     }
 
     /** {@inheritDoc} */


[jspwiki] 11/15: fix title

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 668718f45bebffdf2986e7946008565226bc9e82
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 17:34:23 2020 +0100

    fix title
---
 jspwiki-api/src/main/java/org/apache/wiki/api/core/package.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/core/package.html b/jspwiki-api/src/main/java/org/apache/wiki/api/core/package.html
index 67dd3e3..3ce73bd 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/core/package.html
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/core/package.html
@@ -21,7 +21,7 @@
 <html lang="en">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>WikiEngine Managers</title>
+<title>JSPWiki core API</title>
 </head>
 <body>
 JSPWiki's central API.


[jspwiki] 01/15: apply format suggested by intellij

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 0f6994c1972226a716aefa1c9d20ff5f9425fbf9
Author: juanpablo <ju...@apache.org>
AuthorDate: Mon Mar 23 17:20:40 2020 +0100

    apply format suggested by intellij
---
 .../src/main/java/org/apache/wiki/WikiPage.java    | 213 +++++++++------------
 1 file changed, 92 insertions(+), 121 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
index f76dcec..ce0d220 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
@@ -31,14 +31,12 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 
+
 /**
  *  Simple wrapper class for the Wiki page attributes.  The Wiki page content is moved around in Strings, though.
  */
-
-// FIXME: We need to rethink how metadata is being used - probably the 
-//        author, date, etc. should also be part of the metadata.  We also
+// FIXME: We need to rethink how metadata is being used - probably the author, date, etc. should also be part of the metadata.  We also
 //        need to figure out the metadata lifecycle.
-
 public class WikiPage implements Page {
 
     private       String     m_name;
@@ -48,15 +46,15 @@ public class WikiPage implements Page {
     private long             m_fileSize = -1;
     private int              m_version = PageProvider.LATEST_VERSION;
     private String           m_author = null;
-    private final Map<String,Object> m_attributes = new HashMap<>();
-    
+    private final Map< String, Object > m_attributes = new HashMap<>();
+
     private Acl m_accessList = null;
 
     /**
-     *  Create a new WikiPage using a given engine and name.
+     * Create a new WikiPage using a given engine and name.
      *
-     *  @param engine The Engine that owns this page.
-     *  @param name   The name of the page.
+     * @param engine The Engine that owns this page.
+     * @param name   The name of the page.
      */
     public WikiPage( final Engine engine, final String name ) {
         m_engine = engine;
@@ -77,89 +75,79 @@ public class WikiPage implements Page {
     }
 
     /**
-     *  Returns the name of the page.
-     *  
-     *  @return The page name.
+     * Returns the name of the page.
+     *
+     * @return The page name.
      */
     @Override
-    public String getName()
-    {
+    public String getName() {
         return m_name;
     }
 
     /**
-     *  A WikiPage may have a number of attributes, which might or might not be 
-     *  available.  Typically attributes are things that do not need to be stored
-     *  with the wiki page to the page repository, but are generated
-     *  on-the-fly.  A provider is not required to save them, but they
-     *  can do that if they really want.
+     * A WikiPage may have a number of attributes, which might or might not be available.  Typically attributes are things that do not need
+     * to be stored with the wiki page to the page repository, but are generated on-the-fly.  A provider is not required to save them, but
+     * they can do that if they really want.
      *
-     *  @param key The key using which the attribute is fetched
-     *  @return The attribute.  If the attribute has not been set, returns null.
+     * @param key The key using which the attribute is fetched
+     * @return The attribute.  If the attribute has not been set, returns null.
      */
     @Override
     @SuppressWarnings( "unchecked" )
-    public < T > T getAttribute( final String key )
-    {
+    public < T > T getAttribute( final String key ) {
         return ( T )m_attributes.get( key );
     }
 
     /**
-     *  Sets an metadata attribute.
-     *  
-     *  @see #getAttribute(String)
-     *  @param key The key for the attribute used to fetch the attribute later on.
-     *  @param attribute The attribute value
+     * Sets an metadata attribute.
+     *
+     * @param key       The key for the attribute used to fetch the attribute later on.
+     * @param attribute The attribute value
+     * @see #getAttribute(String)
      */
     @Override
-    public void setAttribute( final String key, final Object attribute )
-    {
+    public void setAttribute( final String key, final Object attribute ) {
         m_attributes.put( key, attribute );
     }
 
     /**
-     * Returns the full attributes Map, in case external code needs
-     * to iterate through the attributes.
-     * 
+     * Returns the full attributes Map, in case external code needs to iterate through the attributes.
+     *
      * @return The attribute Map.  Please note that this is a direct
-     *         reference, not a copy.
+     * reference, not a copy.
      */
     @Override
-    public Map< String, Object > getAttributes()
-    {
+    public Map< String, Object > getAttributes() {
         return m_attributes;
     }
 
     /**
-     *  Removes an attribute from the page, if it exists.
-     *  
-     *  @param  key The key for the attribute
-     *  @return If the attribute existed, returns the object.
-     *  @since 2.1.111
+     * Removes an attribute from the page, if it exists.
+     *
+     * @param key The key for the attribute
+     * @return If the attribute existed, returns the object.
+     * @since 2.1.111
      */
     @Override
     @SuppressWarnings( "unchecked" )
-    public < T > T removeAttribute( final String key )
-    {
+    public < T > T removeAttribute( final String key ) {
         return ( T )m_attributes.remove( key );
     }
 
     /**
-     *  Returns the date when this page was last modified.
-     *  
-     *  @return The last modification date
+     * Returns the date when this page was last modified.
+     *
+     * @return The last modification date
      */
     @Override
-    public Date getLastModified()
-    {
+    public Date getLastModified() {
         return m_lastModified;
     }
 
     /**
-     *  Sets the last modification date.  In general, this is only
-     *  changed by the provider.
-     *  
-     *  @param date The date
+     * Sets the last modification date.  In general, this is only changed by the provider.
+     *
+     * @param date The date
      */
     @Override
     public void setLastModified( final Date date ) {
@@ -167,60 +155,54 @@ public class WikiPage implements Page {
     }
 
     /**
-     *  Sets the page version.  In general, this is only changed
-     *  by the provider.
-     *  
-     *  @param version The version number
+     * Sets the page version.  In general, this is only changed by the provider.
+     *
+     * @param version The version number
      */
     @Override
-    public void setVersion( final int version )
-    {
+    public void setVersion( final int version ) {
         m_version = version;
     }
 
     /**
-     *  Returns the version that this WikiPage instance represents.
-     *  
-     *  @return the version number of this page.
+     * Returns the version that this WikiPage instance represents.
+     *
+     * @return the version number of this page.
      */
     @Override
-    public int getVersion()
-    {
+    public int getVersion() {
         return m_version;
     }
 
     /**
-     *  Returns the size of the page.
-     *  
-     *  @return the size of the page. 
-     *  @since 2.1.109
+     * Returns the size of the page.
+     *
+     * @return the size of the page.
+     * @since 2.1.109
      */
     @Override
-    public long getSize()
-    {
+    public long getSize() {
         return m_fileSize;
     }
 
     /**
-     *  Sets the size.  Typically called by the provider only.
-     *  
-     *  @param size The size of the page.
-     *  @since 2.1.109
+     * Sets the size.  Typically called by the provider only.
+     *
+     * @param size The size of the page.
+     * @since 2.1.109
      */
     @Override
-    public void setSize( final long size )
-    {
+    public void setSize( final long size ) {
         m_fileSize = size;
     }
 
     /**
-     *  Returns the Acl for this page.  May return <code>null</code>, in case there is no Acl defined, or it has not yet been set by
-     *  {@link #setAcl(Acl)}.
-     *  
-     *  @return The access control list.  May return null, if there is no acl.
+     * Returns the Acl for this page.  May return <code>null</code>, in case there is no Acl defined, or it has not yet been set by
+     * {@link #setAcl(Acl)}.
+     *
+     * @return The access control list.  May return null, if there is no acl.
      */
-    public Acl getAcl()
-    {
+    public Acl getAcl() {
         return m_accessList;
     }
 
@@ -231,46 +213,42 @@ public class WikiPage implements Page {
      *
      * @param acl The Acl to set
      */
-    public void setAcl( final Acl acl )
-    {
+    public void setAcl( final Acl acl ) {
         m_accessList = acl;
     }
 
     /**
-     *  Sets the author of the page.  Typically called only by the provider.
-     *  
-     *  @param author The author name.
+     * Sets the author of the page.  Typically called only by the provider.
+     *
+     * @param author The author name.
      */
     @Override
-    public void setAuthor( final String author )
-    {
+    public void setAuthor( final String author ) {
         m_author = author;
     }
 
     /**
-     *  Returns author name, or null, if no author has been defined.
-     *  
-     *  @return Author name, or possibly null.
+     * Returns author name, or null, if no author has been defined.
+     *
+     * @return Author name, or possibly null.
      */
     @Override
-    public String getAuthor()
-    {
+    public String getAuthor() {
         return m_author;
     }
-    
+
     /**
-     *  Returns the wiki name for this page
-     *  
-     *  @return The name of the wiki.
+     * Returns the wiki name for this page
+     *
+     * @return The name of the wiki.
      */
     @Override
-    public String getWiki()
-    {
+    public String getWiki() {
         return m_wiki;
     }
 
     /**
-     *  This method will remove all metadata from the page.
+     * This method will remove all metadata from the page.
      */
     @Override
     public void invalidateMetadata() {
@@ -282,34 +260,31 @@ public class WikiPage implements Page {
     private boolean m_hasMetadata = false;
 
     /**
-     *  Returns <code>true</code> if the page has valid metadata; that is, it has been parsed. Note that this method is a kludge to
-     *  support our pre-3.0 metadata system, and as such will go away with the new API.
-     *  
-     *  @return true, if the page has metadata.
+     * Returns <code>true</code> if the page has valid metadata; that is, it has been parsed. Note that this method is a kludge to
+     * support our pre-3.0 metadata system, and as such will go away with the new API.
+     *
+     * @return true, if the page has metadata.
      */
     @Override
-    public boolean hasMetadata()
-    {
+    public boolean hasMetadata() {
         return m_hasMetadata;
     }
 
     /**
-     *  Sets the metadata flag to true.  Never call.
+     * Sets the metadata flag to true.  Never call.
      */
     @Override
-    public void setHasMetadata()
-    {
+    public void setHasMetadata() {
         m_hasMetadata = true;
     }
 
     /**
-     *  Returns a debug-suitable version of the page.
-     *  
-     *  @return A debug string.
+     * Returns a debug-suitable version of the page.
+     *
+     * @return A debug string.
      */
     @Override
-    public String toString()
-    {
+    public String toString() {
         return "WikiPage [" + m_wiki + ":" + m_name + ",ver=" + m_version + ",mod=" + m_lastModified + "]";
     }
 
@@ -322,15 +297,11 @@ public class WikiPage implements Page {
     @Override
     public WikiPage clone() {
         final WikiPage p = new WikiPage( m_engine, m_name );
-       
         p.m_wiki         = m_wiki;
-            
         p.m_author       = m_author;
         p.m_version      = m_version;
         p.m_lastModified = m_lastModified != null ? (Date)m_lastModified.clone() : null;
-
         p.m_fileSize     = m_fileSize;
-
         for( final Map.Entry< String, Object > entry : m_attributes.entrySet() ) {
             p.m_attributes.put( entry.getKey(), entry.getValue() );
         }
@@ -391,12 +362,12 @@ public class WikiPage implements Page {
         return false;
     }
     */
+
     /**
-     *  {@inheritDoc}
+     * {@inheritDoc}
      */
     @Override
-    public int hashCode()
-    {
+    public int hashCode() {
         return m_name.hashCode() * m_version;
     }
 


[jspwiki] 07/15: use o.a.w.api.core.Attachment instead of o.a.w.attachment.Attachment

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit f4380471aa6a1490b4608e2169a678c3c79e0045
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 15:51:40 2020 +0100

    use o.a.w.api.core.Attachment instead of o.a.w.attachment.Attachment
---
 .../src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java       | 2 +-
 jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandler.java    | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
index 889484f..12ee384 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
@@ -22,12 +22,12 @@ import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.providers.WikiProvider;
-import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.permissions.PagePermission;
 import org.apache.wiki.diff.DifferenceManager;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandler.java b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandler.java
index 41d48cb..e565c39 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandler.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandler.java
@@ -20,8 +20,9 @@ package org.apache.wiki.xmlrpc;
 
 import org.apache.wiki.LinkCollector;
 import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.Attachment;
+import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Page;
-import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.auth.permissions.PagePermission;
 import org.apache.wiki.auth.permissions.PermissionFactory;
 import org.apache.wiki.pages.PageManager;
@@ -216,7 +217,7 @@ public class RPCHandler extends AbstractRPCHandler {
         final LinkCollector extCollector   = new LinkCollector();
         final LinkCollector attCollector   = new LinkCollector();
 
-        final WikiContext context = new WikiContext( m_engine, page );
+        final Context context = new WikiContext( m_engine, page );
         m_engine.getManager( RenderingManager.class ).textToHTML( context, pagedata, localCollector, extCollector, attCollector );
 
         final Vector< Hashtable< String, String > > result = new Vector<>();


[jspwiki] 03/15: use Page instead of WikiPage whenever possible

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 58101a7496d2db189531227065532b47f98f434c
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 15:46:06 2020 +0100

    use Page instead of WikiPage whenever possible
---
 .../apache/wiki/attachment/AttachmentServlet.java  |   4 +-
 .../java/org/apache/wiki/filters/SpamFilter.java   |   3 +-
 .../org/apache/wiki/plugin/BugReportHandler.java   |   2 +-
 .../apache/wiki/plugin/RecentChangesPlugin.java    |   3 +-
 .../wiki/providers/BasicAttachmentProvider.java    |   2 +-
 .../apache/wiki/providers/FileSystemProvider.java  |  11 +-
 .../apache/wiki/search/LuceneSearchProvider.java   |   2 +-
 .../apache/wiki/tags/AttachmentsIteratorTag.java   |   4 +-
 .../java/org/apache/wiki/tags/CalendarTag.java     |   6 +-
 .../java/org/apache/wiki/tags/CheckLockTag.java    |   4 +-
 .../java/org/apache/wiki/tags/CheckVersionTag.java |   3 +-
 .../java/org/apache/wiki/tags/CommentLinkTag.java  |  59 ++++-------
 .../org/apache/wiki/tags/HasAttachmentsTag.java    |   4 +-
 .../org/apache/wiki/tags/HistoryIteratorTag.java   |  14 +--
 .../java/org/apache/wiki/tags/InsertPageTag.java   |   3 +-
 .../java/org/apache/wiki/tags/IteratorTag.java     |  15 +--
 .../main/java/org/apache/wiki/tags/LinkTag.java    |   3 +-
 .../java/org/apache/wiki/tags/LinkToParentTag.java |  44 +++-----
 .../main/java/org/apache/wiki/tags/LinkToTag.java  | 112 +++++++++------------
 .../java/org/apache/wiki/tags/NextVersionTag.java  |  24 ++---
 .../java/org/apache/wiki/tags/PageDateTag.java     |  74 ++++++--------
 .../java/org/apache/wiki/tags/PageInfoLinkTag.java |   4 +-
 .../java/org/apache/wiki/tags/PageTypeTag.java     |  37 +++----
 .../java/org/apache/wiki/tags/PageVersionTag.java  |  36 +++----
 .../org/apache/wiki/tags/PreviousVersionTag.java   |  21 ++--
 .../apache/wiki/tasks/pages/SaveWikiPageTask.java  |   8 +-
 .../java/org/apache/wiki/plugin/IfPluginTest.java  |   5 +-
 27 files changed, 201 insertions(+), 306 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentServlet.java b/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentServlet.java
index 3edf733..522ba79 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentServlet.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentServlet.java
@@ -27,10 +27,10 @@ import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.RedirectException;
@@ -560,7 +560,7 @@ public class AttachmentServlet extends HttpServlet {
             }
 
             if( changenote != null && changenote.length() > 0 ) {
-                att.setAttribute( WikiPage.CHANGENOTE, changenote );
+                att.setAttribute( Page.CHANGENOTE, changenote );
             }
 
             try {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java b/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java
index 0338d49..666f168 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/filters/SpamFilter.java
@@ -30,7 +30,6 @@ import org.apache.oro.text.regex.Perl5Compiler;
 import org.apache.oro.text.regex.Perl5Matcher;
 import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
@@ -837,7 +836,7 @@ public class SpamFilter extends BasePageFilter {
         }
 
         //  Don't forget to include the change note, too
-        final String changeNote = page.getAttribute( WikiPage.CHANGENOTE );
+        final String changeNote = page.getAttribute( Page.CHANGENOTE );
         if( changeNote != null ) {
             change.append( "\r\n" );
             change.append( changeNote );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/BugReportHandler.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/BugReportHandler.java
index 5e8852c..107264e 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/BugReportHandler.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/BugReportHandler.java
@@ -141,7 +141,7 @@ public class BugReportHandler implements Plugin {
             //  Now create a new page for this bug report
             final String pageName = findNextPage( context, title, params.get( PARAM_PAGE ) );
             final WikiPage newPage = new WikiPage( context.getEngine(), pageName );
-            final Context newContext = (Context)context.clone();
+            final Context newContext = context.clone();
             newContext.setPage( newPage );
             context.getEngine().getManager( PageManager.class ).saveText( newContext, str.toString() );
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/RecentChangesPlugin.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/RecentChangesPlugin.java
index 1482429..496e859 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/RecentChangesPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/RecentChangesPlugin.java
@@ -21,7 +21,6 @@ package org.apache.wiki.plugin;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
@@ -197,7 +196,7 @@ public class RecentChangesPlugin extends AbstractReferralPlugin implements Plugi
 
                 // Change note
                 if( showChangenote ) {
-                    final String changenote = pageref.getAttribute( WikiPage.CHANGENOTE );
+                    final String changenote = pageref.getAttribute( Page.CHANGENOTE );
                     final Element td_changenote = XhtmlUtil.element( XHTML.td, changenote );
                     td_changenote.setAttribute( XHTML.ATTR_class, "changenote" );
                     row.addContent( td_changenote );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java b/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
index 186f8d8..2a52a85 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/providers/BasicAttachmentProvider.java
@@ -288,7 +288,7 @@ public class BasicAttachmentProvider implements AttachmentProvider {
             }
             props.setProperty( versionNumber + ".author", author );
 
-            final String changeNote = att.getAttribute( WikiPage.CHANGENOTE );
+            final String changeNote = att.getAttribute( Page.CHANGENOTE );
             if( changeNote != null ) {
                 props.setProperty( versionNumber + ".changenote", changeNote );
             }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/providers/FileSystemProvider.java b/jspwiki-main/src/main/java/org/apache/wiki/providers/FileSystemProvider.java
index f2b7f08..067b64c 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/providers/FileSystemProvider.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/providers/FileSystemProvider.java
@@ -19,7 +19,6 @@
 package org.apache.wiki.providers;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
 
@@ -98,16 +97,16 @@ public class FileSystemProvider extends AbstractFileProvider {
             try( final InputStream in = new FileInputStream( file ) ) {
                 final Properties  props = new Properties();
                 props.load( in );
-                page.setAuthor( props.getProperty( WikiPage.AUTHOR ) );
+                page.setAuthor( props.getProperty( Page.AUTHOR ) );
 
-                final String changenote = props.getProperty( WikiPage.CHANGENOTE );
+                final String changenote = props.getProperty( Page.CHANGENOTE );
                 if( changenote != null ) {
-                    page.setAttribute( WikiPage.CHANGENOTE, changenote );
+                    page.setAttribute( Page.CHANGENOTE, changenote );
                 }
 
-                final String viewcount = props.getProperty( WikiPage.VIEWCOUNT );
+                final String viewcount = props.getProperty( Page.VIEWCOUNT );
                 if( viewcount != null ) {
-                    page.setAttribute( WikiPage.VIEWCOUNT, viewcount );
+                    page.setAttribute( Page.VIEWCOUNT, viewcount );
                 }
 
                 // Set the props values to the page attributes
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java b/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java
index d261e4d..47e3a9b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/search/LuceneSearchProvider.java
@@ -307,7 +307,7 @@ public class LuceneSearchProvider implements SearchProvider {
      *  @param page The WikiPage to check
      *  @param text The page text to index.
      */
-    protected synchronized void updateLuceneIndex( final WikiPage page, final String text ) {
+    protected synchronized void updateLuceneIndex( final Page page, final String text ) {
         log.debug("Updating Lucene index for page '" + page.getName() + "'...");
         pageRemoved( page );
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/AttachmentsIteratorTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/AttachmentsIteratorTag.java
index 8f249a0..4314b33 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/AttachmentsIteratorTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/AttachmentsIteratorTag.java
@@ -20,10 +20,10 @@ package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.attachment.AttachmentManager;
 import org.apache.wiki.pages.PageManager;
@@ -58,7 +58,7 @@ public class AttachmentsIteratorTag extends IteratorTag {
         m_wikiContext = (WikiContext) pageContext.getAttribute( WikiContext.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
         final Engine engine = m_wikiContext.getEngine();
         final AttachmentManager mgr = engine.getManager( AttachmentManager.class );
-        final WikiPage page;
+        final Page page;
 
         page = m_wikiContext.getPage();
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/CalendarTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/CalendarTag.java
index 125e19c..9b1b28b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/CalendarTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/CalendarTag.java
@@ -20,8 +20,8 @@ package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.pages.PageManager;
 import org.apache.wiki.util.HttpUtil;
 import org.apache.wiki.util.TextUtil;
@@ -127,7 +127,7 @@ public class CalendarTag extends WikiTagBase {
     }
 
     private String format( final String txt ) {
-        final WikiPage p = m_wikiContext.getPage();
+        final Page p = m_wikiContext.getPage();
         if( p != null ) {
             return TextUtil.replaceString( txt, "%p", p.getName() );
         }
@@ -197,7 +197,7 @@ public class CalendarTag extends WikiTagBase {
         nextMonth.add( Calendar.MONTH, 1 ); // Now move to 1st day of next month
 
         if ( day.before( nextMonth ) ) {
-            final WikiPage thePage = m_wikiContext.getPage();
+            final Page thePage = m_wikiContext.getPage();
             final String pageName = thePage.getName();
 
             final String calendarDate = m_dateFormat.format( day.getTime() );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckLockTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckLockTag.java
index d6753c7..5370494 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckLockTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckLockTag.java
@@ -18,8 +18,8 @@
  */
 package org.apache.wiki.tags;
 
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.pages.PageLock;
 import org.apache.wiki.pages.PageManager;
@@ -79,7 +79,7 @@ public class CheckLockTag extends WikiTagBase {
     @Override
     public final int doWikiStartTag() throws IOException, ProviderException {
         final Engine engine = m_wikiContext.getEngine();
-        final WikiPage page = m_wikiContext.getPage();
+        final Page page = m_wikiContext.getPage();
 
         if( page != null ) {
             final PageManager mgr = engine.getManager( PageManager.class );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckVersionTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckVersionTag.java
index 28e7ea9..f7abbfd 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckVersionTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/CheckVersionTag.java
@@ -19,7 +19,6 @@
 package org.apache.wiki.tags;
 
 import org.apache.wiki.InternalWikiException;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.pages.PageManager;
@@ -79,7 +78,7 @@ public class CheckVersionTag extends WikiTagBase {
     @Override
     public final int doWikiStartTag() {
         final Engine engine = m_wikiContext.getEngine();
-        final WikiPage page   = m_wikiContext.getPage();
+        final Page page = m_wikiContext.getPage();
 
         if( page != null && engine.getManager( PageManager.class ).wikiPageExists( page.getName() ) ) {
             final int version = page.getVersion();
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java
index 421b2ca..d8205ae 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java
@@ -18,13 +18,13 @@
  */
 package org.apache.wiki.tags;
 
-import java.io.IOException;
+import org.apache.wiki.InternalWikiException;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.Page;
 
 import javax.servlet.jsp.JspWriter;
+import java.io.IOException;
 
-import org.apache.wiki.InternalWikiException;
-import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 
 /**
  *  Writes a comment link.  Body of the link becomes the link text.
@@ -45,58 +45,35 @@ public class CommentLinkTag
      *  {@inheritDoc}
      */
     @Override
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage   page     = null;
-        String     pageName = null;
+    public final int doWikiStartTag() throws IOException {
+        final Page page;
+        final String pageName;
         
-        //
         //  Determine the page and the link.
-        //
-        if( m_pageName == null )
-        {
+        if( m_pageName == null ) {
             page = m_wikiContext.getPage();
-            if( page == null )
-            {
+            if( page == null ) {
                 // You can't call this on the page itself anyways.
                 return SKIP_BODY;
             }
-
             pageName = page.getName();
-        }
-        else
-        {
+        } else {
             pageName = m_pageName;
         }
 
-        //
-        //  Finally, print out the correct link, according to what
-        //  user commanded.
-        //
-        JspWriter out = pageContext.getOut();
-
-        switch( m_format )
-        {
-            case ANCHOR:
-                out.print("<a href=\""+getCommentURL(pageName)+"\">");
-                break;
-
-            case URL:
-                out.print( getCommentURL(pageName) );
-                break;
-                
-            default:
-                throw new InternalWikiException("Impossible format "+m_format);
-            
+        //  Finally, print out the correct link, according to what user commanded.
+        final JspWriter out = pageContext.getOut();
+        switch( m_format ) {
+        case ANCHOR: out.print( "<a href=\"" + getCommentURL( pageName ) + "\">" ); break;
+        case URL: out.print( getCommentURL( pageName ) ); break;
+        default: throw new InternalWikiException( "Impossible format " + m_format );
         }
 
         return EVAL_BODY_INCLUDE;
     }
 
-    private String getCommentURL( String pageName )
-    {
-        return m_wikiContext.getURL(WikiContext.COMMENT, pageName);
+    private String getCommentURL( final String pageName ) {
+        return m_wikiContext.getURL( WikiContext.COMMENT, pageName );
     }
 
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/HasAttachmentsTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/HasAttachmentsTag.java
index 1d58bbd..483f295 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/HasAttachmentsTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/HasAttachmentsTag.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.attachment.AttachmentManager;
 import org.apache.wiki.pages.PageManager;
@@ -39,7 +39,7 @@ public class HasAttachmentsTag extends WikiTagBase {
     @Override
     public final int doWikiStartTag() {
         final Engine engine = m_wikiContext.getEngine();
-        final WikiPage page = m_wikiContext.getPage();
+        final Page page = m_wikiContext.getPage();
         final AttachmentManager mgr = engine.getManager( AttachmentManager.class );
 
         try {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/HistoryIteratorTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/HistoryIteratorTag.java
index b52aaf5..30d1dc7 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/HistoryIteratorTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/HistoryIteratorTag.java
@@ -20,9 +20,9 @@ package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.pages.PageManager;
 
@@ -51,11 +51,11 @@ public class HistoryIteratorTag extends IteratorTag  {
     public final int doStartTag() {
         m_wikiContext = (WikiContext) pageContext.getAttribute( WikiContext.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
         final Engine engine = m_wikiContext.getEngine();
-        final WikiPage page = m_wikiContext.getPage();
+        final Page page = m_wikiContext.getPage();
 
         try {
             if( page != null && engine.getManager( PageManager.class ).wikiPageExists( page ) ) {
-                final List< WikiPage > versions = engine.getManager( PageManager.class ).getVersionHistory( page.getName() );
+                final List< Page > versions = engine.getManager( PageManager.class ).getVersionHistory( page.getName() );
 
                 if( versions == null ) {
                     // There is no history
@@ -65,8 +65,8 @@ public class HistoryIteratorTag extends IteratorTag  {
                 m_iterator = versions.iterator();
 
                 if( m_iterator.hasNext() ) {
-                    final WikiContext context = m_wikiContext.clone();
-                    context.setPage( ( WikiPage )m_iterator.next() );
+                    final Context context = m_wikiContext.clone();
+                    context.setPage( ( Page )m_iterator.next() );
                     pageContext.setAttribute( Context.ATTR_CONTEXT, context, PageContext.REQUEST_SCOPE );
                     pageContext.setAttribute( getId(), context.getPage() );
                 } else {
@@ -97,8 +97,8 @@ public class HistoryIteratorTag extends IteratorTag  {
         }
 
         if( m_iterator != null && m_iterator.hasNext() ) {
-            final WikiContext context = m_wikiContext.clone();
-            context.setPage( ( WikiPage )m_iterator.next() );
+            final Context context = m_wikiContext.clone();
+            context.setPage( ( Page )m_iterator.next() );
             pageContext.setAttribute( Context.ATTR_CONTEXT, context, PageContext.REQUEST_SCOPE );
             pageContext.setAttribute( getId(), context.getPage() );
             return EVAL_BODY_BUFFERED;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/InsertPageTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/InsertPageTag.java
index f8b36ce..d5e0259 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/InsertPageTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/InsertPageTag.java
@@ -19,7 +19,6 @@
 package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
@@ -111,7 +110,7 @@ public class InsertPageTag extends WikiTagBase {
             log.debug("Inserting page "+insertedPage);
 
             final JspWriter out = pageContext.getOut();
-            final WikiPage oldPage = m_wikiContext.setRealPage( insertedPage );
+            final Page oldPage = m_wikiContext.setRealPage( insertedPage );
             
             switch( m_mode ) {
               case HTML: out.print( engine.getManager( RenderingManager.class ).getHTML( m_wikiContext, insertedPage ) ); break;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/IteratorTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/IteratorTag.java
index f94929c..08ac9fc 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/IteratorTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/IteratorTag.java
@@ -20,8 +20,8 @@ package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.Page;
 
 import javax.servlet.jsp.JspWriter;
 import javax.servlet.jsp.PageContext;
@@ -109,19 +109,12 @@ public abstract class IteratorTag extends BodyTagSupport implements TryCatchFina
      *  Arg, I hate globals.
      */
     private void buildContext() {
-        //
-        //  Build a clone of the current context
-        //
-        final WikiContext context = m_wikiContext.clone();
-        
+        final Context context = m_wikiContext.clone();
         final Object o = m_iterator.next();
-        if( o instanceof WikiPage ) {
-            context.setPage( (WikiPage)o );
+        if( o instanceof Page ) {
+            context.setPage( ( Page )o );
         }
 
-        //
-        //  Push it to the iterator stack, and set the id.
-        //
         pageContext.setAttribute( Context.ATTR_CONTEXT, context, PageContext.REQUEST_SCOPE );
         pageContext.setAttribute( getId(), o );
     }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
index 872aa83..16740d8 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
@@ -20,7 +20,6 @@ package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
@@ -173,7 +172,7 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
         final Engine engine = m_wikiContext.getEngine();
 
         if( m_pageName == null ) {
-            final WikiPage page = m_wikiContext.getPage();
+            final Page page = m_wikiContext.getPage();
             if( page != null ) {
                 m_pageName = page.getName();
             }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToParentTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToParentTag.java
index 6a48b83..2e59104 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToParentTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToParentTag.java
@@ -18,10 +18,10 @@
  */
 package org.apache.wiki.tags;
 
-import java.io.IOException;
+import org.apache.wiki.api.core.Attachment;
+import org.apache.wiki.api.core.Page;
 
-import org.apache.wiki.WikiPage;
-import org.apache.wiki.attachment.Attachment;
+import java.io.IOException;
 
 /**
  *  Writes a link to a parent of a Wiki page.
@@ -34,39 +34,25 @@ import org.apache.wiki.attachment.Attachment;
  *
  *  @since 2.0
  */
-public class LinkToParentTag
-    extends LinkToTag
-{
+public class LinkToParentTag extends LinkToTag {
+
     private static final long serialVersionUID = 0L;
     
-    public int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage p = m_wikiContext.getPage();
+    public int doWikiStartTag() throws IOException {
+        final Page p = m_wikiContext.getPage();
 
-        //
-        //  We just simply set the page to be our parent page
-        //  and call the superclass.
-        //
-        if( p instanceof Attachment )
-        {
+        //  We just simply set the page to be our parent page and call the superclass.
+        if( p instanceof Attachment ) {
             setPage( ((Attachment)p).getParentName() );
-        }
-        else
-        {
-            String name = p.getName();
-
-            int entrystart = name.indexOf("_blogentry_");
-
-            if( entrystart != -1 )
-            {
+        } else {
+            final String name = p.getName();
+            final int entrystart = name.indexOf( "_blogentry_" );
+            if( entrystart != -1 ) {
                 setPage( name.substring( 0, entrystart ) );
             }
 
-            int commentstart = name.indexOf("_comments_");
-                
-            if( commentstart != -1 )
-            {
+            final int commentstart = name.indexOf( "_comments_" );
+            if( commentstart != -1 ) {
                 setPage( name.substring( 0, commentstart ) );
             }
         }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java
index 8e48cbc..6aba5a0 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.tags;
 
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
-import org.apache.wiki.attachment.Attachment;
+import org.apache.wiki.api.core.Attachment;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.attachment.AttachmentManager;
 
 import javax.servlet.jsp.JspWriter;
@@ -28,74 +28,62 @@ import java.io.IOException;
 
 
 /**
- *  Writes a link to a Wiki page.  Body of the link becomes the actual text.
- *  The link is written regardless to whether the page exists or not.
+ * Writes a link to a Wiki page.  Body of the link becomes the actual text.
+ * The link is written regardless to whether the page exists or not.
+ * <P><B>Attributes</B></P>
+ * <UL>
+ * <LI>page - Page name to refer to.  Default is the current page.
+ * <LI>format - either "anchor" or "url" to output either an <A>... or just the HREF part of one.
+ * <LI>template - Which template should we link to.
+ * <LI>title - Is used in page actions to display hover text (tooltip)
+ * <LI>accesskey - Set an accesskey (ALT+[Char])
+ * </UL>
  *
- *  <P><B>Attributes</B></P>
- *  <UL>
- *    <LI>page - Page name to refer to.  Default is the current page.
- *    <LI>format - either "anchor" or "url" to output either an <A>... or just the HREF part of one.
- *    <LI>template - Which template should we link to.
- *    <LI>title - Is used in page actions to display hover text (tooltip)
- *    <LI>accesskey - Set an accesskey (ALT+[Char])
- *  </UL>
- *
- *  @since 2.0
+ * @since 2.0
  */
-public class LinkToTag
-    extends WikiLinkTag
-{
+public class LinkToTag extends WikiLinkTag {
+
     private static final long serialVersionUID = 0L;
 
     private String m_version = null;
     public String m_title = "";
     public String m_accesskey = "";
 
-    @Override public void initTag()
-    {
+    @Override
+    public void initTag() {
         super.initTag();
         m_version = null;
     }
 
-    public String getVersion()
-    {
+    public String getVersion() {
         return m_version;
     }
 
-    public void setVersion( final String arg )
-    {
+    public void setVersion( final String arg ) {
         m_version = arg;
     }
 
-    public void setTitle( final String title )
-    {
+    public void setTitle( final String title ) {
         m_title = title;
     }
 
-    public void setAccesskey( final String access )
-    {
+    public void setAccesskey( final String access ) {
         m_accesskey = access;
     }
 
+    @Override
+    public int doWikiStartTag() throws IOException {
+        String pageName = m_pageName;
+        boolean isattachment = false;
 
-    @Override public int doWikiStartTag()
-        throws IOException
-    {
-        String     pageName = m_pageName;
-        boolean    isattachment = false;
+        if( m_pageName == null ) {
+            final Page p = m_wikiContext.getPage();
 
-        if( m_pageName == null )
-        {
-            final WikiPage p = m_wikiContext.getPage();
-
-            if( p != null )
-            {
+            if( p != null ) {
                 pageName = p.getName();
 
                 isattachment = p instanceof Attachment;
-            }
-            else
-            {
+            } else {
                 return SKIP_BODY;
             }
         }
@@ -105,37 +93,35 @@ public class LinkToTag
         final String linkclass;
         String forceDownload = "";
 
-        if( isattachment )
-        {
-            url = m_wikiContext.getURL(WikiContext.ATTACH, pageName,
-                                       (getVersion() != null) ? "version="+getVersion() : null );
+        if( isattachment ) {
+            url = m_wikiContext.getURL( WikiContext.ATTACH, pageName, ( getVersion() != null ) ? "version=" + getVersion() : null );
             linkclass = "attachment";
 
-            if( m_wikiContext.getEngine().getManager( AttachmentManager.class ).forceDownload( pageName ) )
-            {
+            if( m_wikiContext.getEngine().getManager( AttachmentManager.class ).forceDownload( pageName ) ) {
                 forceDownload = "download ";
             }
 
-        }
-        else
-        {
-        	final StringBuilder params = new StringBuilder();
-            if( getVersion() != null ) params.append( "version="+getVersion() );
-            if( getTemplate() != null ) params.append( (params.length()>0?"&amp;":"") + "skin="+getTemplate() );
-
-            url = m_wikiContext.getURL( WikiContext.VIEW, pageName,
-                                        params.toString() );
+        } else {
+            final StringBuilder params = new StringBuilder();
+            if( getVersion() != null ) {
+                params.append( "version=" ).append( getVersion() );
+            }
+            if( getTemplate() != null ) {
+                params.append( params.length() > 0 ? "&amp;" : "" ).append( "skin=" ).append( getTemplate() );
+            }
+
+            url = m_wikiContext.getURL( WikiContext.VIEW, pageName, params.toString() );
             linkclass = "wikipage";
         }
 
-        switch( m_format )
-        {
-          case ANCHOR:
-            out.print("<a class=\""+linkclass+"\" href=\""+url+"\" accesskey=\""
-                          + m_accesskey + "\" title=\"" + m_title
-                          + "\" " + forceDownload + ">");
+        switch( m_format ) {
+        case ANCHOR:
+            out.print( "<a class=\"" + linkclass +
+                       "\" href=\"" + url +
+                       "\" accesskey=\"" + m_accesskey +
+                       "\" title=\"" + m_title + "\" " + forceDownload + ">" );
             break;
-          case URL:
+        case URL:
             out.print( url );
             break;
         }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/NextVersionTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/NextVersionTag.java
index 0db9ea9..407712a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/NextVersionTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/NextVersionTag.java
@@ -18,34 +18,30 @@
  */
 package org.apache.wiki.tags;
 
+import org.apache.wiki.api.core.Page;
+import org.apache.wiki.api.providers.WikiProvider;
+
 import java.io.IOException;
 
-import org.apache.wiki.WikiPage;
 
 /**
  *  Writes the version number of the next version of the page.
  *
  *  @since 2.2
  */
-public class NextVersionTag
-    extends WikiTagBase
-{
+public class NextVersionTag extends WikiTagBase {
+
     private static final long serialVersionUID = 0L;
-    
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage   page   = m_wikiContext.getPage();
 
+    public final int doWikiStartTag() throws IOException {
+        final Page page = m_wikiContext.getPage();
         int version = page.getVersion();
-
-        if( version == -1 )
-            version = -1;
-        else
+        if( version != WikiProvider.LATEST_VERSION ) {
             version++;
+        }
 
         pageContext.getOut().print( version );
-
         return SKIP_BODY;
     }
+
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageDateTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageDateTag.java
index 3ee4db1..5fe0d3e 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageDateTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageDateTag.java
@@ -18,82 +18,68 @@
  */
 package org.apache.wiki.tags;
 
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import java.io.IOException;
-
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.preferences.Preferences.TimeFormat;
 
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+
 /**
- *  Writes the modification date of the page, formatted
- *  as specified in the attribute "format".
+ * Writes the modification date of the page, formatted
+ * as specified in the attribute "format".
+ * <UL>
+ * <LI>format = A string describing which format you want to use.
+ * This is exactly like in "java.text.SimpleDateFormat".
+ * </UL>
  *
- *  <UL>
- *   <LI>format = A string describing which format you want to use.
- *       This is exactly like in "java.text.SimpleDateFormat".
- *  </UL>
- *
- *  @since 2.0
+ * @since 2.0
  */
 
 // FIXME: Should also take the current user TimeZone into account.
 
-public class PageDateTag
-    extends WikiTagBase
-{
+public class PageDateTag extends WikiTagBase {
+
     private static final long serialVersionUID = 0L;
-    
+
     public static final String DEFAULT_FORMAT = "dd-MMM-yyyy HH:mm:ss zzz";
 
     private String m_format = null;
 
-    public void initTag()
-    {
+    public void initTag() {
         super.initTag();
         m_format = null;
     }
 
-    public String getFormat()
-    {
+    public String getFormat() {
         return m_format;
     }
 
-    public void setFormat( String arg )
-    {
+    public void setFormat( final String arg ) {
         m_format = arg;
     }
 
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage   page   = m_wikiContext.getPage();
-
-        if( page != null )
-        {
-            Date d = page.getLastModified();
-
-            //
+    public final int doWikiStartTag() throws IOException {
+        final Page page = m_wikiContext.getPage();
+        if( page != null ) {
+            final Date d = page.getLastModified();
             //  Date may be null if the page does not exist.
-            //
-            if( d != null )
-            {
-                SimpleDateFormat fmt;
-                
-                if( m_format == null )
+            if( d != null ) {
+                final SimpleDateFormat fmt;
+                if( m_format == null ) {
                     fmt = Preferences.getDateFormat( m_wikiContext, TimeFormat.DATETIME );
-                else
+                } else {
                     fmt = new SimpleDateFormat( m_format );
+                }
 
                 pageContext.getOut().write( fmt.format( d ) );
-            }
-            else
-            {
+            } else {
                 pageContext.getOut().write( "&lt;never&gt;" );
             }
         }
-
         return SKIP_BODY;
     }
+
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java
index 1ecbd73..d698874 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.tags;
 
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.pages.PageManager;
 
 import javax.servlet.jsp.JspWriter;
@@ -60,7 +60,7 @@ public class PageInfoLinkTag extends WikiLinkTag {
         String     pageName = m_pageName;
 
         if( m_pageName == null ) {
-            final WikiPage p = m_wikiContext.getPage();
+            final Page p = m_wikiContext.getPage();
             if( p != null ) {
                 pageName = p.getName();
             } else {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageTypeTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageTypeTag.java
index d4c19f5..dfd4153 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageTypeTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageTypeTag.java
@@ -18,10 +18,10 @@
  */
 package org.apache.wiki.tags;
 
-import java.io.IOException;
+import org.apache.wiki.api.core.Attachment;
+import org.apache.wiki.api.core.Page;
 
-import org.apache.wiki.WikiPage;
-import org.apache.wiki.attachment.Attachment;
+import java.io.IOException;
 
 /**
  *  Includes the body, if the current page is of proper type.
@@ -33,43 +33,32 @@ import org.apache.wiki.attachment.Attachment;
  *
  *  @since 2.0
  */
-public class PageTypeTag
-    extends WikiTagBase
-{
+public class PageTypeTag extends WikiTagBase {
+
     private static final long serialVersionUID = 0L;
     
     private String m_type;
 
-    public void initTag()
-    {
+    public void initTag() {
         super.initTag();
         m_type = null;
     }
 
-    public void setType( String arg )
+    public void setType( final String arg )
     {
         m_type = arg.toLowerCase();
     }
 
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage   page   = m_wikiContext.getPage();
-
-        if( page != null )
-        {
-            if( m_type.equals("attachment") && page instanceof Attachment )
-            {
+    public final int doWikiStartTag() throws IOException {
+        final Page page = m_wikiContext.getPage();
+        if( page != null ) {
+            if( m_type.equals( "attachment" ) && page instanceof Attachment ) {
                 return EVAL_BODY_INCLUDE;
             }
-            
-            if( m_type.equals("page") && !(page instanceof Attachment) )
-            {
+            if( m_type.equals( "page" ) && !( page instanceof Attachment ) ) {
                 return EVAL_BODY_INCLUDE;
             }
-
-            if( m_type.equals("weblogentry") && !(page instanceof Attachment) && page.getName().indexOf("_blogentry_") != -1 )
-            {
+            if( m_type.equals( "weblogentry" ) && !( page instanceof Attachment ) && page.getName().contains( "_blogentry_" ) ) {
                 return EVAL_BODY_INCLUDE;
             }
         }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageVersionTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageVersionTag.java
index 6233cce..85c58cf 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageVersionTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageVersionTag.java
@@ -18,38 +18,30 @@
  */
 package org.apache.wiki.tags;
 
+import org.apache.wiki.api.core.Page;
+
 import java.io.IOException;
 
-import org.apache.wiki.WikiPage;
 
 /**
- *  Writes the version of the current page.  If this is
- *  marked as the current version, then includes body as text instead of
- *  version number.
+ * Writes the version of the current page.  If this is marked as the current version, then includes body as text instead of version number.
  *
- *  @since 2.0
+ * @since 2.0
  */
-public class PageVersionTag
-    extends WikiTagBase
-{
+public class PageVersionTag extends WikiTagBase {
+
     private static final long serialVersionUID = 0L;
-    
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage   page   = m_wikiContext.getPage();
-
-        if( page != null )
-        {
-            int version = page.getVersion();
-
-            if( version > 0 )
-            {
-                pageContext.getOut().print( Integer.toString(version) );
+
+    public final int doWikiStartTag() throws IOException {
+        final Page page = m_wikiContext.getPage();
+        if( page != null ) {
+            final int version = page.getVersion();
+            if( version > 0 ) {
+                pageContext.getOut().print( Integer.toString( version ) );
                 return SKIP_BODY;
             }
         }
-
         return EVAL_BODY_INCLUDE;
     }
+
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/PreviousVersionTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/PreviousVersionTag.java
index adcdf38..5c71659 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/PreviousVersionTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/PreviousVersionTag.java
@@ -18,36 +18,33 @@
  */
 package org.apache.wiki.tags;
 
+import org.apache.wiki.api.core.Page;
+
 import java.io.IOException;
 
-import org.apache.wiki.WikiPage;
 
 /**
  *  Outputs the version number of the previous version of this page.
  *
  *  @since 2.2
  */
-public class PreviousVersionTag
-    extends WikiTagBase
-{
+public class PreviousVersionTag extends WikiTagBase {
+
     private static final long serialVersionUID = 0L;
     
     /**
      *  {@inheritDoc}
      */
     @Override
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        WikiPage   page   = m_wikiContext.getPage();
-
+    public final int doWikiStartTag() throws IOException {
+        final Page page = m_wikiContext.getPage();
         int version = page.getVersion();
-
         version--;
-
-        if( version > 0 )
+        if( version > 0 ) {
             pageContext.getOut().print( version );
+        }
 
         return SKIP_BODY;
     }
+
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java b/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java
index dde704c..3f83d08 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java
@@ -18,9 +18,9 @@
  */
 package org.apache.wiki.tasks.pages;
 
-import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.filters.FilterManager;
 import org.apache.wiki.pages.PageManager;
@@ -51,11 +51,11 @@ public class SaveWikiPageTask extends Task {
     @Override
     public Outcome execute() throws WikiException {
         // Retrieve attributes
-        final WikiContext context = ( WikiContext ) getWorkflow().getAttribute( WorkflowManager.WF_WP_SAVE_ATTR_PRESAVE_WIKI_CONTEXT );
+        final Context context = ( Context ) getWorkflow().getAttribute( WorkflowManager.WF_WP_SAVE_ATTR_PRESAVE_WIKI_CONTEXT );
         final String proposedText = (String) getWorkflow().getAttribute( WorkflowManager.WF_WP_SAVE_FACT_PROPOSED_TEXT );
 
         final Engine engine = context.getEngine();
-        final WikiPage page = context.getPage();
+        final Page page = context.getPage();
 
         // Let the rest of the engine handle actual saving.
         engine.getManager( PageManager.class ).putPageText( page, proposedText );
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java b/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java
index 4560e93..f737cbe 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/plugin/IfPluginTest.java
@@ -21,7 +21,6 @@ package org.apache.wiki.plugin;
 import net.sourceforge.stripes.mock.MockHttpServletRequest;
 import org.apache.wiki.TestEngine;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.core.Session;
@@ -47,8 +46,8 @@ public class IfPluginTest {
     /**
      * Returns a {@link WikiContext} for the given page, with user {@link Users#JANNE} logged in.
      *
-     * @param page given {@link WikiPage}.
-     * @return {@link WikiContext} associated to given {@link WikiPage}.
+     * @param page given {@link Page}.
+     * @return {@link WikiContext} associated to given {@link Page}.
      * @throws WikiException problems while logging in.
      */
     WikiContext getJanneBasedWikiContextFor( final Page page ) throws WikiException {


[jspwiki] 02/15: JSPWIKI-303: add Pages' ACLs

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 49af134fd57f249f46cfcd1bf9f5159816463727
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 15:45:22 2020 +0100

    JSPWIKI-303: add Pages' ACLs
---
 .../main/java/org/apache/wiki/api/core/Acl.java    |   4 +-
 .../main/java/org/apache/wiki/api/core/Page.java   |   4 +-
 .../src/main/java/org/apache/wiki/WikiPage.java    |  18 +++-
 .../org/apache/wiki/auth/AuthorizationManager.java |   2 +-
 .../wiki/auth/DefaultAuthorizationManager.java     |  10 +-
 .../main/java/org/apache/wiki/auth/acl/Acl.java    | 116 +++++++++------------
 .../java/org/apache/wiki/auth/acl/AclEntry.java    |  87 ++--------------
 .../java/org/apache/wiki/auth/acl/AclImpl.java     | 110 +++++++------------
 .../java/org/apache/wiki/auth/acl/AclManager.java  |   9 +-
 .../apache/wiki/auth/acl/DefaultAclManager.java    |  18 ++--
 .../org/apache/wiki/pages/DefaultPageManager.java  |  12 +--
 .../apache/wiki/parser/JSPWikiMarkupParser.java    |   2 +-
 .../wiki/auth/acl/DefaultAclManagerTest.java       |  10 +-
 .../AccessRuleLinkNodePostProcessorState.java      |   6 +-
 14 files changed, 155 insertions(+), 253 deletions(-)

diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Acl.java b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Acl.java
index be51eb9..71f798f 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Acl.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Acl.java
@@ -62,7 +62,7 @@ public interface Acl {
      *
      * @return an enumeration of the entries in this ACL.
      */
-    Enumeration< AclEntry > entries();
+    Enumeration< AclEntry > aclEntries();
 
     /**
      * Returns <code>true</code>, if this Acl is empty.
@@ -88,7 +88,7 @@ public interface Acl {
      * @param principal the principal to search for
      * @return the AclEntry associated with the principal, or <code>null</code>
      */
-    AclEntry getEntry( Principal principal );
+    AclEntry getAclEntry( Principal principal );
 
     /**
      * Removes an ACL entry from this ACL.
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Page.java b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Page.java
index 65975e5..a83ecd8 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/core/Page.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/core/Page.java
@@ -169,7 +169,7 @@ public interface Page extends Cloneable, Comparable< Page > {
      *
      *  @return The access control list.  May return null, if there is  no acl.
      */
-    //Acl getAcl();
+    Acl getAcl();
 
     /**
      * Sets the Acl for this page. Note that method does <em>not</em> persist the Acl itself to back-end storage or in page markup;
@@ -178,7 +178,7 @@ public interface Page extends Cloneable, Comparable< Page > {
      *
      * @param acl The Acl to set
      */
-    //void setAcl( Acl acl );
+    void setAcl( Acl acl );
 
     /** {@inheritDoc} */
     Page clone();
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
index ce0d220..f278d5b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiPage.java
@@ -203,7 +203,7 @@ public class WikiPage implements Page {
      * @return The access control list.  May return null, if there is no acl.
      */
     public Acl getAcl() {
-        return m_accessList;
+        return (org.apache.wiki.auth.acl.Acl)m_accessList;
     }
 
     /**
@@ -212,9 +212,23 @@ public class WikiPage implements Page {
      * {@link org.apache.wiki.auth.acl.AclManager#setPermissions(WikiPage, Acl)}.
      *
      * @param acl The Acl to set
+     * @deprecated use {@link #setAcl(org.apache.wiki.api.core.Acl)}
+     * @see #setAcl(org.apache.wiki.api.core.Acl)
      */
+    @Deprecated
     public void setAcl( final Acl acl ) {
-        m_accessList = acl;
+        setAcl( ( org.apache.wiki.api.core.Acl )acl );
+    }
+
+    /**
+     * Sets the Acl for this page. Note that method does <em>not</em> persist the Acl itself to back-end storage or in page markup;
+     * it merely sets the internal field that stores the Acl. To persist the Acl, callers should invoke
+     * {@link org.apache.wiki.auth.acl.AclManager#setPermissions(WikiPage, Acl)}.
+     *
+     * @param acl The Acl to set
+     */
+    public void setAcl( final org.apache.wiki.api.core.Acl acl ) {
+        m_accessList = ( Acl )acl;
     }
 
     /**
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
index a0c1e80..328d266 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
@@ -77,7 +77,7 @@ public interface AuthorizationManager {
      * Returns <code>true</code> or <code>false</code>, depending on whether a Permission is allowed for the Subject associated with
      * a supplied Session. The access control algorithm works this way:
      * <ol>
-     * <li>The {@link org.apache.wiki.auth.acl.Acl} for the page is obtained</li>
+     * <li>The {@link org.apache.wiki.api.core.Acl} for the page is obtained</li>
      * <li>The Subject associated with the current {@link org.apache.wiki.api.core.Session} is obtained</li>
      * <li>If the Subject's Principal set includes the Role Principal that is the administrator group, always allow the Permission</li>
      * <li>For all permissions, check to see if the Permission is allowed according to the default security policy. If it isn't, deny
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java
index 5ca590a..fef2949 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthorizationManager.java
@@ -20,14 +20,14 @@ package org.apache.wiki.auth;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
+import org.apache.wiki.api.core.AclEntry;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.api.exceptions.WikiException;
-import org.apache.wiki.auth.acl.Acl;
-import org.apache.wiki.auth.acl.AclEntry;
 import org.apache.wiki.auth.acl.AclManager;
 import org.apache.wiki.auth.acl.UnresolvedPrincipal;
 import org.apache.wiki.auth.authorize.GroupManager;
@@ -127,7 +127,7 @@ public class DefaultAuthorizationManager implements AuthorizationManager {
 
         // If the page or ACL is null, it's allowed.
         final String pageName = ((PagePermission)permission).getPage();
-        final WikiPage page = ( WikiPage )m_engine.getManager( PageManager.class ).getPage( pageName );
+        final Page page = m_engine.getManager( PageManager.class ).getPage( pageName );
         final Acl acl = ( page == null) ? null : m_engine.getManager( AclManager.class ).getPermissions( page );
         if( page == null ||  acl == null || acl.isEmpty() ) {
             fireEvent( WikiSecurityEvent.ACCESS_ALLOWED, user, permission );
@@ -146,7 +146,7 @@ public class DefaultAuthorizationManager implements AuthorizationManager {
         for( Principal aclPrincipal : aclPrincipals ) {
             // If the ACL principal we're looking at is unresolved, try to resolve it here & correct the Acl
             if ( aclPrincipal instanceof UnresolvedPrincipal ) {
-                final AclEntry aclEntry = acl.getEntry( aclPrincipal );
+                final AclEntry aclEntry = acl.getAclEntry( aclPrincipal );
                 aclPrincipal = resolvePrincipal( aclPrincipal.getName() );
                 if ( aclEntry != null && !( aclPrincipal instanceof UnresolvedPrincipal ) ) {
                     aclEntry.setPrincipal( aclPrincipal );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/Acl.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/Acl.java
index 91b398a..5237bcc 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/Acl.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/Acl.java
@@ -18,97 +18,81 @@
  */
 package org.apache.wiki.auth.acl;
 
-import java.security.Permission;
 import java.security.Principal;
+import java.util.Collections;
 import java.util.Enumeration;
+import java.util.List;
+import java.util.stream.Collectors;
+
 
 /**
  * <p>
- * Defines an access control list (ACL) for wiki pages. An Access Control List
- * is a data structure used to guard access to resources. An ACL can be thought
- * of as a data structure with multiple ACL entries. Each ACL entry, of
- * interface type AclEntry, contains a set of positive permissions associated
- * with a particular principal. (A principal represents an entity such as an
- * individual user or a group). The ACL Entries in each ACL observe the
- * following rules:
- * </p>
- * <ul>
- * <li>Each principal can have at most one ACL entry; that is, multiple ACL
- * entries are not allowed for any principal. Each entry specifies the set of
- * permissions that are to be granted</li>
- * <li>If there is no entry for a particular principal, then the principal is
- * considered to have a null (empty) permission set</li>
- * </ul>
- * <p>
- * This interface is a highly stripped-down derivation of the
- * java.security.acl.Acl interface. In particular, the notion of an Acl "owner"
- * has been eliminated, since JWPWiki pages do not have owners. An additional
- * simplification compared to the standard Java package is that negative
- * permissions have been eliminated. Instead, JSPWiki assumes a "default-deny"
- * security stance: principals are granted no permissions by default, and
- * posesses only those that have been explicitly granted to them. And finally,
- * the getPermissions() and checkPermission() methods have been eliminated due
- * to the complexities associated with resolving Role principal membership.
+ * Deprecated, interface kept in order to keep backwards compatibility with versions up to 2.11.0.M6. {@link org.apache.wiki.api.core.Acl}
+ * should be used instead.
  * </p>
+ * {@inheritDoc}
  * @since 2.3
+ * @deprecated use {@link org.apache.wiki.api.core.Acl} insteaad
+ * @see org.apache.wiki.api.core.Acl
  */
-public interface Acl
-{
+@Deprecated
+public interface Acl extends org.apache.wiki.api.core.Acl {
+
     /**
-     * Adds an ACL entry to this ACL. An entry associates a principal (e.g., an
-     * individual or a group) with a set of permissions. Each principal can have
-     * at most one positive ACL entry, specifying permissions to be granted to
-     * the principal. If there is already an ACL entry already in the ACL, false
-     * is returned.
+     * Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) with a set of permissions. Each
+     * principal can have at most one positive ACL entry, specifying permissions to be granted to the principal. If there is already an
+     * ACL entry already in the ACL, false is returned.
+     *
      * @param entry - the ACL entry to be added to this ACL
-     * @return true on success, false if an entry of the same type (positive or
-     *         negative) for the same principal is already present in this ACL
+     * @return true on success, false if an entry of the same type (positive or negative) for the same principal is already present in this ACL
+     * @deprecated use {@link #addEntry(org.apache.wiki.api.core.AclEntry)} instead.
+     * @see #addEntry(org.apache.wiki.api.core.AclEntry
      */
-    boolean addEntry( AclEntry entry );
+    @Deprecated
+    default boolean addEntry( final AclEntry entry ) {
+        return addEntry( ( org.apache.wiki.api.core.AclEntry )entry );
+    }
 
     /**
-     * Returns an enumeration of the entries in this ACL. Each element in the
-     * enumeration is of type AclEntry.
+     * Returns an enumeration of the entries in this ACL. Each element in the enumeration is of type AclEntry.
+     *
      * @return an enumeration of the entries in this ACL.
+     * @deprecated use {@link #aclEntries()} instead.
+     * @see #aclEntries()
      */
-    Enumeration< AclEntry > entries();
-
-    /**
-     * Returns <code>true</code>, if this Acl is empty.
-     * @return the result
-     * @since 2.4.68
-     */
-    boolean isEmpty();
+    @Deprecated
+    default Enumeration< AclEntry > entries() {
+        final List< AclEntry> entries = Collections.list( aclEntries() ) // iterates list two times - this is ok as we don't expect too many elements inside aclEntries()
+                                                   .stream()
+                                                   .map( entry -> ( AclEntry )entry )
+                                                   .collect( Collectors.toList() );
+        return Collections.enumeration( entries );
+    }
 
     /**
-     * Returns all Principal objects assigned a given Permission in the access
-     * control list. The Princiapls returned are those that have been granted
-     * either the supplied permission, or a permission implied by the supplied
-     * permission. Principals are not "expanded" if they are a role or group.
-     * @param permission the permission to search for
-     * @return an array of Principals posessing the permission
-     */
-    Principal[] findPrincipals( Permission permission );
-
-    /**
-     * Returns an AclEntry for a supplied Principal, or <code>null</code> if
-     * the Principal does not have a matching AclEntry.
+     * Returns an AclEntry for a supplied Principal, or <code>null</code> if the Principal does not have a matching AclEntry.
+     *
      * @param principal the principal to search for
      * @return the AclEntry associated with the principal, or <code>null</code>
+     * @deprecated use {@link #getAclEntry(Principal)} instead.
+     * @see #getAclEntry(Principal)
      */
-    AclEntry getEntry( Principal principal );
+    @Deprecated
+    default AclEntry getEntry( final Principal principal ) {
+        return ( AclEntry )getAclEntry( principal );
+    }
 
     /**
      * Removes an ACL entry from this ACL.
+     *
      * @param entry the ACL entry to be removed from this ACL
      * @return true on success, false if the entry is not part of this ACL
+     * @deprecated use {@link #removeEntry(org.apache.wiki.api.core.AclEntry)} instead.
+     * @see #removeEntry(org.apache.wiki.api.core.AclEntry
      */
-    boolean removeEntry( AclEntry entry );
-
-    /**
-     * Returns a string representation of the contents of this Acl.
-     * @return the string representation
-     */
-    String toString();
+    @Deprecated
+    default boolean removeEntry( final AclEntry entry ) {
+        return removeEntry( ( org.apache.wiki.api.core.AclEntry )entry );
+    }
 
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclEntry.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclEntry.java
index 0946720..f46d2b4 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclEntry.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclEntry.java
@@ -18,88 +18,19 @@
  */
 package org.apache.wiki.auth.acl;
 
-import java.security.Permission;
-import java.security.Principal;
-import java.util.Enumeration;
-
 /**
  * <p>
- * Represents one entry in an Access Control List (ACL).
- * </p>
- * <p>
- * An ACL can be thought of as a data structure with multiple ACL entry objects.
- * Each ACL entry object contains a set of positive page permissions associated
- * with a particular principal. (A principal represents an entity such as an
- * individual user, group, or role). Each principal can have at most one ACL
- * entry; that is, multiple ACL entries are not allowed for any principal.
- * </p>
- * <p>
- * This interface is functionally equivalent to the java.security.acl.AclEntry
- * interface, minus negative permissions.
+ * Deprecated, interface kept in order to keep backwards compatibility with versions up to 2.11.0.M6. {@link org.apache.wiki.api.core.AclEntry}
+ * should be used instead.
  * </p>
+ *
+ * {@inheritDoc}
+ *
  * @see Acl
  * @since 2.3
+ * @deprecated use {@link org.apache.wiki.api.core.AclEntry} insteaad
+ * @see org.apache.wiki.api.core.AclEntry
  */
-public interface AclEntry
-{
-
-    /**
-     * Adds the specified permission to this ACL entry. The permission
-     * <em>must</em> be of type
-     * {@link org.apache.wiki.auth.permissions.PagePermission}. Note: An entry
-     * can have multiple permissions.
-     * @param permission the permission to be associated with the principal in
-     *            this entry
-     * @return <code>true</code> if the permission was added, 
-     *         <code>false</code> if the permission was
-     *         already part of this entry's permission set, and <code>false</code> if
-     *         the permission is not of type PagePermission
-     */
-    boolean addPermission(Permission permission);
-
-    /**
-     * Checks if the specified permission is part of the permission set in this
-     * entry.
-     * @param permission the permission to be checked for.
-     * @return true if the permission is part of the permission set in this entry,
-     *         false otherwise.
-     */
-    boolean checkPermission(Permission permission);
-
-    /**
-     * Returns the principal for which permissions are granted by this
-     * ACL entry. Returns null if there is no principal set for this entry yet.
-     * @return the principal associated with this entry.
-     */
-    Principal getPrincipal();
-
-    /**
-     * Returns an enumeration of the permissions in this ACL entry.
-     * @return an enumeration of the permissions
-     */
-    Enumeration< Permission > permissions();
-
-    /**
-     * Removes the specified permission from this ACL entry.
-     * @param permission the permission to be removed from this entry.
-     * @return true if the permission is removed, false if the permission was not
-     *         part of this entry's permission set.
-     */
-    boolean removePermission(Permission permission);
-
-    /**
-     * Specifies the principal for which permissions are granted or denied by
-     * this ACL entry. If a principal was already set for this ACL entry, false
-     * is returned, otherwise true is returned.
-     * @param user the principal to be set for this entry
-     * @return true if the principal is set, false if there was already a
-     *         principal set for this entry
-     */
-    boolean setPrincipal(Principal user);
-
-    /**
-     * Returns a string representation of the contents of this ACL entry.
-     * @return a string representation of the contents.
-     */
-    String toString();
+@Deprecated
+public interface AclEntry extends org.apache.wiki.api.core.AclEntry {
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclImpl.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclImpl.java
index 0a5d0ab..8688e0b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclImpl.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclImpl.java
@@ -18,67 +18,62 @@
  */
 package org.apache.wiki.auth.acl;
 
+import org.apache.wiki.api.core.AclEntry;
+
 import java.io.Serializable;
 import java.security.Permission;
 import java.security.Principal;
 import java.util.Enumeration;
 import java.util.Vector;
 
+
 /**
- *  JSPWiki implementation of an Access Control List.
+ * JSPWiki implementation of an Access Control List.
  *
- *  @since 2.3
+ * @since 2.3
  */
-public class AclImpl implements Acl, Serializable
-{
+public class AclImpl implements Acl, Serializable {
+
     private static final long serialVersionUID = 1L;
-    private final Vector<AclEntry> m_entries = new Vector<>();
+    private final Vector< AclEntry > m_entries = new Vector<>();
 
     /**
      * Constructs a new AclImpl instance.
      */
-    public AclImpl()
-    {
+    public AclImpl() {
     }
-    
-    /**
-     * Returns all Principal objects assigned a given Permission in the access control list. The Principals returned are those that have
-     * been granted either the supplied permission, or a permission implied by the supplied permission. Principals are not "expanded" if
-     * they are a role or group.
-     *
-     * @param permission the permission to search for
-     * @return an array of Principals possessing the permission
-     */
+
+    /** {@inheritDoc} */
+    @Override
     public Principal[] findPrincipals( final Permission permission ) {
         final Vector< Principal > principals = new Vector<>();
-        final Enumeration< AclEntry > entries = entries();
-        
+        final Enumeration< AclEntry > entries = aclEntries();
         while( entries.hasMoreElements() ) {
             final AclEntry entry = entries.nextElement();
             final Enumeration< Permission > permissions = entry.permissions();
             while( permissions.hasMoreElements() ) {
                 final Permission perm = permissions.nextElement();
-                if ( perm.implies( permission ) ) {
+                if( perm.implies( permission ) ) {
                     principals.add( entry.getPrincipal() );
                 }
             }
         }
         return principals.toArray( new Principal[ principals.size() ] );
     }
-  
+
     private boolean hasEntry( final AclEntry entry ) {
         if( entry == null ) {
             return false;
         }
 
         for( final AclEntry e : m_entries ) {
-            final Principal ep     = e.getPrincipal();
+            final Principal ep = e.getPrincipal();
             final Principal entryp = entry.getPrincipal();
 
             if( ep == null || entryp == null ) {
-                throw new IllegalArgumentException( "Entry is null; check code, please (entry="+entry+"; e="+e+")" );
+                throw new IllegalArgumentException( "Entry is null; check code, please (entry=" + entry + "; e=" + e + ")" );
             }
-            
+
             if( ep.getName().equals( entryp.getName() ) ) {
                 return true;
             }
@@ -87,15 +82,8 @@ public class AclImpl implements Acl, Serializable
         return false;
     }
 
-    /**
-     * Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) with a set of permissions. Each
-     * principal can have at most one positive ACL entry, specifying permissions to be granted to the principal. If there is already an
-     * ACL entry already in the ACL, false is returned.
-     *
-     * @param entry - the ACL entry to be added to this ACL
-     * @return true on success, false if an entry of the same type (positive or negative) for the same principal is already present in
-     * this ACL
-     */
+    /** {@inheritDoc} */
+    @Override
     public synchronized boolean addEntry( final AclEntry entry ) {
         if( entry.getPrincipal() == null ) {
             throw new IllegalArgumentException( "Entry principal cannot be null" );
@@ -104,39 +92,27 @@ public class AclImpl implements Acl, Serializable
         if( hasEntry( entry ) ) {
             return false;
         }
-        
+
         m_entries.add( entry );
 
         return true;
     }
 
-    /**
-     * Removes an ACL entry from this ACL.
-     * @param entry the ACL entry to be removed from this ACL
-     * @return true on success, false if the entry is not part of this ACL
-     */
-    public synchronized boolean removeEntry( final AclEntry entry )
-    {
+    /** {@inheritDoc} */
+    @Override
+    public synchronized boolean removeEntry( final AclEntry entry ) {
         return m_entries.remove( entry );
     }
 
-    /**
-     * Returns an enumeration of the entries in this ACL. Each element in the
-     * enumeration is of type AclEntry.
-     * @return an enumeration of the entries in this ACL.
-     */
-    public Enumeration< AclEntry > entries()
-    {
+    /** {@inheritDoc} */
+    @Override
+    public Enumeration< AclEntry > aclEntries() {
         return m_entries.elements();
     }
 
-    /**
-     * Returns an AclEntry for a supplied Principal, or <code>null</code> if the Principal does not have a matching AclEntry.
-     *
-     * @param principal the principal to search for
-     * @return the AclEntry associated with the principal, or <code>null</code>
-     */
-    public AclEntry getEntry( final Principal principal ) {
+    /** {@inheritDoc} */
+    @Override
+    public AclEntry getAclEntry( final Principal principal ) {
         for( final AclEntry entry : m_entries ) {
             if( entry.getPrincipal().getName().equals( principal.getName() ) ) {
                 return entry;
@@ -146,13 +122,16 @@ public class AclImpl implements Acl, Serializable
         return null;
     }
 
-    /**
-     * Returns a string representation of the contents of this Acl.
-     *
-     * @return the string representation
-     */
+    /** {@inheritDoc} */
+    @Override
+    public boolean isEmpty() {
+        return m_entries.isEmpty();
+    }
+
+    /** {@inheritDoc} */
+    @Override
     public String toString() {
-    	final StringBuilder sb = new StringBuilder();
+        final StringBuilder sb = new StringBuilder();
         for( final AclEntry entry : m_entries ) {
             final Principal pal = entry.getPrincipal();
             if( pal != null ) {
@@ -167,19 +146,8 @@ public class AclImpl implements Acl, Serializable
             }
             sb.append( ")\n" );
         }
-
         return sb.toString();
     }
 
-    /**
-     * Returns <code>true</code>, if this Acl is empty.
-     *
-     * @return the result
-     * @since 2.4.68
-     */
-    public boolean isEmpty() {
-        return m_entries.isEmpty();
-    }
-
 }
     
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java
index 17ae713..357db2e 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/AclManager.java
@@ -18,8 +18,9 @@
  */
 package org.apache.wiki.auth.acl;
 
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.auth.WikiSecurityException;
 
 import java.util.Properties;
@@ -50,7 +51,7 @@ public interface AclManager {
      * @throws WikiSecurityException if the ruleLine was faulty somehow.
      * @since 2.1.121
      */
-    Acl parseAcl( WikiPage page, String ruleLine ) throws WikiSecurityException;
+    Acl parseAcl( Page page, String ruleLine ) throws WikiSecurityException;
 
     /**
      * Returns the access control list for the page. If the ACL has not been parsed yet, it is done on-the-fly. If the page has a
@@ -61,7 +62,7 @@ public interface AclManager {
      * @since 2.2.121
      * @return the Acl representing permissions for the page
      */
-    Acl getPermissions( WikiPage page );
+    Acl getPermissions( Page page );
 
     /**
      * Sets the access control list for the page and persists it.
@@ -71,6 +72,6 @@ public interface AclManager {
      * @since 2.5
      * @throws WikiSecurityException if the ACL cannot be set or persisted
      */
-    void setPermissions( WikiPage page, Acl acl ) throws WikiSecurityException;
+    void setPermissions( Page page, Acl acl ) throws WikiSecurityException;
 
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
index 5f9a531..3ecda49 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
@@ -20,11 +20,13 @@ package org.apache.wiki.auth.acl;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
+import org.apache.wiki.api.core.AclEntry;
+import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
-import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.WikiSecurityException;
 import org.apache.wiki.auth.permissions.PagePermission;
@@ -85,7 +87,7 @@ public class DefaultAclManager implements AclManager {
 
     /** {@inheritDoc} */
     @Override
-    public Acl parseAcl( final WikiPage page, final String ruleLine ) throws WikiSecurityException {
+    public Acl parseAcl( final Page page, final String ruleLine ) throws WikiSecurityException {
         Acl acl = page.getAcl();
         if (acl == null) {
             acl = new AclImpl();
@@ -99,7 +101,7 @@ public class DefaultAclManager implements AclManager {
             while( fieldToks.hasMoreTokens() ) {
                 final String principalName = fieldToks.nextToken(",").trim();
                 final Principal principal = m_auth.resolvePrincipal(principalName);
-                final AclEntry oldEntry = acl.getEntry(principal);
+                final AclEntry oldEntry = acl.getAclEntry(principal);
 
                 if( oldEntry != null ) {
                     log.debug( "Adding to old acl list: " + principal + ", " + actions );
@@ -129,7 +131,7 @@ public class DefaultAclManager implements AclManager {
 
     /** {@inheritDoc} */
     @Override
-    public Acl getPermissions( final WikiPage page ) {
+    public Acl getPermissions( final Page page ) {
         //  Does the page already have cached ACLs?
         Acl acl = page.getAcl();
         log.debug( "page=" + page.getName() + "\n" + acl );
@@ -137,7 +139,7 @@ public class DefaultAclManager implements AclManager {
         if( acl == null ) {
             //  If null, try the parent.
             if( page instanceof Attachment ) {
-                final WikiPage parent = ( WikiPage )m_engine.getManager( PageManager.class ).getPage( ( ( Attachment ) page ).getParentName() );
+                final Page parent = m_engine.getManager( PageManager.class ).getPage( ( ( Attachment ) page ).getParentName() );
                 acl = getPermissions(parent);
             } else {
                 //  Or, try parsing the page
@@ -157,7 +159,7 @@ public class DefaultAclManager implements AclManager {
 
     /** {@inheritDoc} */
     @Override
-    public void setPermissions( final WikiPage page, final Acl acl ) throws WikiSecurityException {
+    public void setPermissions( final Page page, final Acl acl ) throws WikiSecurityException {
         final PageManager pageManager = m_engine.getManager( PageManager.class );
 
         // Forcibly expire any page locks
@@ -188,7 +190,7 @@ public class DefaultAclManager implements AclManager {
     protected static String printAcl( final Acl acl ) {
         // Extract the ACL entries into a Map with keys == permissions, values == principals
         final Map< String, List< Principal > > permissionPrincipals = new TreeMap<>();
-        final Enumeration< AclEntry > entries = acl.entries();
+        final Enumeration< AclEntry > entries = acl.aclEntries();
         while( entries.hasMoreElements() ) {
             final AclEntry entry = entries.nextElement();
             final Principal principal = entry.getPrincipal();
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/pages/DefaultPageManager.java b/jspwiki-main/src/main/java/org/apache/wiki/pages/DefaultPageManager.java
index eaa8934..0b17008 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/pages/DefaultPageManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/pages/DefaultPageManager.java
@@ -22,6 +22,8 @@ import org.apache.commons.lang3.ArrayUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiBackgroundThread;
 import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
+import org.apache.wiki.api.core.AclEntry;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Engine;
@@ -34,8 +36,6 @@ import org.apache.wiki.api.providers.WikiProvider;
 import org.apache.wiki.attachment.AttachmentManager;
 import org.apache.wiki.auth.WikiPrincipal;
 import org.apache.wiki.auth.WikiSecurityException;
-import org.apache.wiki.auth.acl.Acl;
-import org.apache.wiki.auth.acl.AclEntry;
 import org.apache.wiki.auth.acl.AclEntryImpl;
 import org.apache.wiki.auth.acl.AclManager;
 import org.apache.wiki.auth.user.UserProfile;
@@ -707,11 +707,11 @@ public class DefaultPageManager implements PageManager {
                 int pagesChanged = 0;
                 final Collection< Page > pages = getAllPages();
                 for( final Page page : pages ) {
-                    final boolean aclChanged = changeAcl( ( WikiPage )page, oldPrincipals, newPrincipal );
+                    final boolean aclChanged = changeAcl( page, oldPrincipals, newPrincipal );
                     if( aclChanged ) {
                         // If the Acl needed changing, change it now
                         try {
-                            m_engine.getManager( AclManager.class ).setPermissions( ( WikiPage )page, ( ( WikiPage )page ).getAcl() );
+                            m_engine.getManager( AclManager.class ).setPermissions( page, page.getAcl() );
                         } catch( final WikiSecurityException e ) {
                             LOG.error("Could not change page ACL for page " + page.getName() + ": " + e.getMessage(), e);
                         }
@@ -735,11 +735,11 @@ public class DefaultPageManager implements PageManager {
      * @param newPrincipal the Principal that should receive the old Principals' permissions
      * @return <code>true</code> if the Acl was actually changed; <code>false</code> otherwise
      */
-    protected boolean changeAcl( final WikiPage page, final Principal[] oldPrincipals, final Principal newPrincipal ) {
+    protected boolean changeAcl( final Page page, final Principal[] oldPrincipals, final Principal newPrincipal ) {
         final Acl acl = page.getAcl();
         boolean pageChanged = false;
         if( acl != null ) {
-            final Enumeration< AclEntry > entries = acl.entries();
+            final Enumeration< AclEntry > entries = acl.aclEntries();
             final Collection< AclEntry > entriesToAdd = new ArrayList<>();
             final Collection< AclEntry > entriesToRemove = new ArrayList<>();
             while( entries.hasMoreElements() ) {
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
index 9aee850..17669f9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java
@@ -32,6 +32,7 @@ import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.StringTransmutator;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.exceptions.PluginException;
 import org.apache.wiki.api.plugin.Plugin;
@@ -39,7 +40,6 @@ import org.apache.wiki.attachment.AttachmentManager;
 import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.UserManager;
 import org.apache.wiki.auth.WikiSecurityException;
-import org.apache.wiki.auth.acl.Acl;
 import org.apache.wiki.auth.acl.AclManager;
 import org.apache.wiki.i18n.InternationalizationManager;
 import org.apache.wiki.preferences.Preferences;
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java b/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java
index d1fccb7..37323ba 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java
@@ -20,7 +20,9 @@ package org.apache.wiki.auth.acl;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
+import org.apache.wiki.api.core.AclEntry;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.auth.WikiPrincipal;
 import org.apache.wiki.auth.permissions.PermissionFactory;
@@ -55,12 +57,12 @@ public class DefaultAclManagerTest
     @Test
     public void testGetPermissions()
     {
-        WikiPage page = ( WikiPage )m_engine.getManager( PageManager.class ).getPage( "TestDefaultPage" );
+        Page page = m_engine.getManager( PageManager.class ).getPage( "TestDefaultPage" );
         Acl acl = m_engine.getManager( AclManager.class ).getPermissions( page );
         Assertions.assertNotNull( page.getAcl() );
         Assertions.assertTrue(page.getAcl().isEmpty());
 
-        page = ( WikiPage )m_engine.getManager( PageManager.class ).getPage( "TestAclPage" );
+        page = m_engine.getManager( PageManager.class ).getPage( "TestAclPage" );
         acl = m_engine.getManager( AclManager.class ).getPermissions( page );
         Assertions.assertNotNull( page.getAcl() );
         Assertions.assertFalse(page.getAcl().isEmpty());
@@ -161,7 +163,7 @@ public class DefaultAclManagerTest
     public void testPrintAcl()
     {
         // Verify that the printed Acl for the test page is OK
-        final WikiPage page = ( WikiPage )m_engine.getManager( PageManager.class ).getPage( "TestAclPage" );
+        final Page page = m_engine.getManager( PageManager.class ).getPage( "TestAclPage" );
         Acl acl = m_engine.getManager( AclManager.class ).getPermissions( page );
         final String aclString = DefaultAclManager.printAcl( acl );
         Assertions.assertEquals( "[{ALLOW edit Charlie,Herman}]\n", aclString );
diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java
index 3ee509e..86abb70 100755
--- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java
+++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java
@@ -21,10 +21,10 @@ package org.apache.wiki.markdown.extensions.jspwikilinks.postprocessor;
 import com.vladsch.flexmark.util.ast.Node;
 import com.vladsch.flexmark.util.ast.NodeTracker;
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Acl;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.auth.WikiSecurityException;
-import org.apache.wiki.auth.acl.Acl;
 import org.apache.wiki.auth.acl.AclManager;
 import org.apache.wiki.markdown.nodes.JSPWikiLink;
 import org.apache.wiki.render.RenderingManager;
@@ -54,7 +54,7 @@ public class AccessRuleLinkNodePostProcessorState implements NodePostProcessorSt
     public void process( final NodeTracker state, final JSPWikiLink link ) {
         String ruleLine = NodePostProcessorStateCommonOperations.inlineLinkTextOnWysiwyg( state, link, m_wysiwygEditorMode );
         if( wikiContext.getEngine().getManager( RenderingManager.class ).getParser( wikiContext, link.getUrl().toString() ).isParseAccessRules() ) {
-            final WikiPage page = ( WikiPage )wikiContext.getRealPage();
+            final Page page = wikiContext.getRealPage();
             if( ruleLine.startsWith( "{" ) ) {
                 ruleLine = ruleLine.substring( 1 );
             }


[jspwiki] 08/15: add Engine to EditorManager#initialize(..) method. It will be unused but will allow us to extract an Initializable interface later on

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 0743c530789e099f4efdcfff35f3bcff0a78082a
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 16:46:16 2020 +0100

    add Engine to EditorManager#initialize(..) method. It will be unused but will allow us to extract an Initializable interface later on
---
 .../src/main/java/org/apache/wiki/ui/DefaultEditorManager.java    | 2 +-
 jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java  | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
index 8a3a11c..77d42e3 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
@@ -68,7 +68,7 @@ public class DefaultEditorManager extends BaseModuleManager implements EditorMan
 
     /** {@inheritDoc} */
     @Override
-    public void initialize( final Properties props ) {
+    public void initialize( final Engine engine, final Properties props ) {
         registerEditors();
     }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
index ed34db8..706ab3d 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
@@ -19,6 +19,7 @@
 package org.apache.wiki.ui;
 
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.modules.ModuleManager;
 
 import javax.servlet.jsp.PageContext;
@@ -64,11 +65,12 @@ public interface EditorManager extends ModuleManager {
     String ATTR_EDITEDTEXT = REQ_EDITEDTEXT;
 
     /**
-     *  Initializes the EditorManager.  It also registers any editors it can find.
+     * Initializes the EditorManager.  It also registers any editors it can find.
      *
-     *  @param props  Properties for setup.
+     * @param engine engine performing the initialization.
+     * @param props  Properties for setup.
      */
-    void initialize( Properties props );
+    void initialize( Engine engine, Properties props );
 
     /**
      *  Returns an editor for the current context.  The editor names are matched in a case insensitive manner.  At the moment, the only


[jspwiki] 15/15: 2.11.0-M7-git-15

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 1e6e4f322fc19a203d3793936db045028a01fc4b
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 23:09:29 2020 +0100

    2.11.0-M7-git-15
---
 ChangeLog.md                                              | 15 +++++++++++++++
 .../src/main/java/org/apache/wiki/api/Release.java        |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index f1d708e..215e77b 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -17,6 +17,21 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+**2020-03-25  Juan Pablo Santos (juanpablo AT apache DOT org)**
+
+* _2.11.0-M7-git-15_
+
+* [JSPWIKI-303](https://issues.apache.org/jira/browse/JSPWIKI-303): JSPWiki-API library creation
+    * `Page` deals with ACLs
+
+* Refactor `WikiEngine` initialization, in order to prepare for building and configuring custom 
+managers (somewhat related to [JSPWIKI-806](https://issues.apache.org/jira/browse/JSPWIKI-806) - 
+EntityManager Proposal) 
+
+* Dependency updates
+    * Lucene to 8.5.0
+    * JUnit to 5.6.1
+
 **2020-03-21  Juan Pablo Santos (juanpablo AT apache DOT org)**
 
 * _2.11.0-M7-git-14_
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
index 61fd742..a029ab0 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
@@ -69,7 +69,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "git-14";
+    public static final String     BUILD         = "git-15";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of


[jspwiki] 13/15: Refactor WikiEngine initialization (somewhat related to JSPWIKI-806)

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 3b8bb073fbc93d2bae83cb11acd1fdfd8f548484
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 21:49:56 2020 +0100

    Refactor WikiEngine initialization (somewhat related to JSPWIKI-806)
---
 .../src/main/java/org/apache/wiki/WikiEngine.java  | 242 ++++++---------------
 1 file changed, 63 insertions(+), 179 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
index 54441db..eaf46a0 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java
@@ -24,6 +24,7 @@ import org.apache.log4j.PropertyConfigurator;
 import org.apache.wiki.api.Release;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
+import org.apache.wiki.api.engine.Initializable;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.attachment.AttachmentManager;
@@ -104,9 +105,6 @@ public class WikiEngine implements Engine {
     /** Stores properties. */
     private Properties m_properties;
 
-    /** Does the work in renaming pages. */
-    private PageRenamer m_pageRenamer = null;
-
     /** Should the user info be saved with the page data as well? */
     private boolean m_saveUserInfo = true;
 
@@ -116,66 +114,6 @@ public class WikiEngine implements Engine {
     /** Store the file path to the basic URL.  When we're not running as a servlet, it defaults to the user's current directory. */
     private String m_rootPath = System.getProperty( "user.dir" );
 
-    /** Stores references between wikipages. */
-    private ReferenceManager  m_referenceManager = null;
-
-    /** Stores the Plugin manager */
-    private PluginManager     m_pluginManager;
-
-    /** Stores the Variable manager */
-    private VariableManager   m_variableManager;
-
-    /** Stores the Attachment manager */
-    private AttachmentManager m_attachmentManager = null;
-
-    /** Stores the Page manager */
-    private PageManager       m_pageManager = null;
-
-    /** Stores the authorization manager */
-    private AuthorizationManager m_authorizationManager = null;
-
-    /** Stores the authentication manager.*/
-    private AuthenticationManager m_authenticationManager = null;
-
-    /** Stores the ACL manager. */
-    private AclManager       m_aclManager = null;
-
-    /** Resolves wiki actions, JSPs and special pages. */
-    private CommandResolver  m_commandResolver = null;
-
-    private TemplateManager  m_templateManager = null;
-
-    /** Does all our diffs for us. */
-    private DifferenceManager m_differenceManager;
-
-    /** Handlers page filters. */
-    private FilterManager    m_filterManager;
-
-    /** Stores the Search manager */
-    private SearchManager    m_searchManager = null;
-
-    /** Facade for managing users */
-    private UserManager      m_userManager = null;
-
-    /** Facade for managing users */
-    private GroupManager     m_groupManager = null;
-
-    private RenderingManager m_renderingManager;
-
-    private EditorManager    m_editorManager;
-
-    private InternationalizationManager m_internationalizationManager;
-
-    private ProgressManager  m_progressManager;
-
-    private TasksManager m_tasksManager;
-
-    /** Constructs URLs */
-    private URLConstructor   m_urlConstructor;
-
-    /** Generates RSS feed when requested. */
-    private RSSGenerator     m_rssGenerator;
-
     /** Store the ServletContext that we're in.  This may be null if WikiEngine is not running inside a servlet container (i.e. when testing). */
     private ServletContext   m_servletContext = null;
 
@@ -194,12 +132,8 @@ public class WikiEngine implements Engine {
     /** Each engine has their own application id. */
     private String           m_appid = "";
 
-    private boolean          m_isConfigured = false; // Flag.
-
-    /** Each engine has its own workflow manager. */
-    private WorkflowManager m_workflowMgr = null;
-
-    private AdminBeanManager m_adminBeanManager;
+    /** engine is up and running or not */
+    private boolean          m_isConfigured = false;
 
     /** Stores wikiengine attributes. */
     private Map< String, Object > m_attributes = new ConcurrentHashMap<>();
@@ -212,7 +146,6 @@ public class WikiEngine implements Engine {
      *  we throw a RuntimeException if things don't work.
      *
      *  @param config The ServletConfig object for this servlet.
-     *
      *  @return A WikiEngine instance.
      *  @throws InternalWikiException in case something fails. This is a RuntimeException, so be prepared for it.
      */
@@ -243,13 +176,8 @@ public class WikiEngine implements Engine {
      *  @return One fully functional, properly behaving WikiEngine.
      *  @throws InternalWikiException If the WikiEngine instantiation fails.
      */
-
-    // FIXME: Potential make-things-easier thingy here: no need to fetch the wikiengine anymore
-    //        Wiki.jsp.jspInit() [really old code]; it's probably even faster to fetch it
-    //        using this method every time than go to pageContext.getAttribute().
     public static synchronized WikiEngine getInstance( final ServletContext context, Properties props ) throws InternalWikiException {
         WikiEngine engine = ( WikiEngine )context.getAttribute( ATTR_WIKIENGINE );
-
         if( engine == null ) {
             final String appid = Integer.toString(context.hashCode()); //FIXME: Kludge, use real type.
             context.log(" Assigning new engine to "+appid);
@@ -355,8 +283,8 @@ public class WikiEngine implements Engine {
         m_workDir = TextUtil.getStringProperty( props, PROP_WORKDIR, null );
 
         if( m_workDir == null ) {
-            m_workDir = System.getProperty("java.io.tmpdir", ".");
-            m_workDir += File.separator+Release.APPNAME+"-"+m_appid;
+            m_workDir = System.getProperty( "java.io.tmpdir", "." );
+            m_workDir += File.separator + Release.APPNAME + "-" + m_appid;
         }
 
         try {
@@ -367,16 +295,16 @@ public class WikiEngine implements Engine {
             //  A bunch of sanity checks
             //
             if( !f.exists() ) {
-                throw new WikiException("Work directory does not exist: "+m_workDir);
+                throw new WikiException( "Work directory does not exist: " + m_workDir );
             }
             if( !f.canRead() ) {
-                throw new WikiException("No permission to read work directory: "+m_workDir);
+                throw new WikiException( "No permission to read work directory: " + m_workDir );
             }
             if( !f.canWrite() ) {
-                throw new WikiException("No permission to write to work directory: "+m_workDir);
+                throw new WikiException( "No permission to write to work directory: " + m_workDir );
             }
             if( !f.isDirectory() ) {
-                throw new WikiException("jspwiki.workDir does not point to a directory: "+m_workDir);
+                throw new WikiException( "jspwiki.workDir does not point to a directory: " + m_workDir );
             }
         } catch( final SecurityException e ) {
             log.fatal( "Unable to find or create the working directory: "+m_workDir, e );
@@ -394,101 +322,44 @@ public class WikiEngine implements Engine {
         //
         //  Initialize the important modules.  Any exception thrown by the managers means that we will not start up.
         //
-        // FIXME: This part of the code is getting unwieldy.  We must think of a better way to do the startup-sequence.
         try {
             final String aclClassName = m_properties.getProperty( PROP_ACL_MANAGER_IMPL, ClassUtil.getMappedClass( AclManager.class.getName() ).getName() );
-            final String urlConstructorClassnName = TextUtil.getStringProperty( props, PROP_URLCONSTRUCTOR, "DefaultURLConstructor" );
-            final Class< ? > urlclass = ClassUtil.findClass( "org.apache.wiki.url", urlConstructorClassnName );
-
-            m_commandResolver = ClassUtil.getMappedObject( CommandResolver.class.getName(), this, props );
-            managers.put( CommandResolver.class, m_commandResolver );
-
-            m_urlConstructor = ClassUtil.getMappedObject( urlclass.getName() );
-            m_urlConstructor.initialize( this, props );
-            managers.put( URLConstructor.class, m_urlConstructor );
-
-            m_pageManager           = ClassUtil.getMappedObject( PageManager.class.getName(), this, props );
-            managers.put( PageManager.class, m_pageManager );
-
-            m_pluginManager         = ClassUtil.getMappedObject( PluginManager.class.getName(), this, props );
-            managers.put( PluginManager.class, m_pluginManager );
-
-            m_differenceManager     = ClassUtil.getMappedObject( DifferenceManager.class.getName(), this, props );
-            managers.put( DifferenceManager.class, m_differenceManager );
-
-            m_attachmentManager     = ClassUtil.getMappedObject( AttachmentManager.class.getName(), this, props );
-            managers.put( AttachmentManager.class, m_attachmentManager );
-
-            m_variableManager       = ClassUtil.getMappedObject( VariableManager.class.getName(), props );
-            managers.put( VariableManager.class, m_variableManager );
-
-            m_searchManager         = ClassUtil.getMappedObject( SearchManager.class.getName(), this, props );
-            managers.put( SearchManager.class, m_searchManager );
-
-            m_authenticationManager = ClassUtil.getMappedObject( AuthenticationManager.class.getName() );
-            m_authenticationManager.initialize( this, props );
-            managers.put( AuthenticationManager.class, m_authenticationManager );
-
-            m_authorizationManager  = ClassUtil.getMappedObject( AuthorizationManager.class.getName() );
-            m_authorizationManager.initialize( this, props );
-            managers.put( AuthorizationManager.class, m_authorizationManager );
-
-            m_userManager           = ClassUtil.getMappedObject( UserManager.class.getName() );
-            m_userManager.initialize( this, props );
-            managers.put( UserManager.class, m_userManager );
-
-            m_groupManager          = ClassUtil.getMappedObject( GroupManager.class.getName() );
-            m_groupManager.initialize( this, props );
-            managers.put( GroupManager.class, m_groupManager );
-
-            m_editorManager         = ClassUtil.getMappedObject( EditorManager.class.getName(), this );
-            m_editorManager.initialize( this, props );
-            managers.put( EditorManager.class, m_editorManager );
-
-            m_progressManager       = ClassUtil.getMappedObject( ProgressManager.class.getName(), this );
-            managers.put( ProgressManager.class, m_progressManager );
-
-            m_aclManager = ClassUtil.getMappedObject( aclClassName );
-            m_aclManager.initialize( this, props );
-            managers.put( AclManager.class, m_aclManager );
-
-            // Start the Workflow manager
-            m_workflowMgr = ClassUtil.getMappedObject(WorkflowManager.class.getName());
-            m_workflowMgr.initialize(this, props);
-            managers.put( WorkflowManager.class, m_workflowMgr );
-
-            m_tasksManager = ClassUtil.getMappedObject(TasksManager.class.getName());
-            managers.put( TasksManager.class, m_tasksManager );
-
-            m_internationalizationManager = ClassUtil.getMappedObject(InternationalizationManager.class.getName(),this);
-            managers.put( InternationalizationManager.class, m_internationalizationManager );
-
-            m_templateManager = ClassUtil.getMappedObject(TemplateManager.class.getName(), this, props );
-            managers.put( TemplateManager.class, m_templateManager );
-
-            // Since we want to use a page filters initilize() method as a engine startup listener where we can initialize global event
-            // listeners, it must be called lastly, so that all object references in the engine are availabe to the initialize() method
-            m_filterManager = ClassUtil.getMappedObject(FilterManager.class.getName(), this, props );
-            managers.put( FilterManager.class, m_filterManager );
-
-            m_adminBeanManager = ClassUtil.getMappedObject(AdminBeanManager.class.getName(),this);
-            managers.put( AdminBeanManager.class, m_adminBeanManager );
-
-            m_pageRenamer = ClassUtil.getMappedObject( PageRenamer.class.getName(), this, props );
-            managers.put( PageRenamer.class, m_pageRenamer );
+            final String urlConstructorClassName = TextUtil.getStringProperty( props, PROP_URLCONSTRUCTOR, "DefaultURLConstructor" );
+            final Class< ? > urlclass = ClassUtil.findClass( "org.apache.wiki.url", urlConstructorClassName );
+
+            initComponent( CommandResolver.class, this, props );
+            initComponent( urlclass.getName(), URLConstructor.class, ( Object )null );
+            initComponent( PageManager.class, this, props );
+            initComponent( PluginManager.class, this, props );
+            initComponent( DifferenceManager.class, this, props );
+            initComponent( AttachmentManager.class, this, props );
+            initComponent( VariableManager.class, props );
+            initComponent( SearchManager.class, this, props );
+            initComponent( AuthenticationManager.class, ( Object )null );
+            initComponent( AuthorizationManager.class, ( Object )null );
+            initComponent( UserManager.class, ( Object )null );
+            initComponent( GroupManager.class, ( Object )null );
+            initComponent( EditorManager.class, this );
+            initComponent( ProgressManager.class, this );
+            initComponent( aclClassName, AclManager.class, ( Object )null );
+            initComponent( WorkflowManager.class, ( Object )null );
+            initComponent( TasksManager.class, ( Object )null );
+            initComponent( InternationalizationManager.class, this );
+            initComponent( TemplateManager.class, this, props );
+            initComponent( FilterManager.class, this, props );
+            initComponent( AdminBeanManager.class, this );
+            initComponent( PageRenamer.class, this, props );
 
             // RenderingManager depends on FilterManager events.
-            m_renderingManager = ClassUtil.getMappedObject( RenderingManager.class.getName() );
-            m_renderingManager.initialize( this, props );
-            managers.put( RenderingManager.class, m_renderingManager );
+            initComponent( RenderingManager.class );
 
             //  ReferenceManager has the side effect of loading all pages.  Therefore after this point, all page attributes are available.
             //  initReferenceManager is indirectly using m_filterManager, therefore it has to be called after it was initialized.
             initReferenceManager();
 
             //  Hook the different manager routines into the system.
-            m_filterManager.addPageFilter( getManager( ReferenceManager.class ), -1001 );
-            m_filterManager.addPageFilter( getManager( SearchManager.class ), -1002 );
+            getManager( FilterManager.class ).addPageFilter( getManager( ReferenceManager.class ), -1001 );
+            getManager( FilterManager.class ).addPageFilter( getManager( SearchManager.class ), -1002 );
         } catch( final RuntimeException e ) {
             // RuntimeExceptions may occur here, even if they shouldn't.
             log.fatal( "Failed to start managers.", e );
@@ -511,9 +382,7 @@ public class WikiEngine implements Engine {
         //  Initialize the good-to-have-but-not-fatal modules.
         try {
             if( TextUtil.getBooleanProperty( props, RSSGenerator.PROP_GENERATE_RSS,false ) ) {
-                m_rssGenerator = ClassUtil.getMappedObject( RSSGenerator.class.getName(), this, props );
-                m_rssGenerator.initialize( this, props );
-                managers.put( RSSGenerator.class, m_rssGenerator );
+                initComponent( RSSGenerator.class, this, props );
             }
         } catch( final Exception e ) {
             log.error( "Unable to start RSS generator - JSPWiki will still work, but there will be no RSS feed.", e );
@@ -521,10 +390,27 @@ public class WikiEngine implements Engine {
 
         fireEvent( WikiEngineEvent.INITIALIZED ); // initialization complete
 
-        log.info("WikiEngine configured.");
+        log.info( "WikiEngine configured." );
         m_isConfigured = true;
     }
 
+    < T > void initComponent( final Class< T > componentClass, final Object... initArgs ) throws Exception {
+        initComponent( componentClass.getName(), componentClass, initArgs );
+    }
+
+    < T > void initComponent( final String componentInitClass, final Class< T > componentClass, final Object... initArgs ) throws Exception {
+        final T component;
+        if( initArgs == null || initArgs.length == 0 ) {
+            component = ClassUtil.getMappedObject( componentInitClass );
+        } else {
+            component = ClassUtil.getMappedObject( componentInitClass, initArgs );
+        }
+        if( Initializable.class.isAssignableFrom( componentClass ) ) {
+            ( ( Initializable )component ).initialize( this, m_properties );
+        }
+        managers.put( componentClass, component );
+    }
+
     /** {@inheritDoc} */
     @Override
     @SuppressWarnings( "unchecked" )
@@ -537,9 +423,9 @@ public class WikiEngine implements Engine {
     @SuppressWarnings( "unchecked" )
     public < T > List< T > getManagers( final Class< T > manager ) {
         return ( List< T > )managers.entrySet().stream()
-                                    .filter( e -> manager.isAssignableFrom( e.getKey() ) )
-                                    .map( Map.Entry::getValue )
-                                    .collect( Collectors.toList() );
+                .filter( e -> manager.isAssignableFrom( e.getKey() ) )
+                .map( Map.Entry::getValue )
+                .collect( Collectors.toList() );
     }
 
     /** {@inheritDoc} */
@@ -589,16 +475,14 @@ public class WikiEngine implements Engine {
                 final ArrayList< Page > pages = new ArrayList<>();
                 pages.addAll( getManager( PageManager.class ).getAllPages() );
                 pages.addAll( getManager( AttachmentManager.class ).getAllAttachments() );
+                initComponent( ReferenceManager.class, this );
 
-                m_referenceManager = ClassUtil.getMappedObject( ReferenceManager.class.getName(), this );
-                managers.put( ReferenceManager.class, m_referenceManager );
-
-                m_referenceManager.initialize( pages );
+                getManager( ReferenceManager.class ).initialize( pages );
             }
 
         } catch( final ProviderException e ) {
             log.fatal("PageProvider is unable to list pages: ", e);
-        } catch( final ReflectiveOperationException | IllegalArgumentException e ) {
+        } catch( final Exception e ) {
             throw new WikiException( "Could not instantiate ReferenceManager: " + e.getMessage(), e );
         }
     }
@@ -712,7 +596,6 @@ public class WikiEngine implements Engine {
 
     /** {@inheritDoc} */
     @Override
-    // FIXME: Should use servlet context as a default instead of a constant.
     public String getApplicationName() {
         final String appName = TextUtil.getStringProperty( m_properties, PROP_APPNAME, Release.APPNAME );
         return TextUtil.cleanString( appName, TextUtil.PUNCTUATION_CHARS_ALLOWED );
@@ -1087,6 +970,7 @@ public class WikiEngine implements Engine {
 
     /**
      * Fires a WikiPageEvent to all registered listeners.
+     *
      * @param type  the event type
      */
     protected final void firePageEvent( final int type, final String pageName ) {


[jspwiki] 04/15: use Engine instead of WikiEngine

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit d8c40d9f6e456bc5830f292aaf9bdbe1d0cfd7d2
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 15:46:29 2020 +0100

    use Engine instead of WikiEngine
---
 jspwiki-war/src/main/webapp/admin/Admin.jsp | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/jspwiki-war/src/main/webapp/admin/Admin.jsp b/jspwiki-war/src/main/webapp/admin/Admin.jsp
index b6d3742..a8ddd17 100644
--- a/jspwiki-war/src/main/webapp/admin/Admin.jsp
+++ b/jspwiki-war/src/main/webapp/admin/Admin.jsp
@@ -19,6 +19,8 @@
 
 <%@ page import="org.apache.log4j.*" %>
 <%@ page import="org.apache.wiki.*" %>
+<%@ page import="org.apache.wiki.api.core.*" %>
+<%@ page import="org.apache.wiki.auth.*" %>
 <%@ page import="org.apache.wiki.ui.admin.*" %>
 <%@ page import="org.apache.wiki.ui.TemplateManager" %>
 <%@ page import="org.apache.wiki.util.TextUtil" %>
@@ -32,10 +34,10 @@
 %>
 <%
     String bean = request.getParameter("bean");
-    WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
+    Engine wiki = WikiEngine.getInstance( getServletConfig() );
     // Create wiki context and check for authorization
     WikiContext wikiContext = new WikiContext( wiki, request, WikiContext.ADMIN );
-    if(!wiki.getAuthorizationManager().hasAccess( wikiContext, response )) return;
+    if(!wiki.getManager( AuthorizationManager.class ).hasAccess( wikiContext, response ) ) return;
 
     //
     //  This is an experimental feature, so we will turn it off unless the user really wants to.
@@ -68,23 +70,17 @@
 
     // Set the content type and include the response content
     response.setContentType("text/html; charset="+wiki.getContentEncoding() );
-    String contentPage = wiki.getTemplateManager().findJSP( pageContext,
-                                                            wikiContext.getTemplate(),
-                                                            "admin/AdminTemplate.jsp" );
+    String contentPage = wiki.getManager( TemplateManager.class ).findJSP( pageContext, wikiContext.getTemplate(), "admin/AdminTemplate.jsp" );
 
     pageContext.setAttribute( "engine", wiki, PageContext.REQUEST_SCOPE );
     pageContext.setAttribute( "context", wikiContext, PageContext.REQUEST_SCOPE );
 
-    if( request.getMethod().equalsIgnoreCase("post") && bean != null )
-    {
-        AdminBean ab = wiki.getAdminBeanManager().findBean( bean );
+    if( request.getMethod().equalsIgnoreCase("post") && bean != null ) {
+        AdminBean ab = wiki.getManager( AdminBeanManager.class ).findBean( bean );
 
-        if( ab != null )
-        {
+        if( ab != null ) {
             ab.doPost( wikiContext );
-        }
-        else
-        {
+        } else {
             wikiContext.getWikiSession().addMessage( "No such bean "+bean+" was found!" );
         }
     }


[jspwiki] 05/15: mimic goals on apache-release profile to see if we can pinpoint weird maven-javadoc-plugin issue at builds.apache.org

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 6a257355be7e653a7b721623675ab6dc698c27fe
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Mar 24 15:48:12 2020 +0100

    mimic goals on apache-release profile to see if we can pinpoint weird maven-javadoc-plugin issue at builds.apache.org
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index b2effce..5b14f23 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
     <plugin.idea.version>2.2.1</plugin.idea.version>
     <plugin.install.version>2.5.2</plugin.install.version>
     <plugin.jar.version>3.2.0</plugin.jar.version>
-    <plugin.javadoc.version>3.1.1</plugin.javadoc.version>
+    <plugin.javadoc.version>3.2.0</plugin.javadoc.version>
     <plugin.jxr.version>3.0.0</plugin.jxr.version>
     <plugin.project-info-reports.version>3.0.0</plugin.project-info-reports.version>
     <plugin.release.version>3.0.0-M1</plugin.release.version>
@@ -867,7 +867,7 @@
                 <id>artifact-sources</id>
                 <phase>package</phase>
                 <goals>
-                  <goal>jar</goal>
+                  <goal>jar-no-fork</goal>
                 </goals>
               </execution>
             </executions>