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 6d7dbc36c0664b9763ed35076d6c2f3e6ee4b24b
Author: juanpablo <[email protected]>
AuthorDate: Wed Feb 26 13:16:07 2020 +0100

    JSPWIKI-120: use Engine instead of WikiEngine
---
 .../wiki/ajax/WikiAjaxDispatcherServlet.java       |   3 +-
 .../main/java/org/apache/wiki/api/core/Engine.java |  10 +-
 .../apache/wiki/attachment/AttachmentManager.java  |   2 +-
 .../apache/wiki/attachment/AttachmentServlet.java  | 177 ++++++++-------------
 .../apache/wiki/attachment/DynamicAttachment.java  |  49 +++---
 .../wiki/attachment/DynamicAttachmentProvider.java |  22 ++-
 .../org/apache/wiki/auth/SecurityVerifier.java     |  31 ++--
 .../java/org/apache/wiki/auth/SessionMonitor.java  |  35 ++--
 .../java/org/apache/wiki/auth/UserManager.java     |   2 +-
 .../java/org/apache/wiki/auth/acl/AclManager.java  |  35 ++--
 .../apache/wiki/auth/acl/DefaultAclManager.java    |  89 ++++-------
 .../login/CookieAuthenticationLoginModule.java     |  13 +-
 .../auth/login/WebContainerCallbackHandler.java    |   2 +-
 .../wiki/auth/login/WikiCallbackHandler.java       |   2 +-
 .../apache/wiki/diff/DefaultDifferenceManager.java |  18 ++-
 .../org/apache/wiki/event/WikiEngineEvent.java     |  19 ++-
 .../org/apache/wiki/event/WikiEventManager.java    |  18 +--
 .../wiki/i18n/InternationalizationManager.java     |  44 ++---
 .../java/org/apache/wiki/pages/PageManager.java    |   2 +-
 .../java/org/apache/wiki/pages/PageSorter.java     |  12 +-
 .../org/apache/wiki/plugin/WeblogEntryPlugin.java  |   2 +-
 .../java/org/apache/wiki/plugin/WeblogPlugin.java  |   2 +-
 22 files changed, 245 insertions(+), 344 deletions(-)

diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxDispatcherServlet.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxDispatcherServlet.java
index 41d11ba..d931181 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxDispatcherServlet.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/ajax/WikiAjaxDispatcherServlet.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.permissions.PagePermission;
 import org.apache.wiki.util.TextUtil;
@@ -53,7 +54,7 @@ public class WikiAjaxDispatcherServlet extends HttpServlet {
     private static final Map< String, AjaxServletContainer > ajaxServlets = 
new ConcurrentHashMap<>();
     private static final Logger log = Logger.getLogger( 
WikiAjaxDispatcherServlet.class.getName() );
     private String PATH_AJAX = "/ajax/";
-    private WikiEngine m_engine;
+    private Engine m_engine;
 
     /**
      * {@inheritDoc}
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/api/core/Engine.java 
b/jspwiki-main/src/main/java/org/apache/wiki/api/core/Engine.java
index d51cb0d..345f9e1 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/api/core/Engine.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/api/core/Engine.java
@@ -44,7 +44,7 @@ import java.util.Properties;
  *  This is the main interface through which everything should go.
  *
  *  <p>
- *  There's basically only a single Engine for each web application, and you 
should always get it using the {@code WikiEngine.getInstance(..)}
+ *  There's basically only a single Engine for each web application, and you 
should always get it using the {@code Engine.getInstance(..)}
  *  method.
  */
 public interface Engine {
@@ -121,14 +121,14 @@ public interface Engine {
     < T > T getManager( Class< T > manager );
 
     /**
-     * check if the WikiEngine has been configured.
+     * check if the Engine has been configured.
      *
      * @return {@code true} if it has, {@code false} otherwise.
      */
     boolean isConfigured();
 
     /**
-     *  Returns the set of properties that the WikiEngine was initialized 
with.  Note that this method returns a direct reference, so it's
+     *  Returns the set of properties that the Engine was initialized with.  
Note that this method returns a direct reference, so it's
      *  possible to manipulate the properties.  However, this is not advised 
unless you really know what you're doing.
      *
      *  @return The wiki properties
@@ -201,7 +201,7 @@ public interface Engine {
     String getFrontPage();
 
     /**
-     *  Returns the ServletContext that this particular WikiEngine was 
initialized with. <strong>It may return {@code null}</strong>,
+     *  Returns the ServletContext that this particular Engine was initialized 
with. <strong>It may return {@code null}</strong>,
      *  if the Engine is not running inside a servlet container!
      *
      *  @since 1.7.10
@@ -305,7 +305,7 @@ public interface Engine {
     String getApplicationName();
 
     /**
-     *  Returns the root path.  The root path is where the WikiEngine is 
located in the file system.
+     *  Returns the root path.  The root path is where the Engine is located 
in the file system.
      *
      *  @since 2.2
      *  @return A path to where the Wiki is installed in the local filesystem.
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
index 07dd4a5..31fb09a 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
@@ -39,7 +39,7 @@ import java.util.List;
  *  Provides facilities for handling attachments.  All attachment handling 
goes through this class.
  *  <p>
  *  The AttachmentManager provides a facade towards the current 
WikiAttachmentProvider that is in use.
- *  It is created by the WikiEngine as a singleton object, and can be 
requested through the WikiEngine.
+ *  It is created by the Engine as a singleton object, and can be requested 
through the Engine.
  *
  *  @since 1.9.28
  */
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 9abea2d..366666b 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
@@ -30,6 +30,7 @@ import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiProvider;
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.RedirectException;
 import org.apache.wiki.api.exceptions.WikiException;
@@ -38,6 +39,7 @@ import org.apache.wiki.auth.permissions.PermissionFactory;
 import org.apache.wiki.i18n.InternationalizationManager;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.ui.progress.ProgressItem;
+import org.apache.wiki.ui.progress.ProgressManager;
 import org.apache.wiki.util.HttpUtil;
 import org.apache.wiki.util.TextUtil;
 
@@ -77,7 +79,7 @@ public class AttachmentServlet extends HttpServlet {
 
     private static final long serialVersionUID = 3257282552187531320L;
 
-    private WikiEngine m_engine;
+    private Engine m_engine;
     private static final Logger log = Logger.getLogger( 
AttachmentServlet.class );
 
     private static final String HDR_VERSION     = "version";
@@ -107,50 +109,36 @@ public class AttachmentServlet extends HttpServlet {
 
     /**
      *  Initializes the servlet from WikiEngine properties.
-     *
      */
-    @Override public void init( final ServletConfig config ) throws 
ServletException {
-        final String tmpDir;
-
-        m_engine         = WikiEngine.getInstance( config );
+    @Override
+    public void init( final ServletConfig config ) throws ServletException {
+        m_engine = WikiEngine.getInstance( config );
         final Properties props = m_engine.getWikiProperties();
+        final String tmpDir = m_engine.getWorkDir() + File.separator + 
"attach-tmp";
+        final String allowed = TextUtil.getStringProperty( props, 
AttachmentManager.PROP_ALLOWEDEXTENSIONS, null );
+        m_maxSize = TextUtil.getIntegerProperty( props, 
AttachmentManager.PROP_MAXSIZE, Integer.MAX_VALUE );
 
-        tmpDir         = m_engine.getWorkDir()+File.separator+"attach-tmp";
-
-        m_maxSize        = TextUtil.getIntegerProperty( props,
-                AttachmentManager.PROP_MAXSIZE,
-                Integer.MAX_VALUE );
-
-        final String allowed = TextUtil.getStringProperty( props,
-                AttachmentManager.PROP_ALLOWEDEXTENSIONS,
-                null );
-
-        if( allowed != null && allowed.length() > 0 )
-            m_allowedPatterns = allowed.toLowerCase().split("\\s");
-        else
-            m_allowedPatterns = new String[0];
-
-        final String forbidden = TextUtil.getStringProperty( props,
-                AttachmentManager.PROP_FORBIDDENEXTENSIONS,
-                null );
+        if( allowed != null && allowed.length() > 0 ) {
+            m_allowedPatterns = allowed.toLowerCase().split( "\\s" );
+        } else {
+            m_allowedPatterns = new String[ 0 ];
+        }
 
-        if( forbidden != null && forbidden.length() > 0 )
+        final String forbidden = TextUtil.getStringProperty( props, 
AttachmentManager.PROP_FORBIDDENEXTENSIONS,null );
+        if( forbidden != null && forbidden.length() > 0 ) {
             m_forbiddenPatterns = forbidden.toLowerCase().split("\\s");
-        else
+        } else {
             m_forbiddenPatterns = new String[0];
+        }
 
         final File f = new File( tmpDir );
-        if( !f.exists() )
-        {
+        if( !f.exists() ) {
             f.mkdirs();
-        }
-        else if( !f.isDirectory() )
-        {
-            log.fatal("A file already exists where the temporary dir is 
supposed to be: "+tmpDir+".  Please remove it.");
+        } else if( !f.isDirectory() ) {
+            log.fatal( "A file already exists where the temporary dir is 
supposed to be: " + tmpDir + ".  Please remove it." );
         }
 
-        log.debug( "UploadServlet initialized. Using " +
-                tmpDir + " for temporary storage." );
+        log.debug( "UploadServlet initialized. Using " + tmpDir + " for 
temporary storage." );
     }
 
     private boolean isTypeAllowed( String name )
@@ -181,8 +169,8 @@ public class AttachmentServlet extends HttpServlet {
      *  @param res The servlet response
      */
 
-    @Override protected void doOptions( final HttpServletRequest req, final 
HttpServletResponse res )
-    {
+    @Override
+    protected void doOptions( final HttpServletRequest req, final 
HttpServletResponse res ) {
         res.setHeader( "Allow", "GET, PUT, POST, OPTIONS, PROPFIND, PROPPATCH, 
MOVE, COPY, DELETE");
         res.setStatus( HttpServletResponse.SC_OK );
     }
@@ -193,11 +181,11 @@ public class AttachmentServlet extends HttpServlet {
      *
      */
     // FIXME: Messages would need to be localized somehow.
-    @Override public void doGet( final HttpServletRequest  req, final 
HttpServletResponse res ) throws IOException {
+    @Override
+    public void doGet( final HttpServletRequest  req, final 
HttpServletResponse res ) throws IOException {
         final WikiContext context = new WikiContext( m_engine, req, 
WikiContext.ATTACH );
         final AttachmentManager mgr = m_engine.getManager( 
AttachmentManager.class );
-        final AuthorizationManager authmgr = 
m_engine.getAuthorizationManager();
-
+        final AuthorizationManager authmgr = m_engine.getManager( 
AuthorizationManager.class );
         final String version = req.getParameter( HDR_VERSION );
         final String nextPage = req.getParameter( "nextpage" );
         final String page = context.getPage().getName();
@@ -209,8 +197,7 @@ public class AttachmentServlet extends HttpServlet {
             return;
         }
 
-        final OutputStream out = res.getOutputStream();
-        try {
+        try( final OutputStream out = res.getOutputStream() ) {
             log.debug("Attempting to download att "+page+", version "+version);
             if( version != null ) {
                 ver = Integer.parseInt( version );
@@ -309,18 +296,6 @@ public class AttachmentServlet extends HttpServlet {
             //
             log.debug( "I/O exception during download", ioe );
             sendError( res, "Error: " + ioe.getMessage() );
-        } finally {
-            //
-            //  Quite often, aggressive clients close the connection when they 
have received the last bits.
-            //  Therefore, we close the output, but ignore any exception that 
might come out of it.
-            //
-            try {
-                if( out != null ) {
-                    out.close();
-                }
-            } catch( final IOException ioe ) {
-                // ignore
-            }
         }
     }
 
@@ -339,23 +314,19 @@ public class AttachmentServlet extends HttpServlet {
      * @param fileName The name to check for.
      * @return A valid mime type, or application/binary, if not recognized
      */
-    private static String getMimeType( final WikiContext ctx, final String 
fileName )
-    {
+    private static String getMimeType( final WikiContext ctx, final String 
fileName ) {
         String mimetype = null;
 
         final HttpServletRequest req = ctx.getHttpRequest();
-        if( req != null )
-        {
+        if( req != null ) {
             final ServletContext s = req.getSession().getServletContext();
 
-            if( s != null )
-            {
+            if( s != null ) {
                 mimetype = s.getMimeType( fileName.toLowerCase() );
             }
         }
 
-        if( mimetype == null )
-        {
+        if( mimetype == null ) {
             mimetype = "application/binary";
         }
 
@@ -373,7 +344,8 @@ public class AttachmentServlet extends HttpServlet {
      * content of the file.
      *
      */
-    @Override public void doPost( final HttpServletRequest req, final 
HttpServletResponse res ) throws IOException {
+    @Override
+    public void doPost( final HttpServletRequest req, final 
HttpServletResponse res ) throws IOException {
         try {
             final String nextPage = upload( req );
             req.getSession().removeAttribute("msg");
@@ -391,15 +363,10 @@ public class AttachmentServlet extends HttpServlet {
      *  Validates the next page to be on the same server as this webapp.
      *  Fixes [JSPWIKI-46].
      */
-    private String validateNextPage( String nextPage, final String errorPage )
-    {
-        if( nextPage.indexOf("://") != -1 )
-        {
-            // It's an absolute link, so unless it starts with our address, 
we'll
-            // log an error.
-
-            if( !nextPage.startsWith( m_engine.getBaseURL() ) )
-            {
+    private String validateNextPage( String nextPage, final String errorPage ) 
{
+        if( nextPage.contains( "://" ) ) {
+            // It's an absolute link, so unless it starts with our address, 
we'll log an error.
+            if( !nextPage.startsWith( m_engine.getBaseURL() ) ) {
                 log.warn("Detected phishing attempt by redirecting to an 
unsecure location: "+nextPage);
                 nextPage = errorPage;
             }
@@ -415,10 +382,9 @@ public class AttachmentServlet extends HttpServlet {
      *  @return The page to which we should go next.
      *  @throws RedirectException If there's an error and a redirection is 
needed
      *  @throws IOException If upload fails
-     * @throws FileUploadException
      */
     protected String upload( final HttpServletRequest req ) throws 
RedirectException, IOException {
-        String msg     = "";
+        final String msg;
         final String attName = "(unknown)";
         final String errorPage = m_engine.getURL( WikiContext.ERROR, "", null 
); // If something bad happened, Upload should be able to take care of most 
stuff
         String nextPage = errorPage;
@@ -436,7 +402,7 @@ public class AttachmentServlet extends HttpServlet {
             final WikiContext context = new WikiContext( m_engine, req, 
WikiContext.ATTACH );
             final UploadListener pl = new UploadListener();
 
-            m_engine.getProgressManager().startProgress( pl, progressId );
+            m_engine.getManager( ProgressManager.class ).startProgress( pl, 
progressId );
 
             final ServletFileUpload upload = new ServletFileUpload( factory );
             upload.setHeaderEncoding( "UTF-8" );
@@ -453,22 +419,24 @@ public class AttachmentServlet extends HttpServlet {
 
             for( final FileItem item : items ) {
                 if( item.isFormField() ) {
-                    if( item.getFieldName().equals("page") ) {
-                        //
+                    switch( item.getFieldName() ) {
+                    case "page":
                         // FIXME: Kludge alert.  We must end up with the 
parent page name, if this is an upload of a new revision
-                        //
-
-                        wikipage = item.getString("UTF-8");
-                        final int x = wikipage.indexOf("/");
-
-                        if( x != -1 ) wikipage = wikipage.substring(0,x);
-                    } else if( item.getFieldName().equals("changenote") ) {
-                        changeNote = item.getString("UTF-8");
-                        if (changeNote != null) {
-                            changeNote = TextUtil.replaceEntities(changeNote);
+                        wikipage = item.getString( "UTF-8" );
+                        final int x = wikipage.indexOf( "/" );
+                        if( x != -1 ) {
+                            wikipage = wikipage.substring( 0, x );
                         }
-                    } else if( item.getFieldName().equals( "nextpage" ) ) {
-                        nextPage = validateNextPage( item.getString("UTF-8"), 
errorPage );
+                        break;
+                    case "changenote":
+                        changeNote = item.getString( "UTF-8" );
+                        if( changeNote != null ) {
+                            changeNote = TextUtil.replaceEntities( changeNote 
);
+                        }
+                        break;
+                    case "nextpage":
+                        nextPage = validateNextPage( item.getString( "UTF-8" 
), errorPage );
+                        break;
                     }
                 } else {
                     fileItems.add( item );
@@ -506,7 +474,7 @@ public class AttachmentServlet extends HttpServlet {
 
             throw new IOException( msg, e );
         } finally {
-            m_engine.getProgressManager().stopProgress( progressId );
+            m_engine.getManager( ProgressManager.class ).stopProgress( 
progressId );
             // FIXME: In case of exceptions should absolutely remove the 
uploaded file.
         }
 
@@ -532,9 +500,7 @@ public class AttachmentServlet extends HttpServlet {
                                      String filename, final String errorPage,
                                      final String parentPage, final String 
changenote,
                                      final long contentLength )
-            throws RedirectException,
-            IOException, ProviderException
-    {
+            throws RedirectException, IOException, ProviderException {
         boolean created = false;
 
         try {
@@ -573,31 +539,20 @@ public class AttachmentServlet extends HttpServlet {
             throw new RedirectException("File could not be opened.", 
errorPage);
         }
 
-        //
-        //  Check whether we already have this kind of a page.
-        //  If the "page" parameter already defines an attachment
-        //  name for an update, then we just use that file.
-        //  Otherwise we create a new attachment, and use the
-        //  filename given.  Incidentally, this will also mean
-        //  that if the user uploads a file with the exact
-        //  same name than some other previous attachment,
-        //  then that attachment gains a new version.
-        //
-
+        //  Check whether we already have this kind of a page. If the "page" 
parameter already defines an attachment
+        //  name for an update, then we just use that file. Otherwise we 
create a new attachment, and use the
+        //  filename given.  Incidentally, this will also mean that if the 
user uploads a file with the exact
+        //  same name than some other previous attachment, then that 
attachment gains a new version.
         Attachment att = mgr.getAttachmentInfo( context.getPage().getName() );
-
         if( att == null ) {
             att = new Attachment( m_engine, parentPage, filename );
             created = true;
         }
         att.setSize( contentLength );
 
-        //
         //  Check if we're allowed to do this?
-        //
-
         final Permission permission = PermissionFactory.getPagePermission( 
att, "upload" );
-        if( m_engine.getAuthorizationManager().checkPermission( 
context.getWikiSession(), permission ) ) {
+        if( m_engine.getManager( AuthorizationManager.class ).checkPermission( 
context.getWikiSession(), permission ) ) {
             if( user != null ) {
                 att.setAuthor( user.getName() );
             }
@@ -630,12 +585,14 @@ public class AttachmentServlet extends HttpServlet {
         public long m_currentBytes;
         public long m_totalBytes;
 
-        @Override public void update( final long recvdBytes, final long 
totalBytes, final int item) {
+        @Override
+        public void update( final long recvdBytes, final long totalBytes, 
final int item) {
             m_currentBytes = recvdBytes;
             m_totalBytes   = totalBytes;
         }
 
-        @Override public int getProgress() {
+        @Override
+        public int getProgress() {
             return ( int )( ( ( float )m_currentBytes / m_totalBytes ) * 100 + 
0.5 );
         }
     }
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachment.java 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachment.java
index 7936643..796d96f 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachment.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachment.java
@@ -18,31 +18,27 @@
  */
 package org.apache.wiki.attachment;
 
-import org.apache.wiki.WikiEngine;
+import org.apache.wiki.api.core.Engine;
+
 
 /**
- *  A DynamicAttachment is an attachment which does not really exist, but is
- *  created dynamically by a JSPWiki component.
+ *  A DynamicAttachment is an attachment which does not really exist, but is 
created dynamically by a JSPWiki component.
  *  <p>
- *  Note that a DynamicAttachment might not be available before it is actually
- *  created by a component (e.g. plugin), and therefore trying to access it
- *  before that component has been invoked, might result in a surprising 404.
+ *  Note that a DynamicAttachment might not be available before it is actually 
created by a component (e.g. plugin), and therefore trying
+ *  to access it before that component has been invoked, might result in a 
surprising 404.
  *  <p>
- *  DynamicAttachments are not listed among regular attachments in the current
- *  version.
+ *  DynamicAttachments are not listed among regular attachments in the current 
version.
  *  <p>
  *  Usage:
  *
  *  <pre>
  *
- *  class MyDynamicComponent implements DynamicAttachmentProvider
- *  {
+ *  class MyDynamicComponent implements DynamicAttachmentProvider {
  *  ...
  *
  *     DynamicAttachment destatt = mgr.getDynamicAttachment( destattname );
  *
- *     if( destatt == null )
- *     {
+ *     if( destatt == null ) {
  *         destatt = new DynamicAttachment( context.getEngine(),
  *                                          context.getPage().getName(),
  *                                          destfilename,
@@ -50,28 +46,24 @@ import org.apache.wiki.WikiEngine;
  *         destatt.setCacheable( false );
  *     }
  *
- *     // This is used to check whether the attachment is modified or not
- *     // so don't forget to update this if your attachment source changes!
+ *     // This is used to check whether the attachment is modified or not so 
don't forget to update this if your attachment source changes!
  *     // Else JSPWiki will be serving 304s to anyone who asks...
  *
  *     destatt.setLastModified( context.getPage().getLastModified() );
  *     mgr.storeDynamicAttachment( context,  destatt );
  *  ...
  *
- *      public InputStream getAttachmentData( WikiContext context, Attachment 
att )
- *          throws IOException
- *      {
+ *      public InputStream getAttachmentData( WikiContext context, Attachment 
att ) throws IOException {
  *          byte[] bytes = "This is a test".getBytes();
- *
  *          return new ByteArrayInputStream( bytes );
  *      }
  *  </pre>
  *
  *  @since 2.5.34
  */
-public class DynamicAttachment extends Attachment
-{
-    private DynamicAttachmentProvider m_provider  = null;
+public class DynamicAttachment extends Attachment {
+
+    private final DynamicAttachmentProvider m_provider;
 
     /**
      *  Creates a DynamicAttachment.
@@ -81,12 +73,11 @@ public class DynamicAttachment extends Attachment
      *  @param fileName The filename of the attachment
      *  @param provider The provider which will be used to generate the 
attachment.
      */
-    public DynamicAttachment(WikiEngine engine,
-                             String parentPage,
-                             String fileName,
-                             DynamicAttachmentProvider provider)
-    {
-        super(engine, parentPage, fileName);
+    public DynamicAttachment( final Engine engine,
+                              final String parentPage,
+                              final String fileName,
+                              final DynamicAttachmentProvider provider ) {
+        super( engine, parentPage, fileName );
         m_provider = provider;
     }
 
@@ -95,8 +86,8 @@ public class DynamicAttachment extends Attachment
      *
      *  @return A Provider component for this attachment.
      */
-    public DynamicAttachmentProvider getProvider()
-    {
+    public DynamicAttachmentProvider getProvider() {
         return m_provider;
     }
+
 }
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachmentProvider.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachmentProvider.java
index c6d9ba9..a005cad 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachmentProvider.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/attachment/DynamicAttachmentProvider.java
@@ -18,27 +18,25 @@
  */
 package org.apache.wiki.attachment;
 
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.exceptions.ProviderException;
+
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.wiki.WikiContext;
-import org.apache.wiki.api.exceptions.ProviderException;
 
 /**
- *  Provides the data for an attachment.  Please note that there will
- *  be a strong reference retained for the provider for each Attachment
- *  it provides, so do try to keep the object light.  Also, reuse objects
- *  if possible.
+ *  Provides the data for an attachment.  Please note that there will be a 
strong reference retained for the provider for each Attachment
+ *  it provides, so do try to keep the object light.  Also, reuse objects if 
possible.
  *  <p>
  *  The Provider needs to be thread-safe.
  *
  *  @since  2.5.34
  */
-public interface DynamicAttachmentProvider
-{
+public interface DynamicAttachmentProvider {
+
     /**
-     *  Returns a stream of data for this attachment.  The stream will be
-     *  closed by AttachmentServlet.
+     *  Returns a stream of data for this attachment.  The stream will be 
closed by AttachmentServlet.
      *
      *  @param context A Wiki Context
      *  @param att The Attachment for which the data should be received.
@@ -46,6 +44,6 @@ public interface DynamicAttachmentProvider
      *  @throws ProviderException If something goes wrong internally
      *  @throws IOException If something goes wrong when reading the data
      */
-    InputStream getAttachmentData( WikiContext context, Attachment att )
-        throws ProviderException, IOException;
+    InputStream getAttachmentData( WikiContext context, Attachment att ) 
throws ProviderException, IOException;
+
 }
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/SecurityVerifier.java 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
index fbe727d..dfc4a20 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
@@ -55,8 +55,8 @@ import java.util.List;
 import java.util.Set;
 
 /**
- * Helper class for verifying JSPWiki's security configuration. Invoked by
- * <code>admin/SecurityConfig.jsp</code>.
+ * Helper class for verifying JSPWiki's security configuration. Invoked by 
<code>admin/SecurityConfig.jsp</code>.
+ *
  * @since 2.4
  */
 public final class SecurityVerifier {
@@ -120,13 +120,23 @@ public final class SecurityVerifier {
     /** Message topic for JAAS information messages. */
     public static final String    INFO_JAAS                    = "Info.Jaas";
 
-    private static final String[] CONTAINER_ACTIONS            = new String[]
-                                                               { "View pages", 
"Comment on existing pages",
-            "Edit pages", "Upload attachments", "Create a new group", "Rename 
an existing page", "Delete pages" };
-
-    private static final String[] CONTAINER_JSPS               = new String[]
-                                                               { "/Wiki.jsp", 
"/Comment.jsp", "/Edit.jsp",
-            "/Upload.jsp", "/NewGroup.jsp", "/Rename.jsp", "/Delete.jsp" };
+    private static final String[] CONTAINER_ACTIONS            = new String[] 
{ "View pages",
+                                                                               
 "Comment on existing pages",
+                                                                               
 "Edit pages",
+                                                                               
 "Upload attachments",
+                                                                               
 "Create a new group",
+                                                                               
 "Rename an existing page",
+                                                                               
 "Delete pages"
+                                                                              
};
+
+    private static final String[] CONTAINER_JSPS               = new String[] 
{ "/Wiki.jsp",
+                                                                               
 "/Comment.jsp",
+                                                                               
 "/Edit.jsp",
+                                                                               
 "/Upload.jsp",
+                                                                               
 "/NewGroup.jsp",
+                                                                               
 "/Rename.jsp",
+                                                                               
 "/Delete.jsp"
+                                                                              
};
 
     private static final String   BG_GREEN                     = 
"bgcolor=\"#c0ffc0\"";
 
@@ -135,7 +145,8 @@ public final class SecurityVerifier {
     private static final Logger LOG                          = 
Logger.getLogger( SecurityVerifier.class.getName() );
 
     /**
-     * Constructs a new SecurityVerifier for a supplied WikiEngine and 
WikiSession.
+     * Constructs a new SecurityVerifier for a supplied Engine and WikiSession.
+     *
      * @param engine the wiki engine
      * @param session the wiki session (typically, that of an administrator)
      */
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/SessionMonitor.java 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/SessionMonitor.java
index 4972c90..be81313 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/SessionMonitor.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/SessionMonitor.java
@@ -32,13 +32,12 @@ import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
- *  <p>Manages WikiSession's for different WikiEngine's.</p>
+ *  <p>Manages WikiSession's for different Engine's.</p>
  *  <p>The WikiSession's are stored both in the remote user HttpSession and in 
the SessionMonitor for the WikeEngine.
  *  This class must be configured as a session listener in the web.xml for the 
wiki web application.
  *  </p>
@@ -47,7 +46,7 @@ public class SessionMonitor implements HttpSessionListener {
 
     private static final Logger log = Logger.getLogger( SessionMonitor.class );
 
-    /** Map with WikiEngines as keys, and SessionMonitors as values. */
+    /** Map with Engines as keys, and SessionMonitors as values. */
     private static ConcurrentHashMap< Engine, SessionMonitor > c_monitors = 
new ConcurrentHashMap<>();
 
     /** Weak hashmap with HttpSessions as keys, and WikiSessions as values. */
@@ -58,12 +57,12 @@ public class SessionMonitor implements HttpSessionListener {
     private final PrincipalComparator m_comparator = new PrincipalComparator();
 
     /**
-     * Returns the instance of the SessionMonitor for this wiki.
-     * Only one SessionMonitor exists per WikiEngine.
+     * Returns the instance of the SessionMonitor for this wiki. Only one 
SessionMonitor exists per Engine.
+     *
      * @param engine the wiki engine
      * @return the session monitor
      */
-    public static final SessionMonitor getInstance( final Engine engine ) {
+    public static SessionMonitor getInstance( final Engine engine ) {
         if( engine == null )
         {
             throw new IllegalArgumentException( "Engine cannot be null." );
@@ -253,26 +252,16 @@ public class SessionMonitor implements 
HttpSessionListener {
      * @param se the HTTP session event
      */
     @Override
-    public void sessionDestroyed( final HttpSessionEvent se )
-    {
+    public void sessionDestroyed( final HttpSessionEvent se ) {
         final HttpSession session = se.getSession();
-        final Iterator<SessionMonitor> it = c_monitors.values().iterator();
-        while( it.hasNext() )
-        {
-            final SessionMonitor monitor = it.next();
-
-            final WikiSession storedSession = monitor.findSession(session);
-
-            monitor.remove(session);
-
+        for( final SessionMonitor monitor : c_monitors.values() ) {
+            final WikiSession storedSession = monitor.findSession( session );
+            monitor.remove( session );
             log.debug( "Removed session " + session.getId() + "." );
-
-            if( storedSession != null )
-            {
-                fireEvent( WikiSecurityEvent.SESSION_EXPIRED,
-                           storedSession.getLoginPrincipal(),
-                           storedSession );
+            if( storedSession != null ) {
+                fireEvent( WikiSecurityEvent.SESSION_EXPIRED, 
storedSession.getLoginPrincipal(), storedSession );
             }
         }
     }
+
 }
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 c59130b..f68dda1 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
@@ -54,7 +54,7 @@ public interface UserManager {
     void initialize( final Engine engine, final Properties props );
 
     /**
-     * Returns the UserDatabase employed by this WikiEngine. The UserDatabase 
is lazily initialized by this method, if it does
+     * 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 646d320..17ae713 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,33 +18,33 @@
  */
 package org.apache.wiki.auth.acl;
 
-import java.util.Properties;
-
-import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Engine;
 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
-{
+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( WikiEngine engine, Properties props );
+    void initialize( Engine engine, Properties props );
 
     /**
-     * A helper method for parsing textual AccessControlLists. The line is in
-     * form "(ALLOW) <permission><principal>, <principal>, <principal>". This
-     * method was moved from Authorizer.
-     * @param page The current wiki page. If the page already has an ACL, it
-     *            will be used as a basis for this ACL in order to avoid the
-     *            creation of a new one.
+     * A helper method for parsing textual AccessControlLists. The line is in 
form
+     * "(ALLOW) <permission><principal>, <principal>, <principal>". This 
method was moved from Authorizer.
+     *
+     * @param page The current wiki page. If the page already has an ACL, it 
will be used as a basis for this ACL in order to avoid the
+     *             creation of a new one.
      * @param ruleLine The rule line, as described above.
      * @return A valid Access Control List. May be empty.
      * @throws WikiSecurityException if the ruleLine was faulty somehow.
@@ -53,11 +53,10 @@ public interface AclManager
     Acl parseAcl( WikiPage 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 parent page, then that is tried also.
-     * This method was moved from Authorizer;
-     * it was consolidated with some code from AuthorizationManager.
+     * 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
+     * parent page, then that is tried also. This method was moved from 
Authorizer; it was consolidated with some code from
+     * AuthorizationManager.
+     *
      * @param page the wiki page
      * @since 2.2.121
      * @return the Acl representing permissions for the page
@@ -66,10 +65,12 @@ public interface AclManager
 
     /**
      * Sets the access control list for the page and persists it.
+     *
      * @param page the wiki page
      * @param acl the access control list
      * @since 2.5
      * @throws WikiSecurityException if the ACL cannot be set or persisted
      */
     void setPermissions( WikiPage 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 29b593f..f847444 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,8 +20,8 @@ package org.apache.wiki.auth.acl;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.auth.AuthorizationManager;
@@ -31,6 +31,7 @@ import org.apache.wiki.auth.permissions.PagePermission;
 import org.apache.wiki.auth.permissions.PermissionFactory;
 import org.apache.wiki.pages.PageLock;
 import org.apache.wiki.pages.PageManager;
+import org.apache.wiki.render.RenderingManager;
 
 import java.security.Permission;
 import java.security.Principal;
@@ -55,15 +56,16 @@ public class DefaultAclManager implements AclManager {
     private static final Logger log = 
Logger.getLogger(DefaultAclManager.class);
 
     private AuthorizationManager m_auth = null;
-    private WikiEngine m_engine = null;
-    private static final String PERM_REGEX = "(" +
-            PagePermission.COMMENT_ACTION + "|" +
-            PagePermission.DELETE_ACTION + "|" +
-            PagePermission.EDIT_ACTION + "|" +
-            PagePermission.MODIFY_ACTION + "|" +
-            PagePermission.RENAME_ACTION + "|" +
-            PagePermission.UPLOAD_ACTION + "|" +
-            PagePermission.VIEW_ACTION + ")";
+    private Engine m_engine = null;
+    private static final String PERM_REGEX = "("
+                                              + PagePermission.COMMENT_ACTION 
+ "|"
+                                              + PagePermission.DELETE_ACTION  
+ "|"
+                                              + PagePermission.EDIT_ACTION    
+ "|"
+                                              + PagePermission.MODIFY_ACTION  
+ "|"
+                                              + PagePermission.RENAME_ACTION  
+ "|"
+                                              + PagePermission.UPLOAD_ACTION  
+ "|"
+                                              + PagePermission.VIEW_ACTION    +
+                                             ")";
     private static final String ACL_REGEX = "\\[\\{\\s*ALLOW\\s+" + PERM_REGEX 
+ "\\s*(.*?)\\s*\\}\\]";
 
     /**
@@ -73,30 +75,16 @@ public class DefaultAclManager implements AclManager {
      */
     public static final Pattern ACL_PATTERN = Pattern.compile( ACL_REGEX );
 
-    /**
-     * Initializes the AclManager with a supplied wiki engine and properties.
-     *
-     * @param engine the wiki engine
-     * @param props  the initialization properties
-     * @see 
org.apache.wiki.auth.acl.AclManager#initialize(org.apache.wiki.WikiEngine, 
java.util.Properties)
-     */
-    @Override public void initialize( final WikiEngine engine, final 
Properties props ) {
-        m_auth = engine.getAuthorizationManager();
+    /** {@inheritDoc} */
+    @Override
+    public void initialize( final Engine engine, final Properties props ) {
+        m_auth = engine.getManager( AuthorizationManager.class );
         m_engine = engine;
     }
 
-    /**
-     * A helper method for parsing textual AccessControlLists. The line is in 
form
-     * {@code ALLOW <permission> <principal>, <principal>, <principal>}. This 
method was moved from Authorizer.
-     *
-     * @param page The current wiki page. If the page already has an ACL, it 
will be used as a basis for this ACL in order to avoid the
-     *             creation of a new one.
-     * @param ruleLine The rule line, as described above.
-     * @return A valid Access Control List. May be empty.
-     * @throws WikiSecurityException if the ruleLine was faulty somehow.
-     * @since 2.1.121
-     */
-    @Override public Acl parseAcl( final WikiPage page, final String ruleLine 
) throws WikiSecurityException {
+    /** {@inheritDoc} */
+    @Override
+    public Acl parseAcl( final WikiPage page, final String ruleLine ) throws 
WikiSecurityException {
         Acl acl = page.getAcl();
         if (acl == null) {
             acl = new AclImpl();
@@ -138,19 +126,9 @@ public class DefaultAclManager implements AclManager {
     }
 
 
-    /**
-     * 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 parent page, then that is tried also.
-     * This method was moved from Authorizer;
-     * it was consolidated with some code from AuthorizationManager.
-     * This method is guaranteed to return a non-<code>null</code> Acl.
-     *
-     * @param page the page
-     * @return the Acl representing permissions for the page
-     * @since 2.2.121
-     */
-    @Override public Acl getPermissions( final WikiPage page ) {
+    /** {@inheritDoc} */
+    @Override
+    public Acl getPermissions( final WikiPage page ) {
         //  Does the page already have cached ACLs?
         Acl acl = page.getAcl();
         log.debug( "page=" + page.getName() + "\n" + acl );
@@ -164,7 +142,7 @@ public class DefaultAclManager implements AclManager {
                 //  Or, try parsing the page
                 final WikiContext ctx = new WikiContext( m_engine, page );
                 ctx.setVariable( WikiContext.VAR_EXECUTE_PLUGINS, 
Boolean.FALSE );
-                m_engine.getRenderingManager().getHTML(ctx, page);
+                m_engine.getManager( RenderingManager.class ).getHTML(ctx, 
page);
 
                 if (page.getAcl() == null) {
                     page.setAcl( new AclImpl() );
@@ -176,19 +154,9 @@ public class DefaultAclManager implements AclManager {
         return acl;
     }
 
-    /**
-     * Sets the access control list for the page and persists it by prepending
-     * it to the wiki page markup and saving the page. When this method is
-     * called, all other ACL markup in the page is removed. This method will 
forcibly
-     * expire locks on the wiki page if they exist. Any ProviderExceptions 
will be
-     * re-thrown as WikiSecurityExceptions.
-     *
-     * @param page the wiki page
-     * @param acl  the access control list
-     * @throws WikiSecurityException of the Acl cannot be set
-     * @since 2.5
-     */
-    @Override public void setPermissions( final WikiPage page, final Acl acl ) 
throws WikiSecurityException {
+    /** {@inheritDoc} */
+    @Override
+    public void setPermissions( final WikiPage page, final Acl acl ) throws 
WikiSecurityException {
         final PageManager pageManager = m_engine.getManager( PageManager.class 
);
 
         // Forcibly expire any page locks
@@ -210,9 +178,8 @@ public class DefaultAclManager implements AclManager {
     }
 
     /**
-     * Generates an ACL string for inclusion in a wiki page, based on a 
supplied Acl object.
-     * All of the permissions in this Acl are assumed to apply to the same 
page scope.
-     * The names of the pages are ignored; only the actions and principals 
matter.
+     * Generates an ACL string for inclusion in a wiki page, based on a 
supplied Acl object. All of the permissions in this Acl are
+     * assumed to apply to the same page scope. The names of the pages are 
ignored; only the actions and principals matter.
      *
      * @param acl the ACL
      * @return the ACL string
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/CookieAuthenticationLoginModule.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/CookieAuthenticationLoginModule.java
index c5facb7..92b7057 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/CookieAuthenticationLoginModule.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/CookieAuthenticationLoginModule.java
@@ -19,7 +19,6 @@
 package org.apache.wiki.auth.login;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.auth.WikiPrincipal;
 import org.apache.wiki.util.FileUtil;
@@ -64,7 +63,7 @@ import java.util.UUID;
  *  <ol>
  *  <li>{@link HttpRequestCallback}- supplies the cookie, which should contain
  *      an unique id for fetching the UID.</li>
- *  <li>{@link WikiEngineCallback} - allows access to the WikiEngine itself.
+ *  <li>{@link WikiEngineCallback} - allows access to the Engine itself.
  *  </ol>
  * <p>
  * After authentication, a generic WikiPrincipal based on the username will be
@@ -159,7 +158,7 @@ public class CookieAuthenticationLoginModule extends 
AbstractLoginModule {
     /**
      * Attempts to locate the cookie file.
      *
-     * @param engine WikiEngine
+     * @param engine Engine
      * @param uid    An unique ID fetched from the user cookie
      * @return A File handle, or null, if there was a problem.
      */
@@ -210,11 +209,11 @@ public class CookieAuthenticationLoginModule extends 
AbstractLoginModule {
      * Sets a login cookie based on properties set by the user.  This method 
also
      * creates the cookie uid-username mapping in the work directory.
      *
-     * @param engine   The WikiEngine
+     * @param engine   The Engine
      * @param response The HttpServletResponse
      * @param username The username for whom to create the cookie.
      */
-    public static void setLoginCookie( final WikiEngine engine, final 
HttpServletResponse response, final String username ) {
+    public static void setLoginCookie( final Engine engine, final 
HttpServletResponse response, final String username ) {
         final UUID uid = UUID.randomUUID();
         final int days = TextUtil.getIntegerProperty( 
engine.getWikiProperties(), PROP_LOGIN_EXPIRY_DAYS, DEFAULT_EXPIRY_DAYS );
         final Cookie userId = getLoginCookie( uid.toString() );
@@ -240,11 +239,11 @@ public class CookieAuthenticationLoginModule extends 
AbstractLoginModule {
     /**
      * Clears away the login cookie, and removes the uid-username mapping file 
as well.
      *
-     * @param engine   WikiEngine
+     * @param engine   Engine
      * @param request  Servlet request
      * @param response Servlet response
      */
-    public static void clearLoginCookie( final WikiEngine engine, final 
HttpServletRequest request, final HttpServletResponse response ) {
+    public static void clearLoginCookie( final Engine engine, final 
HttpServletRequest request, final HttpServletResponse response ) {
         final Cookie userId = getLoginCookie( "" );
         userId.setMaxAge( 0 );
         response.addCookie( userId );
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WebContainerCallbackHandler.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WebContainerCallbackHandler.java
index 4836b58..c217551 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WebContainerCallbackHandler.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WebContainerCallbackHandler.java
@@ -41,7 +41,7 @@ public final class WebContainerCallbackHandler implements 
CallbackHandler {
     /**
      * Create a new handler.
      *
-     * @param engine  The WikiEngine
+     * @param engine  The Engine
      * @param request The request to look into
      */
     public WebContainerCallbackHandler( final Engine engine, final 
HttpServletRequest request ) {
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
index 682ca99..4938bce 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
@@ -48,7 +48,7 @@ public class WikiCallbackHandler implements CallbackHandler {
     /**
      *  Create a new callback handler.
      *
-     * @param engine the WikiEngine
+     * @param engine the Engine
      * @param request the user's HTTP request. If passed as <code>null</code>, 
later requests for {@link HttpRequestCallback} will return an 
UnsupportedCallbackException
      * @param username the username
      * @param password the password
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/diff/DefaultDifferenceManager.java 
b/jspwiki-main/src/main/java/org/apache/wiki/diff/DefaultDifferenceManager.java
index 859aed6..2e10917 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/diff/DefaultDifferenceManager.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/diff/DefaultDifferenceManager.java
@@ -21,7 +21,7 @@ package org.apache.wiki.diff;
 
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.pages.PageManager;
 import org.apache.wiki.providers.WikiPageProvider;
@@ -47,7 +47,7 @@ public class DefaultDifferenceManager implements 
DifferenceManager {
      * @param engine The WikiEngine.
      * @param props  A set of properties.
      */
-    public DefaultDifferenceManager( final WikiEngine engine, final Properties 
props ) {
+    public DefaultDifferenceManager( final Engine engine, final Properties 
props ) {
         loadProvider( props );
         initializeProvider( engine, props );
 
@@ -69,11 +69,11 @@ public class DefaultDifferenceManager implements 
DifferenceManager {
     }
 
 
-    private void initializeProvider( final WikiEngine engine, final Properties 
props ) {
+    private void initializeProvider( final Engine engine, final Properties 
props ) {
         try {
-            m_provider.initialize(engine, props);
-        } catch( final NoRequiredPropertyException | IOException e1 ) {
-            log.warn("Failed initializing DiffProvider, will use 
NullDiffProvider.", e1);
+            m_provider.initialize( engine, props );
+        } catch( final NoRequiredPropertyException | IOException e ) {
+            log.warn( "Failed initializing DiffProvider, will use 
NullDiffProvider.", e );
             m_provider = new DiffProvider.NullDiffProvider(); //doesn't need 
init'd
         }
     }
@@ -86,7 +86,8 @@ public class DefaultDifferenceManager implements 
DifferenceManager {
      * @param secondWikiText the new text
      * @return XHTML, or empty string, if no difference detected.
      */
-    @Override public String makeDiff( final WikiContext context, final String 
firstWikiText, final String secondWikiText ) {
+    @Override
+    public String makeDiff( final WikiContext context, final String 
firstWikiText, final String secondWikiText ) {
         String diff;
         try {
             diff = m_provider.makeDiffHtml( context, firstWikiText, 
secondWikiText );
@@ -112,7 +113,8 @@ public class DefaultDifferenceManager implements 
DifferenceManager {
      *
      *  @return A HTML-ized difference between two pages.  If there is no 
difference, returns an empty string.
      */
-    @Override public String getDiff( final WikiContext context, final int 
version1, final int version2 ) {
+    @Override
+    public String getDiff( final WikiContext context, final int version1, 
final int version2 ) {
         final String page = context.getPage().getName();
         String page1 = context.getEngine().getManager( PageManager.class 
).getPureText( page, version1 );
         final String page2 = context.getEngine().getManager( PageManager.class 
).getPureText( page, version2 );
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEngineEvent.java 
b/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEngineEvent.java
index 65d1ef7..0339313 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEngineEvent.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEngineEvent.java
@@ -19,7 +19,7 @@
 package org.apache.wiki.event;
 
 /**
-  * WikiEngineEvent indicates a change in the state of the WikiEngine.
+  * WikiEngineEvent indicates a change in the state of the Engine.
   * 
   * @see     org.apache.wiki.event.WikiEvent
   * @since   2.4.20
@@ -28,26 +28,26 @@ public class WikiEngineEvent extends WikiEvent {
 
     private static final long serialVersionUID = 1829433967558773970L;
 
-    /** Indicates a WikiEngine initialization event, fired as the  wiki 
service is being initialized (in progress). */
+    /** Indicates a Engine initialization event, fired as the  wiki service is 
being initialized (in progress). */
     public static final int INITIALIZING   = -1;
 
-    /** Indicates a WikiEngine initialized event, fired after the  wiki 
service is fully available. */
+    /** Indicates a Engine initialized event, fired after the  wiki service is 
fully available. */
     public static final int INITIALIZED    = 0;
 
-    /** Indicates a WikiEngine closing event, fired as a signal that the wiki 
service is shutting down. */
+    /** Indicates a Engine closing event, fired as a signal that the wiki 
service is shutting down. */
     public static final int SHUTDOWN       = 1;
 
     /**
-     * Indicates a WikiEngine stopped event, fired after halting the wiki 
service.
-     * A WikiEngine in this state is not expected to provide further services.
+     * Indicates a Engine stopped event, fired after halting the wiki service. 
A Engine in this state is not expected to provide further
+     * services.
      */
     public static final int STOPPED        = 2;
 
      /**
       *  Constructs an instance of this event.
       *
-      * @param eventSource  the Object that is the source of the event, which 
<b>must</b> be the WikiEngine. If it is not, this
-      * method thows a ClassCastException
+      * @param eventSource the Object that is the source of the event, which 
<b>must</b> be the Engine. If it is not, this method thows
+      *                    a ClassCastException
       * @param type the event type
       */
     public WikiEngineEvent( final Object eventSource, final int type ) {
@@ -59,6 +59,7 @@ public class WikiEngineEvent extends WikiEvent {
      *
      * @param type the type of this WikiEngineEvent.
      */
+    @Override
     protected void setType( final int type ) {
         if( type >= INITIALIZING && type <= STOPPED ) {
             super.setType( type );
@@ -82,6 +83,7 @@ public class WikiEngineEvent extends WikiEvent {
      *
      * @return a String representation of the type
      */
+    @Override
     public final String eventName() {
         switch ( getType() ) {
             case INITIALIZING: return "INITIALIZING";
@@ -97,6 +99,7 @@ public class WikiEngineEvent extends WikiEvent {
      *
      * @return a String description of the type
      */
+    @Override
     public final String getTypeDescription() {
         switch ( getType() ) {
             case INITIALIZING: return "wiki engine initializing";
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEventManager.java 
b/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEventManager.java
index 9709004..dc069e9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEventManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/event/WikiEventManager.java
@@ -37,7 +37,7 @@ import java.util.Vector;
  *  A singleton class that manages the addition and removal of WikiEvent 
listeners to a event source, as well as the firing of events
  *  to those listeners. An "event source" is the object delegating its event 
handling to an inner delegating class supplied by this
  *  manager. The class being serviced is considered a "client" of the 
delegate. The WikiEventManager operates across any number of
- *  simultaneously-existing WikiEngines since it manages all delegation on a 
per-object basis. Anything that might fire a WikiEvent
+ *  simultaneously-existing Engines since it manages all delegation on a 
per-object basis. Anything that might fire a WikiEvent
  *  (or any of its subclasses) can be a client.
  *  </p>
  *
@@ -242,14 +242,12 @@ public final class WikiEventManager {
         final Map< Object, WikiEventDelegate > sources = mgr.getDelegates();
         synchronized( sources ) {
             // get an iterator over the Map.Enty objects in the map
-            final Iterator< Map.Entry< Object, WikiEventDelegate > > it = 
sources.entrySet().iterator();
-            while( it.hasNext() ) {
-                final Map.Entry< Object, WikiEventDelegate > entry = it.next();
+            for( final Map.Entry< Object, WikiEventDelegate > entry : 
sources.entrySet() ) {
                 // the entry value is the delegate
                 final WikiEventDelegate delegate = entry.getValue();
 
                 // now see if we can remove the listener from the delegate 
(delegate may be null because this is a weak reference)
-                if( delegate != null && 
delegate.removeWikiEventListener(listener) ) {
+                if( delegate != null && delegate.removeWikiEventListener( 
listener ) ) {
                     return true; // was removed
                 }
             }
@@ -375,8 +373,8 @@ public final class WikiEventManager {
         public Set< WikiEventListener > getWikiEventListeners() {
             synchronized( m_listenerList ) {
                 final TreeSet< WikiEventListener > set = new TreeSet<>( new 
WikiEventListenerComparator() );
-                for( final Iterator< WeakReference< WikiEventListener > >  i = 
m_listenerList.iterator(); i.hasNext(); ) {
-                    final WikiEventListener l = i.next().get();
+                for( final WeakReference< WikiEventListener > 
wikiEventListenerWeakReference : m_listenerList ) {
+                    final WikiEventListener l = 
wikiEventListenerWeakReference.get();
                     if( l != null ) {
                         set.add( l );
                     }
@@ -434,12 +432,12 @@ public final class WikiEventManager {
             boolean needsCleanup = false;
             try {
                 synchronized( m_listenerList ) {
-                    for( int i = 0; i < m_listenerList.size(); i++ ) {
-                        final WikiEventListener listener = m_listenerList.get( 
i ).get();
+                    for( final WeakReference< WikiEventListener > 
wikiEventListenerWeakReference : m_listenerList ) {
+                        final WikiEventListener listener = 
wikiEventListenerWeakReference.get();
                         if( listener != null ) {
                             listener.actionPerformed( event );
                         } else {
-                            needsCleanup  = true;
+                            needsCleanup = true;
                         }
                     }
 
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java
 
b/jspwiki-main/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java
index 799c6e1..6d2e07d 100644
--- 
a/jspwiki-main/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java
+++ 
b/jspwiki-main/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java
@@ -18,13 +18,13 @@
  */
 package org.apache.wiki.i18n;
 
+import org.apache.wiki.api.core.Engine;
+
 import java.text.MessageFormat;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-import org.apache.wiki.WikiEngine;
-
 
 /**
  *  Manages all internationalization in JSPWiki.
@@ -33,14 +33,10 @@ import org.apache.wiki.WikiEngine;
  */
 public class InternationalizationManager {
 
-    /** The name of the ResourceBundle which contains any and all JSPWiki core
-     *  resource strings.  It's value is {@value}.
-     */
+    /** The name of the ResourceBundle which contains any and all JSPWiki core 
resource strings.  It's value is {@value}. */
     public static final String CORE_BUNDLE = "CoreResources";
     
-    /** The name of the ResourceBundle which contains any and all JSPWiki 
default templates
-     *  resource strings.  It's value is {@value}.
-     */
+    /** The name of the ResourceBundle which contains any and all JSPWiki 
default templates resource strings.  It's value is {@value}. */
     public static final String DEF_TEMPLATE = "templates.default";
     // public static final String JSPWIKI_BUNDLE = "jspwiki";
     // public static final String PLUGINS_BUNDLE = "plugins";
@@ -50,20 +46,17 @@ public class InternationalizationManager {
      *
      *  @param engine To which engine this belongs to
      */
-    public InternationalizationManager( WikiEngine engine )
-    {
+    public InternationalizationManager( final Engine engine ) {
     }
 
     /**
-     *  Returns a String from the CORE_BUNDLE using English as the default
-     *  locale.
+     *  Returns a String from the CORE_BUNDLE using English as the default 
locale.
      *
      *  @param key Key to find
      *  @return The English string
      *  @throws MissingResourceException If there is no such key
      */
-    public String get( String key ) throws MissingResourceException
-    {
+    public String get( final String key ) throws MissingResourceException {
         return get( CORE_BUNDLE, Locale.ENGLISH, key );
     }
     
@@ -75,34 +68,30 @@ public class InternationalizationManager {
      *  @return A localized string
      *  @throws MissingResourceException If the key cannot be located at all, 
even from the default locale.
      */
-    public ResourceBundle getBundle( String bundle, Locale locale ) throws 
MissingResourceException
-    {
-        if( locale == null )
-        {
+    public ResourceBundle getBundle( final String bundle, Locale locale ) 
throws MissingResourceException {
+        if( locale == null ) {
             locale = Locale.getDefault();
         }
 
-        ResourceBundle b = ResourceBundle.getBundle( bundle, locale );
-
-        return b;
+        return ResourceBundle.getBundle( bundle, locale );
     }
 
     /**
-     *  If you are too lazy to open your own bundle, use this method
-     *  to get a string simply from a bundle.
+     *  If you are too lazy to open your own bundle, use this method to get a 
string simply from a bundle.
+     *
      *  @param bundle Which bundle the string is in
      *  @param locale Locale to use - null for default
      *  @param key    Which key to use.
      *  @return A localized string (or from the default language, if not found)
      *  @throws MissingResourceException If the key cannot be located at all, 
even from the default locale.
      */
-    public String get( String bundle, Locale locale, String key ) throws 
MissingResourceException
-    {
+    public String get( final String bundle, final Locale locale, final String 
key ) throws MissingResourceException {
         return getBundle( bundle, locale ).getString( key );
     }
 
     /**
      *  Obtain a parameterized String from the bundle.
+     *
      *  @param bundle Which bundle the string is in
      *  @param locale Locale to use - null for default
      *  @param key    Which key to use.
@@ -110,9 +99,8 @@ public class InternationalizationManager {
      *  @return A localized string (or from the default language, if not found)
      *  @throws MissingResourceException If the key cannot be located at all, 
even from the default locale.
      */
-    public String get( String bundle, Locale locale, String key, Object... 
args ) throws MissingResourceException
-    {
-        MessageFormat mf = new MessageFormat( get( bundle, locale, key ), 
locale );
+    public String get( final String bundle, final Locale locale, final String 
key, final Object... args ) throws MissingResourceException {
+        final MessageFormat mf = new MessageFormat( get( bundle, locale, key 
), locale );
         return mf.format( args );
     }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/pages/PageManager.java 
b/jspwiki-main/src/main/java/org/apache/wiki/pages/PageManager.java
index 80ddfc1..a35fce9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/pages/PageManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/pages/PageManager.java
@@ -155,7 +155,7 @@ public interface PageManager extends WikiEventListener {
 
     /**
      * Puts the page text into the repository.  Note that this method does NOT 
update
-     * JSPWiki internal data structures, and therefore you should always use 
WikiEngine.saveText()
+     * JSPWiki internal data structures, and therefore you should always use 
saveText()
      *
      * @param page    Page to save
      * @param content Wikimarkup to save
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/pages/PageSorter.java 
b/jspwiki-main/src/main/java/org/apache/wiki/pages/PageSorter.java
index 42df456..43df364 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/pages/PageSorter.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/pages/PageSorter.java
@@ -82,12 +82,10 @@ public class PageSorter implements Comparator< String > {
     }
 
     /**
-     * Called by WikiEngine to initialise this instance. Tries to use class
-     * given by the PROP_PAGE_NAME_COMPARATOR property as the page name
-     * comparator. Uses a default comparator if this property is not set or
-     * there is any problem loading the specified class.
+     * Called by Engine to initialise this instance. Tries to use class given 
by the PROP_PAGE_NAME_COMPARATOR property as the page name
+     * comparator. Uses a default comparator if this property is not set or 
there is any problem loading the specified class.
      * 
-     * @param props this WikiEngine's properties.
+     * @param props this Engine's properties.
      */
     @SuppressWarnings( "unchecked" )
     public void initialize( final Properties props ) {
@@ -113,9 +111,7 @@ public class PageSorter implements Comparator< String > {
     }
 
     /**
-     * Sorts the specified array into ascending order based on the
-     * PageNameComparator. The actual sort is done using
-     * <code>Arrays.sort()</code>.
+     * Sorts the specified array into ascending order based on the 
PageNameComparator. The actual sort is done using {@code Arrays.sort()}.
      * 
      * @param nameArray the page names to be sorted
      */
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java 
b/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
index 706b53f..1ad6022 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
@@ -71,7 +71,7 @@ public class WeblogEntryPlugin implements WikiPlugin {
     /**
      * Returns a new page name for entries.  It goes through the list of all 
blog pages, and finds out the next in line.
      *
-     * @param engine   A WikiEngine
+     * @param engine   A Engine
      * @param blogName The page (or blog) name.
      * @return A new name.
      * @throws ProviderException If something goes wrong.
diff --git 
a/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java 
b/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
index 8c377de..0127e48 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/WeblogPlugin.java
@@ -390,7 +390,7 @@ public class WeblogPlugin implements WikiPlugin, 
ParserStagePlugin {
      *  Attempts to locate all pages that correspond to the
      *  blog entry pattern.  Will only consider the days on the dates; not the 
hours and minutes.
      *
-     *  @param engine WikiEngine which is used to get the pages
+     *  @param engine Engine which is used to get the pages
      *  @param baseName The basename (e.g. "Main" if you want 
"Main_blogentry_xxxx")
      *  @param start The date which is the first to be considered
      *  @param end   The end date which is the last to be considered

Reply via email to