jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvit...@apache.org
Subject svn commit: r1688207 [1/2] - in /jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src: main/java/org/apache/wiki/ main/java/org/apache/wiki/api/engine/ main/java/org/apache/wiki/api/filters/ main/java/org/apache/wiki/attachment/ main/java/org/apac...
Date Mon, 29 Jun 2015 13:29:40 GMT
Author: dvittor
Date: Mon Jun 29 13:29:39 2015
New Revision: 1688207

URL: http://svn.apache.org/r1688207
Log:
More code for the pico container

Added:
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiInternalModule.java   (with props)
Modified:
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageSorter.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ReferenceManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/FilterManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/BasicPageFilter.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/AclManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/content/PageRenamer.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/InternalModule.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/ModuleManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/render/RenderingManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/rss/RSSGenerator.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/admin/DefaultAdminBeanManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortURLConstructor.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortViewURLConstructor.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/URLConstructor.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/util/ClassUtil.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/resources/ini/classmappings.xml
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/test/java/org/apache/wiki/PageSorterTest.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/test/java/org/apache/wiki/TestEngine.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/test/java/org/apache/wiki/util/XmlUtilTest.java

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageManager.java Mon Jun 29 13:29:39 2015
@@ -31,7 +31,6 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
 import org.apache.wiki.api.engine.FilterManager;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.api.exceptions.ProviderException;
@@ -51,6 +50,7 @@ import org.apache.wiki.modules.ModuleMan
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.providers.RepositoryModifiedException;
 import org.apache.wiki.providers.WikiPageProvider;
+import org.apache.wiki.search.SearchManager;
 import org.apache.wiki.util.ClassUtil;
 import org.apache.wiki.util.TextUtil;
 import org.apache.wiki.workflow.Outcome;
@@ -146,13 +146,11 @@ public class PageManager extends ModuleM
      */
     public static final String FACT_IS_AUTHENTICATED = "fact.isAuthenticated";
 
-    static Logger log = Logger.getLogger(PageManager.class);
-
     private WikiPageProvider m_provider;
 
     protected HashMap<String, PageLock> m_pageLocks = new HashMap<String, PageLock>();
 
-    private WikiEngine m_engine;
+    private SearchManager m_searchManager;
 
     private int m_expiryTime = 60;
 
@@ -165,15 +163,14 @@ public class PageManager extends ModuleM
      * @param props  Properties to use for initialization
      * @throws WikiException If anything goes wrong, you get this.
      */
-    public PageManager() {
-    	
+    public PageManager(SearchManager searchManager) {
+    	m_searchManager = searchManager;
     }
     
     @Override
     public void initialize(WikiEngine engine, Properties props) throws WikiException {
-        super.initialize(engine, props);
-        String classname;
-        m_engine = engine;
+         super.initialize(engine, props);
+        m_searchManager.initialize(engine, props);
         boolean useCache = "true".equals(props.getProperty(PROP_USECACHE));
 
         m_expiryTime = TextUtil.parseIntParameter(props.getProperty(PROP_LOCKEXPIRY), 60);
@@ -181,6 +178,7 @@ public class PageManager extends ModuleM
         //
         //  If user wants to use a cache, then we'll use the CachingProvider.
         //
+        String classname;
         if (useCache) {
             classname = "org.apache.wiki.providers.CachingProvider";
         } else {
@@ -274,7 +272,7 @@ public class PageManager extends ModuleM
                 //  Make sure that it no longer exists in internal data structures either.
                 //
                 WikiPage dummy = new WikiPage(m_engine, pageName);
-                m_engine.getSearchManager().pageRemoved(dummy);
+                m_searchManager.pageRemoved(dummy);
                 m_engine.getReferenceManager().pageRemoved(dummy);
             }
         }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageSorter.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageSorter.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageSorter.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/PageSorter.java Mon Jun 29 13:29:39 2015
@@ -25,7 +25,7 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.log4j.Logger;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.util.ClassUtil;
 import org.apache.wiki.util.comparators.JavaNaturalComparator;
 
@@ -35,23 +35,20 @@ import org.apache.wiki.util.comparators.
  * <b>Note</b> - this class is deliberately not null safe. Never call any of the
  * methods with a null argument!
  */
-public class PageSorter implements Comparator
+public class PageSorter extends WikiInternalModule implements Comparator
 {
-    private static Logger log = Logger.getLogger( PageSorter.class );
-
     // The name of the property that specifies the desired page name comparator
     protected static final String PROP_PAGE_NAME_COMPARATOR = "jspwiki.pageNameComparator.class";
 
-    private Comparator<String> m_comparator;
+    private Comparator<String> m_comparator = JavaNaturalComparator.DEFAULT_JAVA_COMPARATOR;
 
     /**
      * Default constructor uses Java "natural" ordering.
      */
-    public PageSorter()
-    {
-        m_comparator = JavaNaturalComparator.DEFAULT_JAVA_COMPARATOR;
+    public PageSorter( ) {
+    	m_comparator = JavaNaturalComparator.DEFAULT_JAVA_COMPARATOR;
     }
-
+    
     /**
      * Construct with a particular comparator.
      * 
@@ -142,22 +139,24 @@ public class PageSorter implements Compa
      * 
      * @param props this WikiEngine's properties.
      */
-    @SuppressWarnings( "unchecked" )
-    public void initialize( Properties props )
+    @Override
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
+    	super.initialize(engine, props);
         // Default is Java natural order
         m_comparator = JavaNaturalComparator.DEFAULT_JAVA_COMPARATOR;
         String className = props.getProperty( PROP_PAGE_NAME_COMPARATOR );
-        if( className != null && className.length() > 0 )
+        if( className != null && className.length() > 0 ) {
             try
             {
-                m_comparator = (Comparator<String>) ClassUtil.findClass( "org.apache.wiki.util.comparators", className )
-                    .newInstance();
+                m_comparator = (Comparator<String>) 
+                		ClassUtil.findClass( "org.apache.wiki.util.comparators", className ).newInstance();
             }
             catch( Exception e )
             {
                 log.error( "Falling back to default \"natural\" comparator", e );
             }
+        }
     }
 
     /**

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ReferenceManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ReferenceManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ReferenceManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ReferenceManager.java Mon Jun 29 13:29:39 2015
@@ -38,19 +38,20 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.TreeSet;
 
 import org.apache.commons.lang.time.StopWatch;
-import org.apache.log4j.Logger;
+import org.apache.wiki.api.exceptions.FilterException;
 import org.apache.wiki.api.exceptions.ProviderException;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.api.filters.BasicPageFilter;
 import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventUtils;
 import org.apache.wiki.event.WikiPageEvent;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.providers.WikiPageProvider;
 import org.apache.wiki.util.TextUtil;
 
@@ -130,7 +131,7 @@ import org.apache.wiki.util.TextUtil;
 
 public class ReferenceManager
     extends BasicPageFilter
-    implements InternalModule, WikiEventListener
+    implements WikiEventListener
 {
     /** Maps page wikiname to a Collection of pages it refers to. The Collection
      *  must contain Strings. The Collection may contain names of non-existing
@@ -146,13 +147,8 @@ public class ReferenceManager
     private Map<String,Set<String>> m_referredBy;
     private Map<String,Set<String>> m_unmutableReferredBy;
 
-    /** The WikiEngine that owns this object. */
-    private WikiEngine     m_engine;
-
     private boolean        m_matchEnglishPlurals = false;
 
-    private static Logger log = Logger.getLogger(ReferenceManager.class);
-
     private static final String SERIALIZATION_FILE = "refmgr.ser";
     private static final String SERIALIZATION_DIR  = "refmgr-attr";
 
@@ -160,29 +156,7 @@ public class ReferenceManager
     private static final long serialVersionUID = 4L;
 
     /**
-     *  Builds a new ReferenceManager.
-     *
-     *  @param engine The WikiEngine to which this is managing references to.
-     */
-    public ReferenceManager( WikiEngine engine )
-    {
-        m_refersTo   = new HashMap<String,Collection<String>>();
-        m_referredBy = new HashMap<String,Set<String>>();
-        m_engine = engine;
-
-        m_matchEnglishPlurals = TextUtil.getBooleanProperty( engine.getWikiProperties(),
-                                                             WikiEngine.PROP_MATCHPLURALS,
-                                                             m_matchEnglishPlurals );
-
-        //
-        //  Create two maps that contain unmutable versions of the two basic maps.
-        //
-        m_unmutableReferredBy = Collections.unmodifiableMap( m_referredBy );
-        m_unmutableRefersTo   = Collections.unmodifiableMap( m_refersTo );
-    }
-
-    /**
-     *  Does a full reference update.  Does not sync; assumes that you do it afterwards.
+     *  Does a full reference update. Does not sync; assumes that you do it afterwards.
      */
     private void updatePageReferences( WikiPage page ) throws ProviderException
     {
@@ -204,6 +178,26 @@ public class ReferenceManager
     }
 
     /**
+     * Initialize the ReferenceManager
+     */
+    public void initialize( WikiEngine engine, Properties properties ) throws FilterException, WikiException
+    {
+        super.initialize(engine, properties);
+        m_refersTo   = new HashMap<String,Collection<String>>();
+        m_referredBy = new HashMap<String,Set<String>>();
+
+        m_matchEnglishPlurals = TextUtil.getBooleanProperty( engine.getWikiProperties(),
+                                                             WikiEngine.PROP_MATCHPLURALS,
+                                                             m_matchEnglishPlurals );
+
+        //
+        //  Create two maps that contain unmutable versions of the two basic maps.
+        //
+        m_unmutableReferredBy = Collections.unmodifiableMap( m_referredBy );
+        m_unmutableRefersTo   = Collections.unmodifiableMap( m_refersTo );
+    }
+    
+    /**
      *  Initializes the entire reference manager with the initial set of pages
      *  from the collection.
      *

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java Mon Jun 29 13:29:39 2015
@@ -29,7 +29,6 @@ import java.util.ResourceBundle;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import org.apache.log4j.Logger;
 import org.apache.wiki.api.engine.FilterManager;
 import org.apache.wiki.api.exceptions.NoSuchVariableException;
 import org.apache.wiki.api.filters.PageFilter;
@@ -43,10 +42,8 @@ import org.apache.wiki.preferences.Prefe
  *
  *  @since 1.9.20.
  */
-public class VariableManager implements InternalModule
+public class VariableManager extends WikiInternalModule
 {
-    private static Logger log = Logger.getLogger( VariableManager.class );
-   
     // FIXME: These are probably obsolete.
     public static final String VAR_ERROR = "error";
     public static final String VAR_MSG   = "msg";
@@ -61,14 +58,6 @@ public class VariableManager implements
     };
     
     /**
-     *  Creates a VariableManager object using the property list given.
-     *  @param props The properties.
-     */
-    public void initialize( WikiEngine engine, Properties props )
-    {
-    }
-
-    /**
      *  Returns true if the link is really command to insert
      *  a variable.
      *  <P>

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java Mon Jun 29 13:29:39 2015
@@ -175,8 +175,6 @@ public class WikiEngine
     /** If this property is set to false, all filters are disabled when translating. */
     public static final String PROP_RUNFILTERS   = "jspwiki.runFilters";
     
-    private static Properties staticProps = new Properties();
-
     /** Compares pages by name */
     private PageSorter     m_pageSorter = null;
     
@@ -386,20 +384,6 @@ public class WikiEngine
 
 
     /**
-     *  Instantiate the WikiEngine using a given set of properties.
-     *  Use this constructor for testing purposes only.
-     *
-     *  @param properties A set of properties to use to initialize this WikiEngine.
-     *  @throws WikiException If the initialization fails.
-     */
-    public WikiEngine( )
-        throws WikiException
-    {
-    	m_properties = staticProps;
-//        initialize( properties );
-    }
-
-    /**
      *  Instantiate using this method when you're running as a servlet and
      *  WikiEngine will figure out where to look for the property
      *  file.
@@ -452,7 +436,6 @@ public class WikiEngine
     {
         m_startTime  = new Date();
         m_properties = props;
-        WikiEngine.staticProps = props;
 
         //
         //  Initialize log4j.  However, make sure that we don't initialize it multiple times.
@@ -546,10 +529,6 @@ public class WikiEngine
         m_templateDir    = TextUtil.getStringProperty( props, PROP_TEMPLATEDIR, "default" );
         m_frontPage      = TextUtil.getStringProperty( props, PROP_FRONTPAGE,   "Main" );
         
-        // Initialize the page name comparator now as it may be used while
-        // initializing other modules
-        initPageSorter( props );
-
         //
         //  Initialize the important modules.  Any exception thrown by the
         //  managers means that we will not start up.
@@ -564,22 +543,23 @@ public class WikiEngine
             m_urlConstructor = (URLConstructor) urlclass.newInstance();
             m_urlConstructor.initialize( this, props );
             
-            m_pageManager       = (PageManager)ClassUtil.getMappedObject(PageManager.class.getName(), this, props );
-            m_pluginManager     = (PluginManager)ClassUtil.getMappedObject(PluginManager.class.getName(), this, props );
-            m_differenceManager = (DifferenceManager)ClassUtil.getMappedObject(DifferenceManager.class.getName(), this, props );
-            m_attachmentManager = (AttachmentManager)ClassUtil.getMappedObject(AttachmentManager.class.getName(), this, props );
-            m_variableManager   = (VariableManager)ClassUtil.getMappedObject(VariableManager.class.getName(), this, props );
-            m_filterManager     = (FilterManager)ClassUtil.getMappedObject(FilterManager.class.getName(), this, props );
-            m_renderingManager  = (RenderingManager) ClassUtil.getMappedObject(RenderingManager.class.getName(), this, props );
-
-            m_searchManager     = (SearchManager)ClassUtil.getMappedObject(SearchManager.class.getName(), this, props );
-
-            m_authenticationManager = (AuthenticationManager) ClassUtil.getMappedObject(AuthenticationManager.class.getName(), this, props );
-            m_authorizationManager  = (AuthorizationManager) ClassUtil.getMappedObject( AuthorizationManager.class.getName(), this, props );
-            m_userManager           = (UserManager) ClassUtil.getMappedObject(UserManager.class.getName(), this, props );
-            m_groupManager          = (GroupManager) ClassUtil.getMappedObject(GroupManager.class.getName(), this, props );
+            m_pageSorter        = ClassUtil.getInternalModule(PageSorter.class, this, props );
+            m_pageManager       = ClassUtil.getInternalModule(PageManager.class, this, props );
+            m_pluginManager     = ClassUtil.getInternalModule(PluginManager.class, this, props );
+            m_differenceManager = ClassUtil.getInternalModule(DifferenceManager.class, this, props );
+            m_attachmentManager = ClassUtil.getInternalModule(AttachmentManager.class, this, props );
+            m_variableManager   = ClassUtil.getInternalModule(VariableManager.class, this, props );
+            m_filterManager     = ClassUtil.getInternalModule(FilterManager.class, this, props );
+            m_renderingManager  = ClassUtil.getInternalModule(RenderingManager.class, this, props );
+
+            m_searchManager     = ClassUtil.getInternalModule(SearchManager.class, this, props );
+
+            m_authenticationManager = ClassUtil.getInternalModule(AuthenticationManager.class, this, props );
+            m_authorizationManager  = ClassUtil.getInternalModule(AuthorizationManager.class, this, props );
+            m_userManager           = ClassUtil.getInternalModule(UserManager.class, this, props );
+            m_groupManager          = ClassUtil.getInternalModule(GroupManager.class, this, props );
 
-            m_editorManager     = (EditorManager)ClassUtil.getMappedObject(EditorManager.class.getName(), this , props );
+            m_editorManager     = ClassUtil.getInternalModule(EditorManager.class, this , props );
 
             m_progressManager   = new ProgressManager();
 
@@ -588,16 +568,13 @@ public class WikiEngine
             m_aclManager = getAclManager();
 
             // Start the Workflow manager
-            m_workflowMgr = (WorkflowManager)ClassUtil.getMappedObject(WorkflowManager.class.getName(), this, props);
+            m_workflowMgr = ClassUtil.getInternalModule(WorkflowManager.class, this, props);
 
-            m_internationalizationManager = (InternationalizationManager)
-                ClassUtil.getMappedObject(InternationalizationManager.class.getName(), this, props);
+            m_internationalizationManager = ClassUtil.getInternalModule(InternationalizationManager.class, this, props);
 
-            m_templateManager   = (TemplateManager)
-                ClassUtil.getMappedObject(TemplateManager.class.getName(), this, props );
+            m_templateManager   = ClassUtil.getInternalModule(TemplateManager.class, this, props );
 
-            m_adminBeanManager = (AdminBeanManager)
-                ClassUtil.getMappedObject(AdminBeanManager.class.getName(),this);
+            m_adminBeanManager = ClassUtil.getInternalModule(AdminBeanManager.class,this, props);
 
             // Since we want to use a page filters initilize() method
             // as a engine startup listener where we can initialize global event listeners,
@@ -618,7 +595,7 @@ public class WikiEngine
             //  initReferenceManager is indirectly using m_filterManager, therefore
             //  it has to be called after it was initialized.
             //
-            initReferenceManager();
+            initReferenceManager(props);
 
             //
             //  Hook the different manager routines into the system.
@@ -648,27 +625,25 @@ public class WikiEngine
             log.fatal( "JSPWiki could not start, URLConstructor cannot be accessed: " + e.getMessage(), e );
             throw new WikiException(e.getMessage(), e );
         }
-        catch( Exception e )
-        {
-            // Final catch-all for everything
-            log.fatal( "JSPWiki could not start, due to an unknown exception when starting.",e );
-            throw new WikiException( "Failed to start. Caused by: " + e.getMessage() + 
-                                     "; please check log files for better information.", e );
-        }
+//        catch( Exception e )
+//        {
+//            // Final catch-all for everything
+//            log.fatal( "JSPWiki could not start, due to an unknown exception when starting.",e );
+//            throw new WikiException( "Failed to start. Caused by: " + e.getMessage() + 
+//                                     "; please check log files for better information.", e );
+//        }
         
         //
         //  Initialize the good-to-have-but-not-fatal modules.
         //
         try
         {
-            if( TextUtil.getBooleanProperty( props,
-                                             RSSGenerator.PROP_GENERATE_RSS,
-                                             false ) )
+            if( TextUtil.getBooleanProperty( props, RSSGenerator.PROP_GENERATE_RSS, false ) )
             {
-                m_rssGenerator = (RSSGenerator)ClassUtil.getMappedObject(RSSGenerator.class.getName(), this, props );
+                m_rssGenerator = ClassUtil.getInternalModule(RSSGenerator.class, this, props );
             }
 
-            m_pageRenamer = (PageRenamer)ClassUtil.getMappedObject(PageRenamer.class.getName(), this, props );
+            m_pageRenamer = ClassUtil.getInternalModule(PageRenamer.class, this, props );
         }
         catch( Exception e )
         {
@@ -679,8 +654,7 @@ public class WikiEngine
         // Start the RSS generator & generator thread
         if( m_rssGenerator != null )
         {
-            m_rssFile = TextUtil.getStringProperty( props,
-                    RSSGenerator.PROP_RSSFILE, "rss.rdf" );
+            m_rssFile = TextUtil.getStringProperty( props, RSSGenerator.PROP_RSSFILE, "rss.rdf" );
             File rssFile=null;
             if (m_rssFile.startsWith(File.separator))
             {
@@ -711,7 +685,7 @@ public class WikiEngine
      *  @throws WikiException If the reference manager initialization fails.
      */
     @SuppressWarnings("unchecked")
-    public void initReferenceManager() throws WikiException
+    private void initReferenceManager(Properties props) throws WikiException
     {
         try
         {
@@ -722,9 +696,7 @@ public class WikiEngine
             // Build a new manager with default key lists.
             if( m_referenceManager == null )
             {
-                m_referenceManager =
-                    (ReferenceManager) ClassUtil.getMappedObject(ReferenceManager.class.getName(), this );
-                m_referenceManager.setEngine(this);
+            	m_referenceManager = ClassUtil.getInternalModule(ReferenceManager.class, this, props );
                 m_referenceManager.initialize( pages );
             }
 
@@ -1999,10 +1971,9 @@ public class WikiEngine
      *  @since 1.6.1
      *  @return The current PluginManager instance
      */
-    @SuppressWarnings("unchecked")
-    public < T extends PluginManager > T getPluginManager()
+    public PluginManager getPluginManager()
     {
-        return (T)m_pluginManager;
+        return m_pluginManager;
     }
 
     /**
@@ -2094,10 +2065,9 @@ public class WikiEngine
      *  @since 2.1.88
      *  @return The current FilterManager instance
      */
-    @SuppressWarnings("unchecked")
-    public < T extends FilterManager > T getFilterManager()
+    public FilterManager getFilterManager()
     {
-        return (T)m_filterManager;
+        return m_filterManager;
     }
 
     /**
@@ -2492,15 +2462,6 @@ public class WikiEngine
     }
     
     /**
-     * Initialize the page name comparator.
-     */
-    private void initPageSorter( Properties props )
-    {
-        m_pageSorter = new PageSorter();
-        m_pageSorter.initialize( props );
-    }
-    
-    /**
      * Get this engine's page name comparator.
      * 
      * @return the PageSorter used to sort pages by name in this engine

Added: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiInternalModule.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiInternalModule.java?rev=1688207&view=auto
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiInternalModule.java (added)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiInternalModule.java Mon Jun 29 13:29:39 2015
@@ -0,0 +1,30 @@
+package org.apache.wiki;
+
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.modules.InternalModule;
+
+public class WikiInternalModule implements InternalModule {
+
+	protected Logger log = Logger.getLogger( getClass() );
+	
+	protected boolean initialized = false;
+	protected WikiEngine m_engine;
+	protected Properties m_properties;
+	
+	@Override
+	public void initialize(WikiEngine engine, Properties props) throws WikiException {
+		m_engine = engine;
+		m_properties = props;
+		initialized = true;
+	}
+
+	@Override
+	public boolean isInitialized() {
+		return initialized;
+	}
+
+	
+}

Propchange: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/WikiInternalModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/FilterManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/FilterManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/FilterManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/FilterManager.java Mon Jun 29 13:29:39 2015
@@ -24,9 +24,10 @@ import java.util.List;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.exceptions.FilterException;
 import org.apache.wiki.api.filters.PageFilter;
+import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.modules.WikiModuleInfo;
 
-public interface FilterManager
+public interface FilterManager extends InternalModule
 {
     /** Property name for setting the filter XML property file.  Value is <tt>{@value}</tt>. */
     String PROP_FILTERXML = "jspwiki.filterConfig";

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java Mon Jun 29 13:29:39 2015
@@ -27,11 +27,12 @@ import org.apache.oro.text.regex.Pattern
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.exceptions.PluginException;
 import org.apache.wiki.api.plugin.WikiPlugin;
+import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.plugin.DefaultPluginManager.WikiPluginInfo;
 
 
-public interface PluginManager {
+public interface PluginManager extends InternalModule {
 
     /** The property name defining which packages will be searched for plugin classes. */
     String PROP_SEARCHPATH = "jspwiki.plugin.searchPath";

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/BasicPageFilter.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/BasicPageFilter.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/BasicPageFilter.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/BasicPageFilter.java Mon Jun 29 13:29:39 2015
@@ -18,12 +18,10 @@
  */
 package org.apache.wiki.api.filters;
 
-import java.util.Properties;
-
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.api.exceptions.FilterException;
-import org.apache.wiki.api.exceptions.WikiException;
 
 /**
  *  Provides a base implementation of a PageFilter.  None of the callbacks
@@ -31,21 +29,9 @@ import org.apache.wiki.api.exceptions.Wi
  *  and implement only methods that you need.
  *
  */
-public class BasicPageFilter
+public class BasicPageFilter extends WikiInternalModule
     implements PageFilter
 {
-    protected WikiEngine m_engine;
-  
-    /**
-     *  If you override this, you should call super.initialize() first.
-     *  
-     *  {@inheritDoc}
-     */
-    public void initialize( WikiEngine engine, Properties properties )
-        throws FilterException, WikiException
-    {
-        m_engine = engine;
-    }
 
     /**
      *  {@inheritDoc}

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/attachment/AttachmentManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/attachment/AttachmentManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/attachment/AttachmentManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/attachment/AttachmentManager.java Mon Jun 29 13:29:39 2015
@@ -35,16 +35,20 @@ import net.sf.ehcache.Element;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.PageManager;
+import org.apache.wiki.PageSorter;
+import org.apache.wiki.ReferenceManager;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiProvider;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.WikiException;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.parser.MarkupParser;
+import org.apache.wiki.providers.CachingAttachmentProvider;
 import org.apache.wiki.providers.WikiAttachmentProvider;
+import org.apache.wiki.search.SearchManager;
 import org.apache.wiki.util.ClassUtil;
 
 /**
@@ -57,7 +61,7 @@ import org.apache.wiki.util.ClassUtil;
  *
  *  @since 1.9.28
  */
-public class AttachmentManager implements InternalModule
+public class AttachmentManager extends WikiInternalModule
 {
     /**
      *  The property name for defining the attachment provider class name.
@@ -81,8 +85,13 @@ public class AttachmentManager implement
 
     static Logger log = Logger.getLogger( AttachmentManager.class );
     private WikiAttachmentProvider m_provider;
-    private WikiEngine             m_engine;
+    private SearchManager          m_searchManager;
+    private PageManager            m_pageManager;
+    private ReferenceManager       m_referenceManager;
+    private PageSorter             m_pageSorter;
     private CacheManager m_cacheManager = CacheManager.getInstance();
+    
+    private boolean initialized = false;
 
     private Cache m_dynamicAttachments;
     /** Name of the page cache. */
@@ -104,21 +113,30 @@ public class AttachmentManager implement
      *  its configuration.  Typically this is the "jspwiki.properties".
      */
 
+    public AttachmentManager(SearchManager searchManager, ReferenceManager referenceManager, PageManager pageManager, PageSorter pageSorter) {
+    	m_searchManager = searchManager;
+    	m_pageManager = pageManager;
+    	m_referenceManager = referenceManager;
+    	m_pageSorter = pageSorter;
+    }
+    
     // FIXME: Perhaps this should fail somehow.
-    public void initialize( WikiEngine engine, Properties props )
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
-        String classname;
-
-        m_engine = engine;
-
+        super.initialize(engine, props);
+    	m_searchManager.initialize(engine, props);
+    	m_pageManager.initialize(engine, props);
+    	m_referenceManager.initialize(engine, props);
+    	m_pageSorter.initialize(engine, props);
+    	
         //
         //  If user wants to use a cache, then we'll use the CachingProvider.
         //
         boolean useCache = "true".equals(props.getProperty( PageManager.PROP_USECACHE ));
-
+        String classname;
         if( useCache )
         {
-            classname = "org.apache.wiki.providers.CachingAttachmentProvider";
+            classname = CachingAttachmentProvider.class.getName();
         }
         else
         {
@@ -151,7 +169,9 @@ public class AttachmentManager implement
 
             m_provider = (WikiAttachmentProvider) providerclass.newInstance();
 
-            m_provider.initialize(m_engine, props);
+            m_provider.initialize(engine, props);
+            
+            initialized = true;
         } catch( ClassNotFoundException e )
         {
             log.error( "Attachment provider class not found",e);
@@ -175,6 +195,11 @@ public class AttachmentManager implement
             m_provider = null;
         }
     }
+    
+    @Override
+    public boolean isInitialized() {
+    	return initialized;
+    }
 
     /**
      *  Returns true, if attachments are enabled and running.
@@ -280,7 +305,7 @@ public class AttachmentManager implement
             // this can't be an attachment
             if(parentPage.length() == 0) return null;
 
-            currentPage = m_engine.getPage( parentPage );
+            if (context!=null) currentPage = context.getEngine().getPage( parentPage );
 
             //
             // Go check for legacy name
@@ -347,7 +372,7 @@ public class AttachmentManager implement
         //
         if( atts instanceof List )
         {
-            m_engine.getPageSorter().sortPages( (List) atts );
+            m_pageSorter.sortPages( (List) atts );
         }
 
         return atts;
@@ -505,7 +530,7 @@ public class AttachmentManager implement
         //  Checks if the actual, real page exists without any modifications
         //  or aliases.  We cannot store an attachment to a non-existent page.
         //
-        if( !m_engine.getPageManager().pageExists( att.getParentName() ) )
+        if( !m_pageManager.pageExists( att.getParentName() ) )
         {
             // the caller should catch the exception and use the exception text as an i18n key
             throw new ProviderException(  "attach.parent.not.exist"  );
@@ -513,13 +538,13 @@ public class AttachmentManager implement
         
         m_provider.putAttachmentData( att, in );
 
-        m_engine.getReferenceManager().updateReferences( att.getName(),
+        m_referenceManager.updateReferences( att.getName(),
                                                          new java.util.Vector() );
 
         WikiPage parent = new WikiPage( m_engine, att.getParentName() );
         m_engine.updateReferences( parent );
 
-        m_engine.getSearchManager().reindexPage( att );
+        m_searchManager.reindexPage( att );
     }
 
     /**
@@ -604,10 +629,10 @@ public class AttachmentManager implement
         if( m_provider == null ) return;
 
         m_provider.deleteAttachment( att );
+        
+        m_searchManager.pageRemoved( att );
 
-        m_engine.getSearchManager().pageRemoved( att );
-
-        m_engine.getReferenceManager().clearPageEntries( att.getName() );
+        m_referenceManager.clearPageEntries( att.getName() );
 
     }
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthenticationManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthenticationManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthenticationManager.java Mon Jun 29 13:29:39 2015
@@ -44,6 +44,7 @@ import javax.servlet.http.HttpSession;
 import org.apache.commons.io.IOUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.authorize.Role;
@@ -59,7 +60,6 @@ import org.apache.wiki.auth.login.WikiCa
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventManager;
 import org.apache.wiki.event.WikiSecurityEvent;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.util.TextUtil;
 import org.apache.wiki.util.TimedCounterList;
 
@@ -76,7 +76,7 @@ import org.apache.wiki.util.TimedCounter
  * 
  * @since 2.3
  */
-public class AuthenticationManager implements InternalModule {
+public class AuthenticationManager extends WikiInternalModule {
 
     /** How many milliseconds the logins are stored before they're cleaned away. */
     private static final long LASTLOGINS_CLEANUP_TIME = 10*60*1000L; // Ten minutes
@@ -164,8 +164,6 @@ public class AuthenticationManager imple
     /** Static Boolean for lazily-initializing the "allows cookie authentication" flag */
     private boolean                     m_allowsCookieAuthentication = false;
 
-    private WikiEngine                         m_engine            = null;
-    
     /** If true, logs the IP address of the editor */
     private boolean                            m_storeIPAddress    = true;
 
@@ -183,7 +181,7 @@ public class AuthenticationManager imple
     @SuppressWarnings("unchecked")
     public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
-        m_engine = engine;
+    	super.initialize(engine, props);
         m_storeIPAddress = TextUtil.getBooleanProperty( props, PROP_STOREIPADDRESS, m_storeIPAddress );
 
         // Should we allow cookies for assertions? (default: yes)
@@ -210,6 +208,7 @@ public class AuthenticationManager imple
         catch (ClassNotFoundException e)
         {
             e.printStackTrace();
+            log.error(e,e);
             throw new WikiException( "Could not instantiate LoginModule class.", e );
         }
         

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthorizationManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthorizationManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthorizationManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/AuthorizationManager.java Mon Jun 29 13:29:39 2015
@@ -42,6 +42,7 @@ import javax.servlet.http.HttpServletRes
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
@@ -58,12 +59,10 @@ import org.apache.wiki.event.WikiEventLi
 import org.apache.wiki.event.WikiEventManager;
 import org.apache.wiki.event.WikiSecurityEvent;
 import org.apache.wiki.i18n.InternationalizationManager;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.tags.WikiTagBase;
 import org.apache.wiki.util.ClassUtil;
 import org.freshcookies.security.policy.LocalPolicy;
-import org.freshcookies.security.policy.PolicyException;
 
 /**
  * <p>Manages all access control and authorization; determines what authenticated
@@ -97,7 +96,7 @@ import org.freshcookies.security.policy.
  * @since 2.3
  * @see AuthenticationManager
  */
-public class AuthorizationManager implements InternalModule {
+public class AuthorizationManager extends WikiInternalModule {
 
     private static final Logger log = Logger.getLogger( AuthorizationManager.class );
     /**
@@ -121,18 +120,9 @@ public class AuthorizationManager implem
     /** Cache for storing ProtectionDomains used to evaluate the local policy. */
     private Map<Principal, ProtectionDomain>                               m_cachedPds       = new WeakHashMap<Principal, ProtectionDomain>();
 
-    private WikiEngine                        m_engine          = null;
-
     private LocalPolicy                       m_localPolicy     = null;
 
     /**
-     * Constructs a new AuthorizationManager instance.
-     */
-    public AuthorizationManager()
-    {
-    }
-
-    /**
      * Returns <code>true</code> or <code>false</code>, depending on
      * whether a Permission is allowed for the Subject associated with
      * a supplied WikiSession. The access control algorithm works this way:
@@ -460,20 +450,20 @@ public class AuthorizationManager implem
      * @param properties the set of properties used to initialize the wiki engine
      * @throws WikiException if the AuthorizationManager cannot be initialized
      */
-    public void initialize( WikiEngine engine, Properties properties ) throws WikiException
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
-        m_engine = engine;
+        super.initialize(engine, props);
 
         //
         //  JAAS authorization continues
         //
-        m_authorizer = getAuthorizerImplementation( properties );
-        m_authorizer.initialize( engine, properties );
+        m_authorizer = getAuthorizerImplementation( props );
+        m_authorizer.initialize( engine, props );
 
         // Initialize local security policy
         try
         {
-            String policyFileName = properties.getProperty( POLICY, DEFAULT_POLICY );
+            String policyFileName = props.getProperty( POLICY, DEFAULT_POLICY );
             URL policyURL = AuthenticationManager.findConfigFile( engine, policyFileName );
             
             if (policyURL != null) 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java Mon Jun 29 13:29:39 2015
@@ -39,6 +39,7 @@ import org.apache.commons.lang.StringUti
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.ajax.AjaxUtil;
 import org.apache.wiki.ajax.WikiAjaxDispatcherServlet;
@@ -58,7 +59,6 @@ import org.apache.wiki.event.WikiEventMa
 import org.apache.wiki.event.WikiSecurityEvent;
 import org.apache.wiki.filters.SpamFilter;
 import org.apache.wiki.i18n.InternationalizationManager;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.ui.InputValidator;
 import org.apache.wiki.util.ClassUtil;
@@ -77,7 +77,7 @@ import org.apache.wiki.workflow.Workflow
  * Provides a facade for obtaining user information.
  * @since 2.3
  */
-public class UserManager implements InternalModule {
+public class UserManager extends WikiInternalModule {
 
     private static final String USERDATABASE_PACKAGE = "org.apache.wiki.auth.user";
     private static final String SESSION_MESSAGES = "profile";
@@ -87,10 +87,6 @@ public class UserManager implements Inte
     private static final String PARAM_LOGINNAME = "loginname";
     private static final String UNKNOWN_CLASS = "<unknown>";
 
-    private WikiEngine m_engine;
-
-    private static Logger log = Logger.getLogger(UserManager.class);
-
     /** Message key for the "save profile" message. */
     public  static final String SAVE_APPROVER               = "workflow.createUserProfile";
     private static final String PROP_DATABASE               = "jspwiki.userdatabase";
@@ -103,6 +99,8 @@ public class UserManager implements Inte
     protected static final String PREFS_EMAIL               = "prefs.email";
 
     public static final String JSON_USERS = "users";
+    
+    private static Logger log = Logger.getLogger(UserManager.class);
 
     // private static final String  PROP_ACLMANAGER     = "jspwiki.aclManager";
 
@@ -124,9 +122,9 @@ public class UserManager implements Inte
      * @param engine the current wiki engine
      * @param props the wiki engine initialization properties
      */
-    public void initialize( WikiEngine engine, Properties props )
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
-        m_engine = engine;
+        super.initialize(engine, props);
 
         // Attach the PageManager as a listener
         // TODO: it would be better if we did this in PageManager directly

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/AclManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/AclManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/AclManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/AclManager.java Mon Jun 29 13:29:39 2015
@@ -22,13 +22,15 @@ import java.util.Properties;
 
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.WikiSecurityException;
+import org.apache.wiki.modules.InternalModule;
 
 /**
  *  Specifies how to parse and return ACLs from wiki pages.
  *  @since 2.3
  */
-public interface AclManager
+public interface AclManager extends InternalModule
 {
 
     /**
@@ -36,7 +38,7 @@ public interface AclManager
      * @param engine the wiki engine
      * @param props the initialization properties
      */
-    void initialize( WikiEngine engine, Properties props );
+    void initialize( WikiEngine engine, Properties props ) throws WikiException;
 
     /**
      * A helper method for parsing textual AccessControlLists. The line is in

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/acl/DefaultAclManager.java Mon Jun 29 13:29:39 2015
@@ -32,13 +32,14 @@ import java.util.TreeMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.log4j.Logger;
 import org.apache.wiki.PageLock;
 import org.apache.wiki.PageManager;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.exceptions.ProviderException;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.PrincipalComparator;
@@ -52,12 +53,9 @@ import org.apache.wiki.render.RenderingM
  *
  * @since 2.3
  */
-public class DefaultAclManager implements AclManager {
-
-    private static final Logger log = Logger.getLogger(DefaultAclManager.class);
+public class DefaultAclManager extends WikiInternalModule implements AclManager {
 
     private AuthorizationManager m_auth = null;
-    private WikiEngine m_engine = null;
     private static final String PERM_REGEX = "(" +
             PagePermission.COMMENT_ACTION + "|" +
             PagePermission.DELETE_ACTION + "|" +
@@ -75,19 +73,16 @@ public class DefaultAclManager implement
      */
     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)
-     */
-    public void initialize(WikiEngine engine, Properties props) {
-        m_auth = engine.getAuthorizationManager();
-        m_engine = engine;
+    public DefaultAclManager(AuthorizationManager authorizationManager) {
+        m_auth = authorizationManager;
     }
 
+    @Override
+    public void initialize(WikiEngine engine, Properties props) throws WikiException {
+    	super.initialize(engine, props);
+    	m_auth.initialize(engine, props);
+    }
+    
     /**
      * A helper method for parsing textual AccessControlLists. The line is in
      * form "ALLOW <permission> <principal>, <principal>, <principal>". This

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java Mon Jun 29 13:29:39 2015
@@ -29,9 +29,9 @@ import java.util.StringTokenizer;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiSession;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.api.exceptions.WikiException;
@@ -46,7 +46,6 @@ import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventManager;
 import org.apache.wiki.event.WikiSecurityEvent;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.ui.InputValidator;
 import org.apache.wiki.util.ClassUtil;
 
@@ -66,17 +65,13 @@ import org.apache.wiki.util.ClassUtil;
  * </p>
  * @since 2.4.19
  */
-public class GroupManager implements Authorizer, WikiEventListener, InternalModule {
+public class GroupManager extends WikiInternalModule implements Authorizer, WikiEventListener {
 
     /** Key used for adding UI messages to a user's WikiSession. */
     public static final String  MESSAGES_KEY       = "group";
 
     private static final String PROP_GROUPDATABASE = "jspwiki.groupdatabase";
 
-    static final Logger         log                = Logger.getLogger( GroupManager.class );
-
-    protected WikiEngine        m_engine;
-
     protected WikiEventListener m_groupListener;
 
     private GroupDatabase       m_groupDatabase    = null;

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/content/PageRenamer.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/content/PageRenamer.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/content/PageRenamer.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/content/PageRenamer.java Mon Jun 29 13:29:39 2015
@@ -24,10 +24,10 @@ import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.log4j.Logger;
 import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.api.exceptions.WikiException;
@@ -45,11 +45,8 @@ import org.apache.wiki.util.TextUtil;
  *
  *  @since 2.8
  */
-public class PageRenamer
+public class PageRenamer extends WikiInternalModule
 {
-
-    private static final Logger log = Logger.getLogger( PageRenamer.class );
-    
     private boolean m_camelCase = false;
     
     /**

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/diff/DifferenceManager.java Mon Jun 29 13:29:39 2015
@@ -25,15 +25,16 @@ import java.util.Properties;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
-import org.apache.wiki.modules.InternalModule;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.util.ClassUtil;
 
 
 /**
  * Load, initialize and delegate to the DiffProvider that will actually do the work.
  */
-public class DifferenceManager implements InternalModule {
+public class DifferenceManager extends WikiInternalModule {
     private static final Logger log = Logger.getLogger(DifferenceManager.class);
 
     /**
@@ -49,8 +50,11 @@ public class DifferenceManager implement
      * @param engine The WikiEngine.
      * @param props  A set of properties.
      */
-    public void initialize(WikiEngine engine, Properties props) {
-        loadProvider(props);
+    public void initialize(WikiEngine engine, Properties props) throws WikiException {
+    	
+    	super.initialize(engine, props);
+        
+    	loadProvider(props);
 
         initializeProvider(engine, props);
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java Mon Jun 29 13:29:39 2015
@@ -99,8 +99,6 @@ public class DefaultFilterManager extend
 
     private Map< String, PageFilterInfo > m_filterClassMap = new HashMap< String, PageFilterInfo >();
 
-    private static final Logger log = Logger.getLogger(DefaultFilterManager.class);
-
     /**
      *  Constructs a new FilterManager object.
      *  

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/i18n/InternationalizationManager.java Mon Jun 29 13:29:39 2015
@@ -21,11 +21,9 @@ package org.apache.wiki.i18n;
 import java.text.MessageFormat;
 import java.util.Locale;
 import java.util.MissingResourceException;
-import java.util.Properties;
 import java.util.ResourceBundle;
 
-import org.apache.wiki.WikiEngine;
-import org.apache.wiki.modules.InternalModule;
+import org.apache.wiki.WikiInternalModule;
 
 
 /**
@@ -33,7 +31,7 @@ import org.apache.wiki.modules.InternalM
  *
  *  @since 2.6
  */
-public class InternationalizationManager implements InternalModule {
+public class InternationalizationManager extends WikiInternalModule {
 
     /** The name of the ResourceBundle which contains any and all JSPWiki core
      *  resource strings.  It's value is {@value}.
@@ -48,15 +46,6 @@ public class InternationalizationManager
     // public static final String PLUGINS_BUNDLE = "plugins";
 
     /**
-     *  Constructs a new InternationalizationManager.
-     *
-     *  @param engine To which engine this belongs to
-     */
-    public void initialize( WikiEngine engine, Properties props )
-    {
-    }
-
-    /**
      *  Returns a String from the CORE_BUNDLE using English as the default
      *  locale.
      *

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/InternalModule.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/InternalModule.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/InternalModule.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/InternalModule.java Mon Jun 29 13:29:39 2015
@@ -39,4 +39,6 @@ import org.apache.wiki.api.exceptions.Wi
 public interface InternalModule
 {
 	public void initialize(WikiEngine engine, Properties props) throws WikiException;
+	
+	public boolean isInitialized();
 }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/ModuleManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/ModuleManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/ModuleManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/modules/ModuleManager.java Mon Jun 29 13:29:39 2015
@@ -19,16 +19,14 @@
 package org.apache.wiki.modules;
 
 import java.util.Collection;
-import java.util.Properties;
 
 import org.apache.wiki.Release;
-import org.apache.wiki.WikiEngine;
-import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.WikiInternalModule;
 
 /**
  *  Superclass for all JSPWiki managers for modules (plugins, etc).
  */
-public abstract class ModuleManager implements InternalModule
+public abstract class ModuleManager extends WikiInternalModule
 {
 
     /**
@@ -36,10 +34,6 @@ public abstract class ModuleManager impl
      *  (Each plugin should include this property-file in its jar-file)
      */
     public static final String PLUGIN_RESOURCE_LOCATION = "ini/jspwiki_module.xml";
-        
-    protected WikiEngine m_engine;
-    
-    protected Properties m_properties;
     
     private boolean m_loadIncompatibleModules = false;
     
@@ -52,11 +46,6 @@ public abstract class ModuleManager impl
         
     }
     
-    public void initialize( WikiEngine engine, Properties props ) throws WikiException {
-    	m_engine = engine;
-    	m_properties = props;
-    }
-    
     /**
      *  Returns true, if the given module is compatible with this version of JSPWiki.
      *  

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/render/RenderingManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/render/RenderingManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/render/RenderingManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/render/RenderingManager.java Mon Jun 29 13:29:39 2015
@@ -29,15 +29,14 @@ import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
 
-import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventUtils;
 import org.apache.wiki.event.WikiPageEvent;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.parser.JSPWikiMarkupParser;
 import org.apache.wiki.parser.MarkupParser;
 import org.apache.wiki.parser.WikiDocument;
@@ -53,14 +52,10 @@ import org.apache.wiki.parser.WikiDocume
  *
  *  @since  2.4
  */
-public class RenderingManager implements WikiEventListener, InternalModule
+public class RenderingManager extends WikiInternalModule implements WikiEventListener
 {
-    private static Logger log = Logger.getLogger( RenderingManager.class );
-
     private              int    m_cacheExpiryPeriod = 24*60*60; // This can be relatively long
 
-    private          WikiEngine m_engine;
-
     private CacheManager m_cacheManager = CacheManager.getInstance();
 
     /** The capacity of the caches, if you want something else, tweak ehcache.xml. */
@@ -102,10 +97,10 @@ public class RenderingManager implements
      *  @param properties A list of properties to get parameters from.
      *  @throws WikiException If the manager could not be initialized.
      */
-    public void initialize( WikiEngine engine, Properties properties )
+    public void initialize( WikiEngine engine, Properties props )
         throws WikiException
     {
-        m_engine = engine;
+        super.initialize(engine, props);
 
         String documentCacheName = engine.getApplicationName() + "." + DOCUMENTCACHE_NAME;
 
@@ -117,7 +112,7 @@ public class RenderingManager implements
             m_cacheManager.addCache(m_documentCache);
         }
 
-        String renderImplName = properties.getProperty( PROP_RENDERER );
+        String renderImplName = props.getProperty( PROP_RENDERER );
         if( renderImplName == null )
         {
             renderImplName = DEFAULT_RENDERER;

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/rss/RSSGenerator.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/rss/RSSGenerator.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/rss/RSSGenerator.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/rss/RSSGenerator.java Mon Jun 29 13:29:39 2015
@@ -24,9 +24,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.WikiPage;
 import org.apache.wiki.WikiProvider;
 import org.apache.wiki.WikiSession;
@@ -35,7 +35,6 @@ import org.apache.wiki.api.exceptions.Pr
 import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.attachment.Attachment;
 import org.apache.wiki.auth.permissions.PagePermission;
-import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.util.TextUtil;
 import org.apache.wiki.util.comparators.PageTimeComparator;
 
@@ -56,11 +55,8 @@ import org.apache.wiki.util.comparators.
  */
 // FIXME: Limit diff and page content size.
 // FIXME3.0: This class would need a bit of refactoring.  Method names, e.g. are confusing.
-public class RSSGenerator implements InternalModule
+public class RSSGenerator extends WikiInternalModule
 {
-    static Logger              log = Logger.getLogger( RSSGenerator.class );
-    private WikiEngine         m_engine;
-
     private String             m_channelDescription = "";
     private String             m_channelLanguage    = "en-us";
     private boolean            m_enabled = true;
@@ -166,7 +162,7 @@ public class RSSGenerator implements Int
      */
     public void initialize( WikiEngine engine, Properties properties ) throws WikiException
     {
-        m_engine = engine;
+        super.initialize(engine, properties);
 
         // FIXME: This assumes a bit too much.
         if( engine.getBaseURL() == null || engine.getBaseURL().length() == 0 )

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/search/SearchManager.java Mon Jun 29 13:29:39 2015
@@ -44,6 +44,7 @@ import org.apache.wiki.ajax.WikiAjaxServ
 import org.apache.wiki.api.exceptions.FilterException;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.api.exceptions.ProviderException;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.api.filters.BasicPageFilter;
 import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WikiEventListener;
@@ -51,7 +52,6 @@ import org.apache.wiki.event.WikiEventUt
 import org.apache.wiki.event.WikiPageEvent;
 import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.parser.MarkupParser;
-import org.apache.wiki.tags.WikiTagBase;
 import org.apache.wiki.util.ClassUtil;
 import org.apache.wiki.util.TextUtil;
 
@@ -60,9 +60,7 @@ import org.apache.wiki.util.TextUtil;
  *
  *  @since 2.2.21.
  */
-public class SearchManager extends BasicPageFilter implements InternalModule, WikiEventListener {
-
-    private static final Logger log = Logger.getLogger(SearchManager.class);
+public class SearchManager extends BasicPageFilter implements WikiEventListener {
 
     private static final String DEFAULT_SEARCHPROVIDER  = "org.apache.wiki.search.LuceneSearchProvider";
     
@@ -258,9 +256,9 @@ public class SearchManager extends Basic
      * @throws FilterException if the search provider failed to initialize
      */
     public void initialize(WikiEngine engine, Properties properties)
-        throws FilterException
+        throws WikiException
     {
-        m_engine = engine;
+        super.initialize(engine, properties);
 
         loadSearchProvider(properties);
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/admin/DefaultAdminBeanManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/admin/DefaultAdminBeanManager.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/admin/DefaultAdminBeanManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/admin/DefaultAdminBeanManager.java Mon Jun 29 13:29:39 2015
@@ -34,9 +34,9 @@ import javax.management.MalformedObjectN
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectName;
 
-import org.apache.log4j.Logger;
 import org.apache.wiki.Release;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
 import org.apache.wiki.api.engine.AdminBeanManager;
 import org.apache.wiki.api.engine.PluginManager;
 import org.apache.wiki.api.exceptions.WikiException;
@@ -58,21 +58,19 @@ import org.apache.wiki.util.ClassUtil;
  *
  *  @since  2.5.52
  */
-public class DefaultAdminBeanManager implements WikiEventListener, AdminBeanManager {
+public class DefaultAdminBeanManager extends WikiInternalModule implements WikiEventListener, AdminBeanManager {
 	
-    private WikiEngine m_engine;
     private ArrayList< AdminBean >  m_allBeans;
 
     private MBeanServer m_mbeanServer = null;
 
-    private static Logger log = Logger.getLogger(DefaultAdminBeanManager.class);
-
-    public void initialize( WikiEngine engine, Properties props ) {
-        log.info("Using JDK 1.5 Platform MBeanServer");
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException {
+    	super.initialize(engine, props);
+        
+    	log.info("Using JDK 1.5 Platform MBeanServer");
+        
         m_mbeanServer = MBeanServerFactory15.getServer();
 
-        m_engine = engine;
-
         if( m_mbeanServer != null ) {
             log.info( m_mbeanServer.getClass().getName() );
             log.info( m_mbeanServer.getDefaultDomain() );

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/DefaultURLConstructor.java Mon Jun 29 13:29:39 2015
@@ -26,9 +26,10 @@ import java.util.Properties;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.lang.StringUtils;
-
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiInternalModule;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.ui.Command;
 import org.apache.wiki.ui.CommandResolver;
 import org.apache.wiki.util.TextUtil;
@@ -40,11 +41,9 @@ import org.apache.wiki.util.TextUtil;
  *  
  *  @since 2.2
  */
-public class DefaultURLConstructor
+public class DefaultURLConstructor extends WikiInternalModule
     implements URLConstructor
 {
-    protected WikiEngine m_engine;
-
     /**
      *  Contains the absolute path of the JSPWiki Web application without the
      *  actual servlet (which is the m_urlPrefix).
@@ -55,10 +54,8 @@ public class DefaultURLConstructor
      * 
      * {@inheritDoc}
      */
-    public void initialize( WikiEngine engine, 
-                            Properties properties )
-    {
-        m_engine = engine;
+    public void initialize( WikiEngine engine, Properties properties ) throws WikiException {
+        super.initialize(engine, properties);
 
         String baseurl = engine.getBaseURL();
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortURLConstructor.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortURLConstructor.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortURLConstructor.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortURLConstructor.java Mon Jun 29 13:29:39 2015
@@ -24,10 +24,10 @@ import java.util.Properties;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.log4j.Logger;
-
 import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.util.TextUtil;
 
 
@@ -58,7 +58,7 @@ public class ShortURLConstructor
     
     /** {@inheritDoc} */
     public void initialize( WikiEngine engine, 
-                            Properties properties )
+                            Properties properties ) throws WikiException
     {
         super.initialize( engine, properties );
         

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortViewURLConstructor.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortViewURLConstructor.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortViewURLConstructor.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/ShortViewURLConstructor.java Mon Jun 29 13:29:39 2015
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletReq
 
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.api.exceptions.WikiException;
 
 /**
  *  A specific URL constructor that returns easy-to-grok URLs for
@@ -39,7 +40,7 @@ public class ShortViewURLConstructor
      *  {@inheritDoc}
      */
     public void initialize( WikiEngine engine, 
-                            Properties properties )
+                            Properties properties ) throws WikiException
     {
         super.initialize( engine, properties );
     }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/URLConstructor.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/URLConstructor.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/URLConstructor.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/url/URLConstructor.java Mon Jun 29 13:29:39 2015
@@ -18,11 +18,13 @@
  */
 package org.apache.wiki.url;
 
-import java.util.Properties;
 import java.io.IOException;
+import java.util.Properties;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.wiki.WikiEngine;
+import org.apache.wiki.api.exceptions.WikiException;
 
 /**
  *  Provides an interface through which JSPWiki constructs URLs.
@@ -44,7 +46,7 @@ public interface URLConstructor
      *  @param properties Properties used to initialize
      */
     void initialize( WikiEngine engine,
-                            Properties properties );
+                            Properties properties ) throws WikiException;
 
     /**
      *  Constructs the URL with a bunch of parameters.

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/util/ClassUtil.java?rev=1688207&r1=1688206&r2=1688207&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/util/ClassUtil.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/util/ClassUtil.java Mon Jun 29 13:29:39 2015
@@ -37,31 +37,10 @@ import java.util.jar.JarFile;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.apache.wiki.PageManager;
-import org.apache.wiki.ReferenceManager;
-import org.apache.wiki.VariableManager;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.engine.PluginManager;
 import org.apache.wiki.api.exceptions.WikiException;
-import org.apache.wiki.attachment.AttachmentManager;
-import org.apache.wiki.auth.AuthenticationManager;
-import org.apache.wiki.auth.AuthorizationManager;
-import org.apache.wiki.auth.UserManager;
-import org.apache.wiki.auth.acl.DefaultAclManager;
-import org.apache.wiki.auth.authorize.GroupManager;
-import org.apache.wiki.content.PageRenamer;
-import org.apache.wiki.diff.DifferenceManager;
-import org.apache.wiki.filters.DefaultFilterManager;
-import org.apache.wiki.i18n.InternationalizationManager;
 import org.apache.wiki.modules.InternalModule;
-import org.apache.wiki.plugin.DefaultPluginManager;
-import org.apache.wiki.render.RenderingManager;
-import org.apache.wiki.rss.RSSGenerator;
-import org.apache.wiki.search.SearchManager;
-import org.apache.wiki.ui.EditorManager;
-import org.apache.wiki.ui.TemplateManager;
-import org.apache.wiki.ui.admin.DefaultAdminBeanManager;
-import org.apache.wiki.workflow.WorkflowManager;
 import org.jdom2.Element;
 import org.picocontainer.DefaultPicoContainer;
 import org.picocontainer.MutablePicoContainer;
@@ -96,6 +75,7 @@ public final class ClassUtil {
     static {
     	List< Element > nodes = XmlUtil.parse( MAPPINGS, "/classmappings/mapping" );
 
+/*
         picoContainer.addComponent(PageManager.class);
         picoContainer.addComponent(ReferenceManager.class);
         picoContainer.addComponent(VariableManager.class);
@@ -117,19 +97,24 @@ public final class ClassUtil {
         picoContainer.addComponent(InternationalizationManager.class);
         picoContainer.addComponent(PageRenamer.class);
         picoContainer.addComponent(RSSGenerator.class);
-        picoContainer.addComponent(WikiEngine.class);
+//        picoContainer.addComponent(WikiEngine.class);
 //        picoContainer.addComponent(DummyUserDatabase.class);
 //        picoContainer.addComponent(JDBCUserDatabase.class);
 //        picoContainer.addComponent(XMLUserDatabase.class);
-
+*/
         if( nodes.size() > 0 ) {
             for( Iterator< Element > i = nodes.iterator(); i.hasNext(); ) {
                 Element f = i.next();
             
                 String key = f.getChildText("requestedClass");
                 String className = f.getChildText("mappedClass");
-                
-                c_classMappings.put( key, className );
+
+                try {
+                	picoContainer.addComponent(Class.forName(className));
+                } catch (ClassNotFoundException e) {
+                	log.fatal(e,e);
+                }
+//                c_classMappings.put( key, className );
                 
                 log.debug("Mapped class '"+key+"' to class '"+className+"'");
             }
@@ -360,10 +345,17 @@ public final class ClassUtil {
     public static Object getMappedObject( String requestedClass )
         throws WikiException
     {
-        Object[] initargs = {};
-        return getMappedObject(requestedClass, initargs );
+//    	WikiEngine engine = WikiEngine.getInstance(context,null);
+//    	Properties props = engine.getWikiProperties();
+        return getMappedObject(requestedClass, null, null );
     }
 
+    public static <T extends InternalModule> T getInternalModule( Class<T> type, WikiEngine engine, Properties props ) throws WikiException {
+    	InternalModule module = (InternalModule) getPicoContainer().getComponent(type);
+    	module.initialize(engine, props);
+    	return type.cast(module);
+    }
+    
     /**
      *  This method is used to locate and instantiate a mapped class.
      *  You may redefine anything in the resource file which is located in your classpath
@@ -383,22 +375,12 @@ public final class ClassUtil {
      *  @throws WikiException If the class cannot be found or instantiated.  The error is logged.
      *  @since 2.5.40
      */
-    public static Object getMappedObject( String requestedClass, Object... initargs )
+    public static Object getMappedObject( String requestedClass, WikiEngine engine, Properties props )
         throws WikiException
     {
     	try {
     		Object o = ClassUtil.getPicoContainer().getComponent(Class.forName(requestedClass));
-        	WikiEngine engine = null;
-        	Properties props = new Properties();
-			for (int i = 0; i < initargs.length; i++) {
-				if (initargs[i] instanceof WikiEngine) {
-					engine = (WikiEngine)initargs[i];
-				}
-				if (initargs[i] instanceof Properties) {
-					props = (Properties)initargs[i];
-				}
-			}
-			if (engine != null && o instanceof InternalModule) {
+			if (engine != null && props != null && o instanceof InternalModule) {
 				((InternalModule)o).initialize(engine, props);
             }
     		return o;



Mime
View raw message