You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/12/23 22:10:27 UTC

svn commit: r729119 - in /james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet: ActionDispatcher.java SieveMailboxMailet.java

Author: rdonkin
Date: Tue Dec 23 13:10:26 2008
New Revision: 729119

URL: http://svn.apache.org/viewvc?rev=729119&view=rev
Log:
Initialise ActionDispatcher in mailet. Better to throw MessagingException since ActionDispatcher is a mailet class.

Modified:
    james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/ActionDispatcher.java
    james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java

Modified: james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/ActionDispatcher.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/ActionDispatcher.java?rev=729119&r1=729118&r2=729119&view=diff
==============================================================================
--- james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/ActionDispatcher.java (original)
+++ james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/ActionDispatcher.java Tue Dec 23 13:10:26 2008
@@ -26,7 +26,6 @@
 
 import javax.mail.MessagingException;
 
-import org.apache.jsieve.exception.SieveException;
 import org.apache.jsieve.mail.Action;
 import org.apache.jsieve.mail.ActionFileInto;
 import org.apache.jsieve.mail.ActionKeep;
@@ -51,7 +50,7 @@
      * Constructor for ActionDispatcher.
      * @throws NoSuchMethodException 
      */
-    public ActionDispatcher() throws SieveException
+    public ActionDispatcher() throws MessagingException
     {
         super();
         setMethodMap(defaultMethodMap());
@@ -106,45 +105,45 @@
      * Returns a new methodMap.
      * @return Map
      */
-    private Map defaultMethodMap() throws SieveException
+    private Map defaultMethodMap() throws MessagingException
     {
         try {
-        Map methodNameMap = new HashMap();
-        methodNameMap.put(
-            ActionFileInto.class,
-            Actions.class.getMethod(
-                "execute",
-                new Class[] {
-                    ActionFileInto.class,
-                    Mail.class,
-                    MailetContext.class }));
-        methodNameMap.put(
-            ActionKeep.class,
-            Actions.class.getMethod(
-                "execute",
-                new Class[] {
-                    ActionKeep.class,
-                    Mail.class,
-                    MailetContext.class }));
-        methodNameMap.put(
-            ActionRedirect.class,
-            Actions.class.getMethod(
-                "execute",
-                new Class[] {
-                    ActionRedirect.class,
-                    Mail.class,
-                    MailetContext.class }));
-        methodNameMap.put(
-            ActionReject.class,
-            Actions.class.getMethod(
-                "execute",
-                new Class[] {
-                    ActionReject.class,
-                    Mail.class,
-                    MailetContext.class }));
-        return methodNameMap;
+            Map methodNameMap = new HashMap();
+            methodNameMap.put(
+                ActionFileInto.class,
+                Actions.class.getMethod(
+                    "execute",
+                    new Class[] {
+                        ActionFileInto.class,
+                        Mail.class,
+                        MailetContext.class }));
+            methodNameMap.put(
+                ActionKeep.class,
+                Actions.class.getMethod(
+                    "execute",
+                    new Class[] {
+                        ActionKeep.class,
+                        Mail.class,
+                        MailetContext.class }));
+            methodNameMap.put(
+                ActionRedirect.class,
+                Actions.class.getMethod(
+                    "execute",
+                    new Class[] {
+                        ActionRedirect.class,
+                        Mail.class,
+                        MailetContext.class }));
+            methodNameMap.put(
+                ActionReject.class,
+                Actions.class.getMethod(
+                    "execute",
+                    new Class[] {
+                        ActionReject.class,
+                        Mail.class,
+                        MailetContext.class }));
+            return methodNameMap;
         } catch (NoSuchMethodException e) {
-            throw new SieveException(e);
+            throw new MessagingException("Require method missing from action.", e);
         }
     }    
 

Modified: james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java?rev=729119&r1=729118&r2=729119&view=diff
==============================================================================
--- james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java (original)
+++ james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java Tue Dec 23 13:10:26 2008
@@ -78,6 +78,8 @@
 
     private SieveFactory factory;
 
+    private ActionDispatcher actionDispatcher;
+
     /**
      * For SDI
      */
@@ -330,8 +332,9 @@
         try
         {
             final InputStream ins = locator.get(relativeUri);
+            
             MailAdapter aMailAdapter = new SieveMailAdapter(aMail,
-                    getMailetContext());
+                    getMailetContext(), actionDispatcher);
             // This logging operation is potentially costly
             if (verbose) {
                 log("Evaluating " + aMailAdapter.toString() + "against \""
@@ -374,5 +377,7 @@
         this.consume = getInitParameter("consume", true);
         this.verbose = getInitParameter("verbose", false);
         this.quiet = getInitParameter("quiet", false);
+        
+        actionDispatcher = new ActionDispatcher();
     }
 }



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