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

[jspwiki] 07/35: rename + extract interface on (Base)ModuleManager

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

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

commit f0205f6f01e8c5bc00573267670ef30c307842bc
Author: juanpablo <ju...@apache.org>
AuthorDate: Mon Mar 2 19:55:39 2020 +0100

    rename + extract interface on (Base)ModuleManager
---
 .../apache/wiki/filters/DefaultFilterManager.java  | 28 +++++---
 .../org/apache/wiki/filters/FilterManager.java     | 24 ++-----
 .../{ModuleManager.java => BaseModuleManager.java} | 24 +------
 .../org/apache/wiki/modules/ModuleManager.java     | 82 +++-------------------
 .../org/apache/wiki/modules/WikiModuleInfo.java    | 28 ++++----
 .../apache/wiki/plugin/DefaultPluginManager.java   |  6 +-
 .../java/org/apache/wiki/plugin/PluginManager.java | 21 +-----
 .../org/apache/wiki/ui/DefaultEditorManager.java   |  4 +-
 .../org/apache/wiki/ui/DefaultTemplateManager.java |  4 +-
 .../java/org/apache/wiki/ui/EditorManager.java     | 14 +---
 .../java/org/apache/wiki/ui/TemplateManager.java   | 14 +---
 11 files changed, 62 insertions(+), 187 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java b/jspwiki-main/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java
index c88e8a4..1d8a341 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/filters/DefaultFilterManager.java
@@ -26,7 +26,7 @@ import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.api.filters.PageFilter;
 import org.apache.wiki.event.WikiEventManager;
 import org.apache.wiki.event.WikiPageEvent;
-import org.apache.wiki.modules.ModuleManager;
+import org.apache.wiki.modules.BaseModuleManager;
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.util.ClassUtil;
 import org.apache.wiki.util.PriorityList;
@@ -84,7 +84,7 @@ import java.util.Properties;
  *
  *  The &lt;filter> -sections define the filters.  For more information, please see the PageFilterConfiguration page in the JSPWiki distribution.
  */
-public class DefaultFilterManager extends ModuleManager implements FilterManager {
+public class DefaultFilterManager extends BaseModuleManager implements FilterManager {
 
     private PriorityList< PageFilter > m_pageFilters = new PriorityList<>();
 
@@ -240,7 +240,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      *
      *  @see PageFilter#preTranslate(WikiContext, String)
      */
-    @Override public String doPreTranslateFiltering( final WikiContext context, String pageData ) throws FilterException {
+    @Override
+    public String doPreTranslateFiltering( final WikiContext context, String pageData ) throws FilterException {
         fireEvent( WikiPageEvent.PRE_TRANSLATE_BEGIN, context );
         for( final PageFilter f : m_pageFilters ) {
             pageData = f.preTranslate( context, pageData );
@@ -260,7 +261,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      *  @return The modified HTML
      *  @see PageFilter#postTranslate(WikiContext, String)
      */
-    @Override public String doPostTranslateFiltering( final WikiContext context, String htmlData ) throws FilterException {
+    @Override
+    public String doPostTranslateFiltering( final WikiContext context, String htmlData ) throws FilterException {
         fireEvent( WikiPageEvent.POST_TRANSLATE_BEGIN, context );
         for( final PageFilter f : m_pageFilters ) {
             htmlData = f.postTranslate( context, htmlData );
@@ -280,7 +282,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      *  @return The modified WikiMarkup
      *  @see PageFilter#preSave(WikiContext, String)
      */
-    @Override public String doPreSaveFiltering( final WikiContext context, String pageData ) throws FilterException {
+    @Override
+    public String doPreSaveFiltering( final WikiContext context, String pageData ) throws FilterException {
         fireEvent( WikiPageEvent.PRE_SAVE_BEGIN, context );
         for( final PageFilter f : m_pageFilters ) {
             pageData = f.preSave( context, pageData );
@@ -300,7 +303,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      *
      *  @see PageFilter#postSave(WikiContext, String)
      */
-    @Override public void doPostSaveFiltering( final WikiContext context, final String pageData ) throws FilterException {
+    @Override
+    public void doPostSaveFiltering( final WikiContext context, final String pageData ) throws FilterException {
         fireEvent( WikiPageEvent.POST_SAVE_BEGIN, context );
         for( final PageFilter f : m_pageFilters ) {
             // log.info("POSTSAVE: "+f.toString() );
@@ -316,7 +320,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      *
      *  @return A List of PageFilter objects
      */
-    @Override public List< PageFilter > getFilterList()
+    @Override
+    public List< PageFilter > getFilterList()
     {
         return m_pageFilters;
     }
@@ -326,7 +331,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      * Notifies PageFilters to clean up their ressources.
      *
      */
-    @Override public void destroy() {
+    @Override
+    public void destroy() {
         for( final PageFilter f : m_pageFilters ) {
             f.destroy( m_engine );
         }
@@ -391,9 +397,8 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
      *  @since 2.6.1
      */
     private static final class PageFilterInfo extends WikiModuleInfo {
-        private PageFilterInfo( final String name )
-        {
-            super(name);
+        private PageFilterInfo( final String name ) {
+            super( name );
         }
 
         protected static PageFilterInfo newInstance( final String className, final Element pluginEl ) {
@@ -406,4 +411,5 @@ public class DefaultFilterManager extends ModuleManager implements FilterManager
             return info;
         }
     }
+
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java b/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java
index d605016..f1d26ed 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/filters/FilterManager.java
@@ -21,13 +21,12 @@ package org.apache.wiki.filters;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.exceptions.FilterException;
 import org.apache.wiki.api.filters.PageFilter;
-import org.apache.wiki.modules.WikiModuleInfo;
+import org.apache.wiki.modules.ModuleManager;
 
-import java.util.Collection;
 import java.util.List;
 
-public interface FilterManager
-{
+public interface FilterManager extends ModuleManager {
+
     /** Property name for setting the filter XML property file.  Value is <tt>{@value}</tt>. */
     String PROP_FILTERXML = "jspwiki.filterConfig";
     
@@ -112,20 +111,5 @@ public interface FilterManager
      * Notifies PageFilters to clean up their ressources.
      */
     void destroy();
-    
-    /**
-     * Returns a collection of modules currently managed by this ModuleManager.  Each
-     * entry is an instance of the {@link WikiModuleInfo} class.  This method should return something
-     * which is safe to iterate over, even if the underlying collection changes.
-     * 
-     * @return A Collection of {@link WikiModuleInfo} instances.
-     */
-    Collection< WikiModuleInfo > modules();
-    
-    /**
-     * Returns the {@link WikiModuleInfo} information about the provided filterName.
-     * @param filterName
-     * @return The WikiModuleInfo
-     */
-    WikiModuleInfo getModuleInfo(String filterName);
+
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java b/jspwiki-main/src/main/java/org/apache/wiki/modules/BaseModuleManager.java
similarity index 71%
copy from jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java
copy to jspwiki-main/src/main/java/org/apache/wiki/modules/BaseModuleManager.java
index d3f6f7d..ffdab86 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/modules/BaseModuleManager.java
@@ -30,10 +30,7 @@ import java.util.TreeSet;
 /**
  *  Superclass for all JSPWiki managers for modules (plugins, etc).
  */
-public abstract class ModuleManager {
-
-    /** Location of the property-files of plugins. (Each plugin should include this property-file in its jar-file) */
-    public static final String PLUGIN_RESOURCE_LOCATION = "ini/jspwiki_module.xml";
+public abstract class BaseModuleManager implements ModuleManager {
 
     protected Engine m_engine;
 
@@ -44,7 +41,7 @@ public abstract class ModuleManager {
      *
      *  @param engine The Engine which owns this manager.
      */
-    public ModuleManager( final Engine engine ) {
+    public BaseModuleManager( final Engine engine ) {
         m_engine = engine;
     }
 
@@ -54,6 +51,7 @@ public abstract class ModuleManager {
      *  @param info The module to check
      *  @return True, if the module is compatible.
      */
+    @Override
     public boolean checkCompatibility( final WikiModuleInfo info ) {
         if( !m_loadIncompatibleModules ) {
             final String minVersion = info.getMinVersion();
@@ -65,15 +63,6 @@ public abstract class ModuleManager {
         return true;
     }
 
-    /**
-     * Returns a collection of modules currently managed by this ModuleManager.  Each
-     * entry is an instance of the WikiModuleInfo class.  This method should return something
-     * which is safe to iterate over, even if the underlying collection changes.
-     *
-     * @return A Collection of WikiModuleInfo instances.
-     */
-    public abstract Collection< WikiModuleInfo > modules();
-
     protected < T extends WikiModuleInfo > Collection< WikiModuleInfo > modules( final Iterator< T > iterator ) {
         final Set< WikiModuleInfo > ls = new TreeSet<>();
         for( final Iterator< T > i = iterator; i.hasNext(); ) {
@@ -86,11 +75,4 @@ public abstract class ModuleManager {
         return ls;
     }
 
-    /**
-     * Returns the {@link WikiModuleInfo} information about the provided moduleName.
-     *
-     * @param moduleName
-     * @return The wikiModuleInfo
-     */
-    public abstract WikiModuleInfo getModuleInfo( final String moduleName );
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java b/jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java
index d3f6f7d..7475092 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/modules/ModuleManager.java
@@ -1,52 +1,12 @@
-/*
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
- */
 package org.apache.wiki.modules;
 
-import org.apache.wiki.Release;
-import org.apache.wiki.api.core.Engine;
-
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.TreeSet;
 
 
-/**
- *  Superclass for all JSPWiki managers for modules (plugins, etc).
- */
-public abstract class ModuleManager {
+public interface ModuleManager {
 
     /** Location of the property-files of plugins. (Each plugin should include this property-file in its jar-file) */
-    public static final String PLUGIN_RESOURCE_LOCATION = "ini/jspwiki_module.xml";
-
-    protected Engine m_engine;
-
-    private boolean m_loadIncompatibleModules = false;
-
-    /**
-     *  Constructs the ModuleManager.
-     *
-     *  @param engine The Engine which owns this manager.
-     */
-    public ModuleManager( final Engine engine ) {
-        m_engine = engine;
-    }
+    String PLUGIN_RESOURCE_LOCATION = "ini/jspwiki_module.xml";
 
     /**
      *  Returns true, if the given module is compatible with this version of JSPWiki.
@@ -54,16 +14,15 @@ public abstract class ModuleManager {
      *  @param info The module to check
      *  @return True, if the module is compatible.
      */
-    public boolean checkCompatibility( final WikiModuleInfo info ) {
-        if( !m_loadIncompatibleModules ) {
-            final String minVersion = info.getMinVersion();
-            final String maxVersion = info.getMaxVersion();
+    boolean checkCompatibility( WikiModuleInfo info );
 
-            return Release.isNewerOrEqual( minVersion ) && Release.isOlderOrEqual( maxVersion );
-        }
-
-        return true;
-    }
+    /**
+     * Returns the {@link WikiModuleInfo} information about the provided moduleName.
+     *
+     * @param moduleName
+     * @return The wikiModuleInfo
+     */
+    WikiModuleInfo getModuleInfo( String moduleName );
 
     /**
      * Returns a collection of modules currently managed by this ModuleManager.  Each
@@ -72,25 +31,6 @@ public abstract class ModuleManager {
      *
      * @return A Collection of WikiModuleInfo instances.
      */
-    public abstract Collection< WikiModuleInfo > modules();
-
-    protected < T extends WikiModuleInfo > Collection< WikiModuleInfo > modules( final Iterator< T > iterator ) {
-        final Set< WikiModuleInfo > ls = new TreeSet<>();
-        for( final Iterator< T > i = iterator; i.hasNext(); ) {
-            final WikiModuleInfo wmi = i.next();
-            if( !ls.contains( wmi ) ) {
-                ls.add( wmi );
-            }
-        }
-
-        return ls;
-    }
+    Collection< WikiModuleInfo > modules();
 
-    /**
-     * Returns the {@link WikiModuleInfo} information about the provided moduleName.
-     *
-     * @param moduleName
-     * @return The wikiModuleInfo
-     */
-    public abstract WikiModuleInfo getModuleInfo( final String moduleName );
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/modules/WikiModuleInfo.java b/jspwiki-main/src/main/java/org/apache/wiki/modules/WikiModuleInfo.java
index e9cc051..8d564ba 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/modules/WikiModuleInfo.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/modules/WikiModuleInfo.java
@@ -86,17 +86,17 @@ public class WikiModuleInfo implements Comparable< WikiModuleInfo > {
      *  @param el The element to parse.
      */
     protected void initializeFromXML( final Element el ) {
-    	m_description        = el.getChildText("description");
-    	m_moduleUrl          = el.getChildText("url");
-    	m_moduleVersion      = el.getChildText("version");
-        m_htmlTemplate       = el.getChildText("template");
-        m_scriptLocation     = el.getChildText("script");
-        m_stylesheetLocation = el.getChildText("stylesheet");
-        m_author             = el.getChildText("author");
-        m_authorUrl          = el.getChildText("authorUrl");
-        m_minVersion         = el.getChildText("minVersion");
-        m_maxVersion         = el.getChildText("maxVersion");
-        m_adminBeanClass     = el.getChildText("adminBean");
+        m_adminBeanClass = el.getChildText( "adminBean" );
+        m_author = el.getChildText( "author" );
+        m_authorUrl = el.getChildText( "authorUrl" );
+        m_description = el.getChildText( "description" );
+        m_maxVersion = el.getChildText( "maxVersion" );
+        m_minVersion = el.getChildText( "minVersion" );
+        m_scriptLocation = el.getChildText( "script" );
+        m_stylesheetLocation = el.getChildText( "stylesheet" );
+        m_htmlTemplate = el.getChildText( "template" );
+        m_moduleUrl = el.getChildText( "url" );
+        m_moduleVersion = el.getChildText( "version" );
     }
 
     /**
@@ -229,7 +229,7 @@ public class WikiModuleInfo implements Comparable< WikiModuleInfo > {
         String spec = m_resource.toString();
     
         // Replace the 'PLUGIN_RESOURCE_LOCATION' with the requested resourceLocation.
-        final int length = ModuleManager.PLUGIN_RESOURCE_LOCATION.length();
+        final int length = BaseModuleManager.PLUGIN_RESOURCE_LOCATION.length();
         spec = spec.substring( 0, spec.length() - length ) + resourceLocation;
     
         final URL url = new URL( spec );
@@ -243,8 +243,8 @@ public class WikiModuleInfo implements Comparable< WikiModuleInfo > {
     /**
      *  {@inheritDoc}
      */
-    public int compareTo( final WikiModuleInfo mod )
-    {
+    @Override
+    public int compareTo( final WikiModuleInfo mod ) {
         return m_name.compareTo( mod.getName() );
     }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
index 5d7aecc..8515af7 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
@@ -37,7 +37,7 @@ import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.PluginException;
 import org.apache.wiki.api.plugin.InitializablePlugin;
 import org.apache.wiki.api.plugin.WikiPlugin;
-import org.apache.wiki.modules.ModuleManager;
+import org.apache.wiki.modules.BaseModuleManager;
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.util.ClassUtil;
@@ -156,11 +156,11 @@ import java.util.StringTokenizer;
  *
  *  @since 1.6.1
  */
-public class DefaultPluginManager extends ModuleManager implements PluginManager {
+public class DefaultPluginManager extends BaseModuleManager implements PluginManager {
 
     private static final String PLUGIN_INSERT_PATTERN = "\\{?(INSERT)?\\s*([\\w\\._]+)[ \\t]*(WHERE)?[ \\t]*";
 
-    private static Logger log = Logger.getLogger( DefaultPluginManager.class );
+    private static final Logger log = Logger.getLogger( DefaultPluginManager.class );
 
     private static final String DEFAULT_FORMS_PACKAGE = "org.apache.wiki.forms";
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/PluginManager.java b/jspwiki-main/src/main/java/org/apache/wiki/plugin/PluginManager.java
index 3a0b330..a8fa7ad 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/PluginManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/PluginManager.java
@@ -22,15 +22,14 @@ 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.WikiModuleInfo;
+import org.apache.wiki.modules.ModuleManager;
 
 import java.io.IOException;
-import java.util.Collection;
 import java.util.Map;
 import java.util.ResourceBundle;
 
 
-public interface PluginManager {
+public interface PluginManager extends ModuleManager {
 
     /** The property name defining which packages will be searched for plugin classes. */
     String PROP_SEARCHPATH = "jspwiki.plugin.searchPath";
@@ -130,22 +129,6 @@ public interface PluginManager {
      * @throws PluginException From the plugin itself, it propagates, waah!
      */
     String execute( WikiContext context, String commandline ) throws PluginException;
-
-    /**
-     * Returns a collection of modules currently managed by this ModuleManager. Each entry is an instance of the {@link WikiModuleInfo}
-     * class. This method should return something which is safe to iterate over, even if the underlying collection changes.
-     * 
-     * @return A Collection of {@link WikiModuleInfo} instances.
-     */
-    Collection< WikiModuleInfo > modules();
-
-    /**
-     * Returns the {@link WikiModuleInfo} information about the provided pluginName.
-     *
-     * @param pluginName
-     * @return The wikiPluginInfo
-     */
-    WikiModuleInfo getModuleInfo(String pluginName);
     
     /**
      * Creates a {@link WikiPlugin}.
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
index 71a1cb4..e91e76a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
@@ -22,7 +22,7 @@ import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.NoSuchVariableException;
-import org.apache.wiki.modules.ModuleManager;
+import org.apache.wiki.modules.BaseModuleManager;
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.util.XmlUtil;
@@ -55,7 +55,7 @@ import java.util.Set;
  *
  *  @since 2.4
  */
-public class DefaultEditorManager extends ModuleManager implements EditorManager {
+public class DefaultEditorManager extends BaseModuleManager implements EditorManager {
 
     private Map< String, WikiEditorInfo > m_editors;
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultTemplateManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultTemplateManager.java
index 85065fe..bdd4044 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultTemplateManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultTemplateManager.java
@@ -23,7 +23,7 @@ import org.apache.log4j.Logger;
 import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Engine;
-import org.apache.wiki.modules.ModuleManager;
+import org.apache.wiki.modules.BaseModuleManager;
 import org.apache.wiki.modules.WikiModuleInfo;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.preferences.Preferences.TimeFormat;
@@ -52,7 +52,7 @@ import java.util.TreeSet;
  *
  *  @since 2.1.62
  */
-public class DefaultTemplateManager extends ModuleManager implements TemplateManager {
+public class DefaultTemplateManager extends BaseModuleManager implements TemplateManager {
 
     private static final Logger log = Logger.getLogger( DefaultTemplateManager.class );
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
index 31b0c80..b39f357 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/EditorManager.java
@@ -19,10 +19,9 @@
 package org.apache.wiki.ui;
 
 import org.apache.wiki.WikiContext;
-import org.apache.wiki.modules.WikiModuleInfo;
+import org.apache.wiki.modules.ModuleManager;
 
 import javax.servlet.jsp.PageContext;
-import java.util.Collection;
 import java.util.Properties;
 
 
@@ -44,7 +43,7 @@ import java.util.Properties;
  *
  *  @since 2.4
  */
-public interface EditorManager {
+public interface EditorManager extends ModuleManager {
 
     /** The property name for setting the editor. Current value is "jspwiki.editor" - not used anymore: replaced by defaultpref.template.editor */
     String PROP_EDITORTYPE = "jspwiki.editor";
@@ -117,13 +116,4 @@ public interface EditorManager {
         return usertext;
     }
 
-    /**
-     * Returns a collection of modules currently managed by this ModuleManager.  Each
-     * entry is an instance of the WikiModuleInfo class.  This method should return something
-     * which is safe to iterate over, even if the underlying collection changes.
-     *
-     * @return A Collection of WikiModuleInfo instances.
-     */
-    Collection< WikiModuleInfo > modules();
-
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java
index 57114d1..c4cf4b8 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/TemplateManager.java
@@ -21,13 +21,12 @@ package org.apache.wiki.ui;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.i18n.InternationalizationManager;
-import org.apache.wiki.modules.WikiModuleInfo;
+import org.apache.wiki.modules.ModuleManager;
 import org.apache.wiki.preferences.Preferences;
 import org.apache.wiki.util.ClassUtil;
 
 import javax.servlet.jsp.PageContext;
 import javax.servlet.jsp.jstl.fmt.LocaleSupport;
-import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -45,7 +44,7 @@ import java.util.Vector;
  *
  *  @since 2.1.62
  */
-public interface TemplateManager {
+public interface TemplateManager extends ModuleManager {
 
     String SKIN_DIRECTORY = "skins";
 
@@ -193,15 +192,6 @@ public interface TemplateManager {
     Map< String, String > listTimeFormats( final PageContext pageContext );
 
     /**
-     * Returns a collection of modules currently managed by this ModuleManager.  Each
-     * entry is an instance of the WikiModuleInfo class.  This method should return something
-     * which is safe to iterate over, even if the underlying collection changes.
-     *
-     * @return A Collection of WikiModuleInfo instances.
-     */
-    Collection< WikiModuleInfo > modules();
-
-    /**
      * List all timezones, with special marker for server timezone
      *
      * @param pageContext page context