jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvit...@apache.org
Subject svn commit: r1687038 - in /jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH: ./ jspwiki-war/ jspwiki-war/src/main/java/org/apache/wiki/ jspwiki-war/src/main/java/org/apache/wiki/api/engine/ jspwiki-war/src/main/java/org/apache/wiki/api/filters/ jspwiki-war/sr...
Date Tue, 23 Jun 2015 11:42:14 GMT
Author: dvittor
Date: Tue Jun 23 11:42:14 2015
New Revision: 1687038

URL: http://svn.apache.org/r1687038
Log:
[2.10.2-svn-18] Introducing the PicoContainer for Dependency Injection into the WikiEngine.

Modified:
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/ChangeLog
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/pom.xml
    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/ReferenceManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/Release.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/AdminBeanManager.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/api/filters/PageFilter.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/authorize/GroupManager.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/plugin/DefaultPluginManager.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/EditorManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.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/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/pom.xml

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/ChangeLog
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/ChangeLog?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/ChangeLog (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/ChangeLog Tue Jun 23 11:42:14 2015
@@ -1,3 +1,9 @@
+2015-05-23  David Vittor (dvittor@apache.org)
+
+       * 2.10.2-svn-18
+
+       * Introducing the PicoContainer for Dependency Injection into the WikiEngine
+       
 2015-06-22  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.10.2-svn-17

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/pom.xml
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/pom.xml?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/pom.xml (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/pom.xml Tue Jun 23 11:42:14 2015
@@ -45,6 +45,11 @@
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-highlighter</artifactId>
     </dependency>
+    
+	<dependency>
+		<groupId>org.picocontainer</groupId>
+		<artifactId>picocontainer</artifactId>
+	</dependency>
 
     <dependency>
       <groupId>org.apache.lucene</groupId>

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -165,8 +165,13 @@ public class PageManager extends ModuleM
      * @param props  Properties to use for initialization
      * @throws WikiException If anything goes wrong, you get this.
      */
-    public PageManager(WikiEngine engine, Properties props) throws WikiException {
-        super(engine);
+    public PageManager() {
+    	
+    }
+    
+    @Override
+    public void initialize(WikiEngine engine, Properties props) throws WikiException {
+        super.initialize(engine, props);
         String classname;
         m_engine = engine;
         boolean useCache = "true".equals(props.getProperty(PROP_USECACHE));

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -585,7 +585,7 @@ public class ReferenceManager
         WikiPage page = context.getPage();
 
         updateReferences( page.getName(),
-                          context.getEngine().scanWikiLinks( page, content ) );
+                          getEngine().scanWikiLinks( page, content ) );
 
         serializeAttrsToDisk( page );
     }
@@ -1178,4 +1178,12 @@ public class ReferenceManager
             }
         }
     }
+
+	public WikiEngine getEngine() {
+		return m_engine;
+	}
+
+	public void setEngine(WikiEngine engine) {
+		this.m_engine = engine;
+	}
 }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/Release.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/Release.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/Release.java Tue Jun 23 11:42:14 2015
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "17";
+    public static final String     BUILD         = "18";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of 

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -43,7 +43,7 @@ import org.apache.wiki.preferences.Prefe
  *
  *  @since 1.9.20.
  */
-public class VariableManager
+public class VariableManager implements InternalModule
 {
     private static Logger log = Logger.getLogger( VariableManager.class );
    
@@ -64,7 +64,7 @@ public class VariableManager
      *  Creates a VariableManager object using the property list given.
      *  @param props The properties.
      */
-    public VariableManager( Properties props )
+    public void initialize( WikiEngine engine, Properties props )
     {
     }
 

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -174,6 +174,8 @@ 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;
@@ -390,10 +392,11 @@ public class WikiEngine
      *  @param properties A set of properties to use to initialize this WikiEngine.
      *  @throws WikiException If the initialization fails.
      */
-    public WikiEngine( Properties properties )
+    public WikiEngine( )
         throws WikiException
     {
-        initialize( properties );
+    	m_properties = staticProps;
+//        initialize( properties );
     }
 
     /**
@@ -444,11 +447,12 @@ public class WikiEngine
     /**
      *  Does all the real initialization.
      */
-    private void initialize( Properties props )
+    public void initialize( Properties props )
         throws WikiException
     {
         m_startTime  = new Date();
         m_properties = props;
+        WikiEngine.staticProps = props;
 
         //
         //  Initialize log4j.  However, make sure that we don't initialize it multiple times.
@@ -564,36 +568,30 @@ public class WikiEngine
             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(), props );
-            // m_filterManager     = (FilterManager)ClassUtil.getMappedObject(FilterManager.class.getName(), this, props );
-            m_renderingManager  = (RenderingManager) ClassUtil.getMappedObject(RenderingManager.class.getName());
+            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());
-            m_authorizationManager  = (AuthorizationManager) ClassUtil.getMappedObject( AuthorizationManager.class.getName());
-            m_userManager           = (UserManager) ClassUtil.getMappedObject(UserManager.class.getName());
-            m_groupManager          = (GroupManager) ClassUtil.getMappedObject(GroupManager.class.getName());
+            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_editorManager     = (EditorManager)ClassUtil.getMappedObject(EditorManager.class.getName(), this );
-            m_editorManager.initialize( props );
+            m_editorManager     = (EditorManager)ClassUtil.getMappedObject(EditorManager.class.getName(), this , props );
 
             m_progressManager   = new ProgressManager();
 
             // Initialize the authentication, authorization, user and acl managers
 
-            m_authenticationManager.initialize( this, props );
-            m_authorizationManager.initialize( this, props );
-            m_userManager.initialize( this, props );
-            m_groupManager.initialize( this, props );
             m_aclManager = getAclManager();
 
             // Start the Workflow manager
-            m_workflowMgr = (WorkflowManager)ClassUtil.getMappedObject(WorkflowManager.class.getName());
-            m_workflowMgr.initialize(this, props);
+            m_workflowMgr = (WorkflowManager)ClassUtil.getMappedObject(WorkflowManager.class.getName(), this, props);
 
             m_internationalizationManager = (InternationalizationManager)
-                ClassUtil.getMappedObject(InternationalizationManager.class.getName(),this);
+                ClassUtil.getMappedObject(InternationalizationManager.class.getName(), this, props);
 
             m_templateManager   = (TemplateManager)
                 ClassUtil.getMappedObject(TemplateManager.class.getName(), this, props );
@@ -604,13 +602,13 @@ public class WikiEngine
             // Since we want to use a page filters initilize() method
             // as a engine startup listener where we can initialize global event listeners,
             // it must be called lastly, so that all object references in the engine
-            // are availabe to the initialize() method
-            m_filterManager     = (FilterManager)
-                ClassUtil.getMappedObject(FilterManager.class.getName(), this, props );
+            // are available to the initialize() method
+//            m_filterManager     = (FilterManager)
+//                ClassUtil.getMappedObject(FilterManager.class.getName(), this, props );
 
             // RenderingManager depends on FilterManager events.
 
-            m_renderingManager.initialize( this, props );
+//            m_renderingManager.initialize( this, props );
 
             //
             //  ReferenceManager has the side effect of loading all
@@ -726,6 +724,7 @@ public class WikiEngine
             {
                 m_referenceManager =
                     (ReferenceManager) ClassUtil.getMappedObject(ReferenceManager.class.getName(), this );
+                m_referenceManager.setEngine(this);
                 m_referenceManager.initialize( pages );
             }
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/AdminBeanManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/AdminBeanManager.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/AdminBeanManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/engine/AdminBeanManager.java Tue Jun 23 11:42:14 2015
@@ -22,9 +22,10 @@ package org.apache.wiki.api.engine;
 import java.util.List;
 
 import org.apache.wiki.event.WikiEvent;
+import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.ui.admin.AdminBean;
 
-public interface AdminBeanManager {
+public interface AdminBeanManager extends InternalModule {
 
 	void initialize();
 

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -23,6 +23,7 @@ import java.util.Properties;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
 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
@@ -41,7 +42,7 @@ public class BasicPageFilter
      *  {@inheritDoc}
      */
     public void initialize( WikiEngine engine, Properties properties )
-        throws FilterException
+        throws FilterException, WikiException
     {
         m_engine = engine;
     }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/PageFilter.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/PageFilter.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/PageFilter.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/api/filters/PageFilter.java Tue Jun 23 11:42:14 2015
@@ -23,6 +23,7 @@ import java.util.Properties;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.exceptions.FilterException;
+import org.apache.wiki.api.exceptions.WikiException;
 
 /**
  *  Provides a definition for a page filter.  A page filter is a class
@@ -54,7 +55,7 @@ public interface PageFilter
      *                          the filter is not added to the internal queues.
      */
     void initialize( WikiEngine engine, Properties properties )
-        throws FilterException;
+        throws FilterException, WikiException;
 
     /**
      *  This method is called whenever a page has been loaded from the provider,

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -42,6 +42,7 @@ 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.WikiAttachmentProvider;
 import org.apache.wiki.util.ClassUtil;
@@ -56,7 +57,7 @@ import org.apache.wiki.util.ClassUtil;
  *
  *  @since 1.9.28
  */
-public class AttachmentManager
+public class AttachmentManager implements InternalModule
 {
     /**
      *  The property name for defining the attachment provider class name.
@@ -104,13 +105,12 @@ public class AttachmentManager
      */
 
     // FIXME: Perhaps this should fail somehow.
-    public AttachmentManager( WikiEngine engine, Properties props )
+    public void initialize( WikiEngine engine, Properties props )
     {
         String classname;
 
         m_engine = engine;
 
-
         //
         //  If user wants to use a cache, then we'll use the CachingProvider.
         //

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -59,6 +59,7 @@ 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;
 
@@ -75,7 +76,7 @@ import org.apache.wiki.util.TimedCounter
  * 
  * @since 2.3
  */
-public class AuthenticationManager {
+public class AuthenticationManager implements InternalModule {
 
     /** How many milliseconds the logins are stored before they're cleaned away. */
     private static final long LASTLOGINS_CLEANUP_TIME = 10*60*1000L; // Ten minutes

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -58,6 +58,7 @@ 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;
@@ -96,7 +97,7 @@ import org.freshcookies.security.policy.
  * @since 2.3
  * @see AuthenticationManager
  */
-public class AuthorizationManager {
+public class AuthorizationManager implements InternalModule {
 
     private static final Logger log = Logger.getLogger( AuthorizationManager.class );
     /**

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -58,6 +58,7 @@ 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;
@@ -76,7 +77,7 @@ import org.apache.wiki.workflow.Workflow
  * Provides a facade for obtaining user information.
  * @since 2.3
  */
-public class UserManager {
+public class UserManager implements InternalModule {
 
     private static final String USERDATABASE_PACKAGE = "org.apache.wiki.auth.user";
     private static final String SESSION_MESSAGES = "profile";

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -46,6 +46,7 @@ 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;
 
@@ -65,7 +66,7 @@ import org.apache.wiki.util.ClassUtil;
  * </p>
  * @since 2.4.19
  */
-public class GroupManager implements Authorizer, WikiEventListener {
+public class GroupManager implements Authorizer, WikiEventListener, InternalModule {
 
     /** Key used for adding UI messages to a user's WikiSession. */
     public static final String  MESSAGES_KEY       = "group";

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -26,13 +26,14 @@ import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
+import org.apache.wiki.modules.InternalModule;
 import org.apache.wiki.util.ClassUtil;
 
 
 /**
  * Load, initialize and delegate to the DiffProvider that will actually do the work.
  */
-public class DifferenceManager {
+public class DifferenceManager implements InternalModule {
     private static final Logger log = Logger.getLogger(DifferenceManager.class);
 
     /**
@@ -48,7 +49,7 @@ public class DifferenceManager {
      * @param engine The WikiEngine.
      * @param props  A set of properties.
      */
-    public DifferenceManager(WikiEngine engine, Properties props) {
+    public void initialize(WikiEngine engine, Properties 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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -108,11 +108,10 @@ public class DefaultFilterManager extend
      *  @param props Properties to initialize the FilterManager with
      *  @throws WikiException If something goes wrong.
      */
-    public DefaultFilterManager( WikiEngine engine, Properties props )
-        throws WikiException
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
-        super( engine );
-        initialize( props );
+        super.initialize(engine, props);
+        initialize(props);
     }
 
     /**
@@ -138,7 +137,7 @@ public class DefaultFilterManager extend
         m_pageFilters.add( f, priority );
     }
 
-    private void initPageFilter( String className, Properties props )
+    private void initPageFilter( String className, Properties props ) throws WikiException
     {
         try
         {
@@ -243,7 +242,7 @@ public class DefaultFilterManager extend
      *  
      * @param xmlStream stream to parse
      */
-    private void parseConfigFile( InputStream xmlStream ) {
+    private void parseConfigFile( InputStream xmlStream ) throws WikiException {
     	List< Element > pageFilters = XmlUtil.parse( xmlStream, "/pagefilters/filter" );
         for( Iterator< Element > i = pageFilters.iterator(); i.hasNext(); ) {
             Element f = i.next();

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -21,9 +21,11 @@ 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;
 
 
 /**
@@ -31,7 +33,7 @@ import org.apache.wiki.WikiEngine;
  *
  *  @since 2.6
  */
-public class InternationalizationManager {
+public class InternationalizationManager implements InternalModule {
 
     /** The name of the ResourceBundle which contains any and all JSPWiki core
      *  resource strings.  It's value is {@value}.
@@ -50,7 +52,7 @@ public class InternationalizationManager
      *
      *  @param engine To which engine this belongs to
      */
-    public InternationalizationManager( WikiEngine engine )
+    public void initialize( WikiEngine engine, Properties props )
     {
     }
 

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -19,6 +19,11 @@
 
 package org.apache.wiki.modules;
 
+import java.util.Properties;
+
+import org.apache.wiki.WikiEngine;
+import org.apache.wiki.api.exceptions.WikiException;
+
 /**
  *  This is a simple interface which is implemented by a number of JSPWiki
  *  components to signal that they should not be included in things like
@@ -33,4 +38,5 @@ package org.apache.wiki.modules;
  */
 public interface InternalModule
 {
+	public void initialize(WikiEngine engine, Properties props) throws WikiException;
 }

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -19,14 +19,16 @@
 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;
 
 /**
  *  Superclass for all JSPWiki managers for modules (plugins, etc).
  */
-public abstract class ModuleManager
+public abstract class ModuleManager implements InternalModule
 {
 
     /**
@@ -37,6 +39,8 @@ public abstract class ModuleManager
         
     protected WikiEngine m_engine;
     
+    protected Properties m_properties;
+    
     private boolean m_loadIncompatibleModules = false;
     
     /**
@@ -44,9 +48,13 @@ public abstract class ModuleManager
      *  
      *  @param engine The WikiEngine which owns this manager.
      */
-    public ModuleManager( WikiEngine engine )
-    {
-        m_engine = engine;
+    public ModuleManager(  ) {
+        
+    }
+    
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException {
+    	m_engine = engine;
+    	m_properties = props;
     }
     
     /**

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java Tue Jun 23 11:42:14 2015
@@ -36,6 +36,7 @@ import org.apache.wiki.ajax.WikiAjaxDisp
 import org.apache.wiki.ajax.WikiAjaxServlet;
 import org.apache.wiki.api.engine.PluginManager;
 import org.apache.wiki.api.exceptions.PluginException;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.api.plugin.InitializablePlugin;
 import org.apache.wiki.api.plugin.WikiPlugin;
 import org.apache.wiki.modules.ModuleManager;
@@ -188,8 +189,8 @@ public class DefaultPluginManager extend
      *  @param engine WikiEngine which owns this manager.
      *  @param props Contents of a "jspwiki.properties" file.
      */
-    public DefaultPluginManager( WikiEngine engine, Properties props ) {
-        super( engine );
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException {
+        super.initialize( engine, props );
         String packageNames = props.getProperty( PROP_SEARCHPATH );
 
         if ( packageNames != null ) {

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -32,8 +32,10 @@ import org.apache.wiki.WikiProvider;
 import org.apache.wiki.WikiSession;
 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.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;
 
@@ -54,7 +56,7 @@ 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
+public class RSSGenerator implements InternalModule
 {
     static Logger              log = Logger.getLogger( RSSGenerator.class );
     private WikiEngine         m_engine;
@@ -162,8 +164,7 @@ public class RSSGenerator
      *  @param properties The properties.
      *  @throws NoRequiredPropertyException If something is missing from the given property set.
      */
-    public RSSGenerator( WikiEngine engine, Properties properties )
-        throws NoRequiredPropertyException
+    public void initialize( WikiEngine engine, Properties properties ) throws WikiException
     {
         m_engine = engine;
 

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -88,16 +88,10 @@ public class SearchManager extends Basic
      *  @param properties The list of Properties.
      *  @throws FilterException If it cannot be instantiated.
      */
-    public SearchManager( WikiEngine engine, Properties properties )
+    public SearchManager(  )
         throws FilterException
     {
-        initialize( engine, properties );
 
-        WikiEventUtils.addWikiEventListener(m_engine.getPageManager(),
-                                            WikiPageEvent.PAGE_DELETE_REQUEST, this);
-
-        //TODO: Replace with custom annotations. See JSPWIKI-566
-        WikiAjaxDispatcherServlet.registerServlet( JSON_SEARCH, new JSONSearch() );
     }
 
     /**
@@ -282,6 +276,13 @@ public class SearchManager extends Basic
         {
             log.error( e.getMessage(), e );
         }
+        
+        WikiEventUtils.addWikiEventListener(m_engine.getPageManager(),
+                WikiPageEvent.PAGE_DELETE_REQUEST, this);
+
+		//TODO: Replace with custom annotations. See JSPWIKI-566
+		WikiAjaxDispatcherServlet.registerServlet( JSON_SEARCH, new JSONSearch() );
+
     }
 
     private void loadSearchProvider(Properties properties)

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/EditorManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/EditorManager.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/EditorManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/EditorManager.java Tue Jun 23 11:42:14 2015
@@ -33,6 +33,7 @@ import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.exceptions.NoSuchVariableException;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.modules.ModuleManager;
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.preferences.Preferences;
@@ -81,22 +82,18 @@ public class EditorManager extends Modul
     /** Known attribute name for storing the user edited text inside a session or a page context */
     public static final String       ATTR_EDITEDTEXT = REQ_EDITEDTEXT;
 
-    private             Map<String, WikiEditorInfo>  m_editors;
+    private             Map<String, WikiEditorInfo>  m_editors = new HashMap<String, WikiEditorInfo>();
 
     private static      Logger       log             = Logger.getLogger( EditorManager.class );
 
-    public EditorManager( WikiEngine engine )
-    {
-        super(engine);
-    }
-
     /**
      *  Initializes the EditorManager.  It also registers any editors it can find.
      *
      *  @param props  Properties for setup.
      */
-    public void initialize( Properties props )
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
+    	super.initialize(engine, props);
         registerEditors();
     }
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/ui/TemplateManager.java Tue Jun 23 11:42:14 2015
@@ -48,6 +48,7 @@ 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.i18n.InternationalizationManager;
 import org.apache.wiki.modules.ModuleManager;
 import org.apache.wiki.modules.WikiModuleInfo;
@@ -143,9 +144,9 @@ public class TemplateManager extends Mod
      *  @param engine The owning engine.
      *  @param properties The property list used to initialize this.
      */
-    public TemplateManager( WikiEngine engine, Properties properties )
+    public void initialize( WikiEngine engine, Properties props ) throws WikiException
     {
-        super(engine);
+        super.initialize(engine,props);
 
         //
         //  Uses the unlimited cache.

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Properties;
 
 import javax.management.DynamicMBean;
 import javax.management.InstanceAlreadyExistsException;
@@ -38,14 +39,17 @@ import org.apache.wiki.Release;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.engine.AdminBeanManager;
 import org.apache.wiki.api.engine.PluginManager;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.event.WikiEngineEvent;
 import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.modules.WikiModuleInfo;
+import org.apache.wiki.ui.EditorManager;
 import org.apache.wiki.ui.admin.beans.CoreBean;
 import org.apache.wiki.ui.admin.beans.PluginBean;
 import org.apache.wiki.ui.admin.beans.SearchManagerBean;
 import org.apache.wiki.ui.admin.beans.UserBean;
+import org.apache.wiki.util.ClassUtil;
 
 
 /**
@@ -63,7 +67,7 @@ public class DefaultAdminBeanManager imp
 
     private static Logger log = Logger.getLogger(DefaultAdminBeanManager.class);
 
-    public DefaultAdminBeanManager( WikiEngine engine ) {
+    public void initialize( WikiEngine engine, Properties props ) {
         log.info("Using JDK 1.5 Platform MBeanServer");
         m_mbeanServer = MBeanServerFactory15.getServer();
 
@@ -180,9 +184,14 @@ public class DefaultAdminBeanManager imp
         } catch( NotCompliantMBeanException e ) {
             log.error( e.getMessage(), e );
         }
-        registerBeans( m_engine.getEditorManager().modules() );
-        PluginManager pm = m_engine.getPluginManager();
-        registerBeans( pm.modules() );
+        try {
+	        EditorManager em = (EditorManager)ClassUtil.getMappedObject(EditorManager.class.getName() );
+	        registerBeans( em.modules() );
+	        PluginManager pm = (PluginManager)ClassUtil.getMappedObject(PluginManager.class.getName() );
+	        registerBeans( pm.modules() );
+        } catch (WikiException e) {
+        	e.printStackTrace();
+        }
     }
 
     /* (non-Javadoc)

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=1687038&r1=1687037&r2=1687038&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 Tue Jun 23 11:42:14 2015
@@ -20,8 +20,6 @@ package org.apache.wiki.util;
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -32,15 +30,42 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.jar.JarEntry;
 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;
+import org.picocontainer.PicoContainer;
 
 /**
  *  Contains useful utilities for class file manipulation.  This is a static class,
@@ -58,8 +83,10 @@ public final class ClassUtil {
     public  static final String MAPPINGS = "ini/classmappings.xml";
     
     private static Map<String, String> c_classMappings = new Hashtable<String, String>();
+    
+    private static MutablePicoContainer picoContainer = new DefaultPicoContainer();
 
-    private static boolean classLoaderSetup = false;
+	private static boolean classLoaderSetup = false;
     private static ClassLoader loader = null;
 
 
@@ -69,6 +96,32 @@ 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);
+        picoContainer.addComponent(DefaultFilterManager.class);
+        picoContainer.addComponent(DefaultPluginManager.class);
+        picoContainer.addComponent(DefaultAdminBeanManager.class);
+        picoContainer.addComponent(AttachmentManager.class);
+        picoContainer.addComponent(AuthenticationManager.class);
+        picoContainer.addComponent(AuthorizationManager.class);
+        picoContainer.addComponent(UserManager.class);
+        picoContainer.addComponent(DefaultAclManager.class);
+        picoContainer.addComponent(GroupManager.class);
+        picoContainer.addComponent(DifferenceManager.class);
+        picoContainer.addComponent(RenderingManager.class);
+        picoContainer.addComponent(SearchManager.class);
+        picoContainer.addComponent(EditorManager.class);
+        picoContainer.addComponent(TemplateManager.class);
+        picoContainer.addComponent(WorkflowManager.class);
+        picoContainer.addComponent(InternationalizationManager.class);
+        picoContainer.addComponent(PageRenamer.class);
+        picoContainer.addComponent(RSSGenerator.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();
@@ -333,67 +386,86 @@ public final class ClassUtil {
     public static Object getMappedObject( String requestedClass, Object... initargs )
         throws WikiException
     {
-        try
-        {
-            Class<?> cl = getMappedClass( requestedClass );
-         
-            Constructor<?>[] ctors = cl.getConstructors();
-            
-            //
-            //  Try to find the proper constructor by comparing the
-            //  initargs array classes and the constructor types.
-            //
-            for( int c = 0; c < ctors.length; c++ )
-            {
-                Class<?>[] params = ctors[c].getParameterTypes();
-                
-                if( params.length == initargs.length )
-                {
-                    for( int arg = 0; arg < initargs.length; arg++ )
-                    {
-                        if( params[arg].isAssignableFrom(initargs[arg].getClass()))
-                        {
-                            //
-                            //  Ha, found it!  Instantiating and returning...
-                            //
-                            return ctors[c].newInstance(initargs);
-                        }
-                    }
-                }
-            }
-            
-            //
-            //  No arguments, so we can just call a default constructor and
-            //  ignore the arguments.
-            //
-            Object o = cl.newInstance();
-            
-            return o;
-        }
-        catch( InstantiationException e )
-        {
-            log.info( "Cannot instantiate requested class "+requestedClass, e );
-            
-            throw new WikiException("Failed to instantiate class "+requestedClass, e );
-        }
-        catch (IllegalAccessException e)
-        {
-            log.info( "Cannot access requested class "+requestedClass, e );
-            
-            throw new WikiException("Failed to instantiate class "+requestedClass, e );
-        }
-        catch (IllegalArgumentException e)
-        {
-            log.info( "Illegal arguments when constructing new object", e );
-            
-            throw new WikiException("Failed to instantiate class "+requestedClass, e );
-        }
-        catch (InvocationTargetException e)
-        {
-            log.info( "You tried to instantiate an abstract class "+requestedClass, e );
-            
-            throw new WikiException("Failed to instantiate class "+requestedClass, e );
-        }
+    	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) {
+				((InternalModule)o).initialize(engine, props);
+            }
+    		return o;
+    	} catch (ClassNotFoundException e) {
+    		throw new WikiException(e.getMessage());
+    	}
+//        try
+//        {
+//            Class<?> cl = getMappedClass( requestedClass );
+//         
+//            Constructor<?>[] ctors = cl.getConstructors();
+//            
+//            //
+//            //  Try to find the proper constructor by comparing the
+//            //  initargs array classes and the constructor types.
+//            //
+//            for( int c = 0; c < ctors.length; c++ )
+//            {
+//                Class<?>[] params = ctors[c].getParameterTypes();
+//                
+//                if( params.length == initargs.length )
+//                {
+//                    for( int arg = 0; arg < initargs.length; arg++ )
+//                    {
+//                        if( params[arg].isAssignableFrom(initargs[arg].getClass()))
+//                        {
+//                            //
+//                            //  Ha, found it!  Instantiating and returning...
+//                            //
+//                            return ctors[c].newInstance(initargs);
+//                        }
+//                    }
+//                }
+//            }
+//            
+//            //
+//            //  No arguments, so we can just call a default constructor and
+//            //  ignore the arguments.
+//            //
+//            Object o = cl.newInstance();
+//            
+//            return o;
+//        }
+//        catch( InstantiationException e )
+//        {
+//            log.info( "Cannot instantiate requested class "+requestedClass, e );
+//            
+//            throw new WikiException("Failed to instantiate class "+requestedClass, e );
+//        }
+//        catch (IllegalAccessException e)
+//        {
+//            log.info( "Cannot access requested class "+requestedClass, e );
+//            
+//            throw new WikiException("Failed to instantiate class "+requestedClass, e );
+//        }
+//        catch (IllegalArgumentException e)
+//        {
+//            log.info( "Illegal arguments when constructing new object", e );
+//            
+//            throw new WikiException("Failed to instantiate class "+requestedClass, e );
+//        }
+//        catch (InvocationTargetException e)
+//        {
+//            log.info( "You tried to instantiate an abstract class "+requestedClass, e );
+//            
+//            throw new WikiException("Failed to instantiate class "+requestedClass, e );
+//        }
     }
 
     /**
@@ -427,4 +499,8 @@ public final class ClassUtil {
             throw new WikiException("Failed to instantiate class "+requestedClass, e );
         }
     }
+    
+    public static PicoContainer getPicoContainer() {
+		return picoContainer;
+	}
 }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/workflow/WorkflowManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/workflow/WorkflowManager.java?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/workflow/WorkflowManager.java (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/workflow/WorkflowManager.java Tue Jun 23 11:42:14 2015
@@ -36,6 +36,7 @@ import org.apache.wiki.auth.acl.Unresolv
 import org.apache.wiki.event.WikiEvent;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WorkflowEvent;
+import org.apache.wiki.modules.InternalModule;
 
 
 /**
@@ -45,7 +46,7 @@ import org.apache.wiki.event.WorkflowEve
  * Workflows.
  * </p>
  */
-public class WorkflowManager implements WikiEventListener {
+public class WorkflowManager implements WikiEventListener, InternalModule {
 
     private final DecisionQueue m_queue = new DecisionQueue();
 

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/pom.xml
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/pom.xml?rev=1687038&r1=1687037&r2=1687038&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/pom.xml (original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/pom.xml Tue Jun 23 11:42:14 2015
@@ -175,6 +175,12 @@
         <scope>compile</scope>
         <version>${lucene.version}</version>
       </dependency>
+      
+      <dependency>
+        <groupId>org.picocontainer</groupId>
+        <artifactId>picocontainer</artifactId>
+        <version>2.15</version>
+      </dependency>
 
       <dependency>
         <groupId>org.freshcookies</groupId>



Mime
View raw message