james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r691041 - in /james/jsieve/trunk/src: main/java/org/apache/jsieve/ test/java/org/apache/jsieve/junit/ test/java/org/apache/jsieve/junit/utils/ test/java/org/apache/jsieve/util/check/
Date Mon, 01 Sep 2008 19:55:53 GMT
Author: rdonkin
Date: Mon Sep  1 12:55:52 2008
New Revision: 691041

URL: http://svn.apache.org/viewvc?rev=691041&view=rev
Log:
SieveFactory is no longer a singleton. JSIEVE-31.

Modified:
    james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java
    james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java
    james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/utils/JUnitUtils.java
    james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptChecker.java

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=691041&r1=691040&r2=691041&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 Mon Sep  1 12:55:52
2008
@@ -60,11 +60,6 @@
 public class SieveFactory {
 
     /**
-     * The sole instance of the receiver.
-     */
-    private static SieveFactory fieldInstance;
-
-    /**
      * Constructor for SieveFactory.
      */
     public SieveFactory() {
@@ -180,54 +175,4 @@
             throws ParseException, SieveException {
         evaluate(mail, parse(inputStream));
     }
-
-    /**
-     * Returns the instance of the receiver, lazily initialised if required.
-     * 
-     * @return SieveFactory
-     */
-    public static synchronized SieveFactory getInstance() {
-        SieveFactory instance = null;
-        if (null == (instance = getInstanceBasic())) {
-            updateInstance();
-            return getInstance();
-        }
-        return instance;
-    }
-
-    /**
-     * Computes an instance of the receiver.
-     * 
-     * @return SieveFactory
-     */
-    public static SieveFactory computeInstance() {
-        return new SieveFactory();
-    }
-
-    /**
-     * Returns the instance of the receiver.
-     * 
-     * @return SieveFactory
-     */
-    private static SieveFactory getInstanceBasic() {
-        return fieldInstance;
-    }
-
-    /**
-     * Sets the instance of the receiver.
-     * 
-     * @param instance
-     *                The instance to set
-     */
-    protected static void setInstance(SieveFactory instance) {
-        fieldInstance = instance;
-    }
-
-    /**
-     * Updates the instance of the receiver.
-     */
-    protected static void updateInstance() {
-        setInstance(computeInstance());
-    }
-
 }

Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java?rev=691041&r1=691040&r2=691041&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/AddressTest.java Mon Sep  1 12:55:52
2008
@@ -23,8 +23,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.jsieve.CommandManager;
-import org.apache.jsieve.TestManager;
 import org.apache.jsieve.exception.SieveException;
 import org.apache.jsieve.junit.commands.ThrowTestException;
 import org.apache.jsieve.junit.utils.JUnitUtils;
@@ -45,10 +43,6 @@
         super(arg0);
     }
 
-    public static void main(String[] args) {
-        junit.swingui.TestRunner.run(AddressTest.class);
-    }
-
     /**
      * @see TestCase#setUp()
      */

Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/utils/JUnitUtils.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/utils/JUnitUtils.java?rev=691041&r1=691040&r2=691041&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/utils/JUnitUtils.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/junit/utils/JUnitUtils.java Mon Sep
 1 12:55:52 2008
@@ -46,7 +46,7 @@
     static public void interpret(MailAdapter mail, String script)
         throws SieveException, ParseException
     {
-        SieveFactory.getInstance().interpret(
+        new SieveFactory().interpret(
             mail,
             new ByteArrayInputStream(script.getBytes()));
     }
@@ -61,7 +61,7 @@
     static public void parse(String script)
         throws SieveException, ParseException
     {
-        SieveFactory.getInstance().parse(
+        new SieveFactory().parse(
             new ByteArrayInputStream(script.getBytes()));
     }
     

Modified: james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptChecker.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptChecker.java?rev=691041&r1=691040&r2=691041&view=diff
==============================================================================
--- james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptChecker.java (original)
+++ james/jsieve/trunk/src/test/java/org/apache/jsieve/util/check/ScriptChecker.java Mon Sep
 1 12:55:52 2008
@@ -85,7 +85,7 @@
         adapter.setMail(mimeMessage);
         Results results;
         try {
-            SieveFactory.getInstance().interpret(adapter, script);
+            new SieveFactory().interpret(adapter, script);
             final List executedActions = adapter.getExecutedActions();
             results = new Results(executedActions);
         } catch (ParseException e) {



---------------------------------------------------------------------
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