james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r690776 - in /james/jsieve/trunk/src: main/java/org/apache/jsieve/ test/java/org/apache/jsieve/ test/java/org/apache/jsieve/junit/
Date Sun, 31 Aug 2008 19:52:36 GMT
Author: rdonkin
Date: Sun Aug 31 12:52:36 2008
New Revision: 690776

URL: http://svn.apache.org/viewvc?rev=690776&view=rev
Log:
ConfigurationManager builds ComparatorManager

Modified:
    james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java
    james/jsieve/trunk/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
    james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java?rev=690776&r1=690775&r2=690776&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java Sun Aug 31 12:52:36
2008
@@ -29,73 +29,15 @@
  * configured Comparator implementation classes.
  */
 public class ComparatorManager {
-    /**
-     * The sole instance of the receiver.
-     */
-    static private ComparatorManager fieldInstance;
+    
+    private final Map comparators;
 
     /**
      * Constructor for ComparatorManager.
      */
-    private ComparatorManager() {
+    public ComparatorManager(final Map comparators) {
         super();
-    }
-
-    /**
-     * Returns the sole instance of the receiver, lazily initialised if
-     * required.
-     * 
-     * @return ComparatorManager
-     */
-    public static synchronized ComparatorManager getInstance() {
-        ComparatorManager current = null;
-        if (null == (current = getInstanceBasic())) {
-            updateInstance();
-            return getInstance();
-        }
-        return current;
-    }
-
-    /**
-     * Returns the sole instance of the receiver.
-     * 
-     * @return ComparatorManager
-     */
-    private static ComparatorManager getInstanceBasic() {
-        return fieldInstance;
-    }
-
-    /**
-     * Computes a new instance of the receiver.
-     * 
-     * @return ComparatorManager
-     */
-    protected static ComparatorManager computeInstance() {
-        return new ComparatorManager();
-    }
-
-    /**
-     * Sets the sole instance.
-     * 
-     * @param instance
-     *                The current instance to set
-     */
-    protected static void setInstance(ComparatorManager instance) {
-        fieldInstance = instance;
-    }
-
-    /**
-     * Resets the sole instance.
-     */
-    public static void resetInstance() {
-        setInstance(null);
-    }
-
-    /**
-     * Updates the sole instance.
-     */
-    protected static void updateInstance() {
-        setInstance(computeInstance());
+        this.comparators = comparators;
     }
 
     /**
@@ -178,7 +120,7 @@
      * @throws SieveConfigurationException
      */
     protected Map getClassNameMap() throws SieveConfigurationException {
-        return ConfigurationManager.getInstance().getComparatorMap();
+        return comparators;
     }
 
 }

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java?rev=690776&r1=690775&r2=690776&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java Sun Aug 31
12:52:36 2008
@@ -276,5 +276,9 @@
     protected synchronized void setComparatorMap(Map comparatorMap) {
         fieldComparatorMap = comparatorMap;
     }
+    
+    public ComparatorManager getComparatorManager() {
+        return new ComparatorManager(fieldComparatorMap);
+    }
 
 }

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java?rev=690776&r1=690775&r2=690776&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java Sun Aug 31 12:52:36
2008
@@ -130,7 +130,7 @@
     public void evaluate(MailAdapter mail, Node startNode)
             throws SieveException {
         final CommandManager commandManager = CommandManager.getInstance();
-        final ComparatorManager comparatorManager = ComparatorManager.getInstance();
+        final ComparatorManager comparatorManager = ConfigurationManager.getInstance().getComparatorManager();
         final TestManager testManager = TestManager.getInstance();
         final Log log = ConfigurationManager.log;
         SieveContext context = new BaseSieveContext(commandManager, comparatorManager, testManager,
log);

Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java?rev=690776&r1=690775&r2=690776&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
(original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/SieveParserVisitorImplQuoteTest.java
Sun Aug 31 12:52:36 2008
@@ -35,7 +35,7 @@
     
     protected void setUp() throws Exception {
         super.setUp();
-        visitor = new SieveParserVisitorImpl(new BaseSieveContext(CommandManager.getInstance(),
ComparatorManager.getInstance(),
+        visitor = new SieveParserVisitorImpl(new BaseSieveContext(CommandManager.getInstance(),
ConfigurationManager.getInstance().getComparatorManager(),
                 TestManager.getInstance(), LogFactory.getLog(SieveParserVisitorImplQuoteTest.class)));
         data = new ArrayList();
         node = new ASTstring(100);

Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java?rev=690776&r1=690775&r2=690776&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressParseTest.java Sun Aug
31 12:52:36 2008
@@ -24,7 +24,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jsieve.BaseSieveContext;
 import org.apache.jsieve.CommandManager;
-import org.apache.jsieve.ComparatorManager;
+import org.apache.jsieve.ConfigurationManager;
 import org.apache.jsieve.TestManager;
 import org.apache.jsieve.junit.utils.JUnitUtils;
 import org.apache.jsieve.junit.utils.SieveMailAdapter;
@@ -42,7 +42,8 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        context = new BaseSieveContext(CommandManager.getInstance(), ComparatorManager.getInstance(),
TestManager.getInstance(),
+        context = new BaseSieveContext(CommandManager.getInstance(), ConfigurationManager.getInstance().getComparatorManager(),

+                TestManager.getInstance(),
                 LogFactory.getLog(AddressParseTest.class));
         mail = (SieveMailAdapter) JUnitUtils.createMail();
         address = new OpenedAddress();



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message