james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1051885 - in /james/server/trunk: container-spring/src/main/config/james/context/ mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/ mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/ mailetcon...
Date Wed, 22 Dec 2010 13:11:51 GMT
Author: norman
Date: Wed Dec 22 13:11:50 2010
New Revision: 1051885

URL: http://svn.apache.org/viewvc?rev=1051885&view=rev
Log:
Remove MailetContainer and CompositeMailProcessor api. This both are not really part of the
api but some kind of implementations

Added:
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java
      - copied, changed from r1051862, james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeMailProcessor.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java
      - copied, changed from r1051800, james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContainer.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java
      - copied, changed from r1051767, james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailetProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java
      - copied, changed from r1051862, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeMailProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java
      - copied, changed from r1051800, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetContainer.java
Removed:
    james/server/trunk/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/CompositeMailProcessor.java
    james/server/trunk/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/CompositeMailProcessorListener.java
    james/server/trunk/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MailetContainer.java
    james/server/trunk/mailetcontainer-api/src/main/java/org/apache/james/mailetcontainer/api/MailetContainerListener.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeMailProcessor.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContainer.java
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailetProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeMailProcessor.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetContainer.java
Modified:
    james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
    james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailProcessorManagement.java

Modified: james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml?rev=1051885&r1=1051884&r2=1051885&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
(original)
+++ james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
Wed Dec 22 13:11:50 2010
@@ -184,7 +184,7 @@
     <!-- 
       Mailet Container Beans.
      -->
-    <bean id="mailprocessor" name="processorRoute" class="org.apache.james.mailetcontainer.camel.CamelCompositeMailProcessor"/>
+    <bean id="mailprocessor" name="processorRoute" class="org.apache.james.mailetcontainer.camel.CamelCompositeProcessor"/>
     <!-- 
       mailcontext bean must be defined after mailProcessor 
       otherwise LogEnabled injection via LogEnabledBeanPostProcessor will not occur before


Copied: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java
(from r1051862, james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeMailProcessor.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java?p2=james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java&p1=james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeMailProcessor.java&r1=1051862&r2=1051885&rev=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeMailProcessor.java
(original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessor.java
Wed Dec 22 13:11:50 2010
@@ -25,11 +25,10 @@ import javax.annotation.Resource;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.james.mailetcontainer.api.CompositeMailProcessor;
 import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.api.MailetLoader;
 import org.apache.james.mailetcontainer.api.MatcherLoader;
-import org.apache.james.mailetcontainer.lib.AbstractCompositeMailProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractCompositeProcessor;
 import org.apache.james.mailetcontainer.lib.matchers.CompositeMatcher;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
@@ -39,13 +38,13 @@ import org.apache.mailet.Matcher;
 /**
  * Build up the Camel Routes by parsing the mailetcontainer.xml configuration file. 
  * 
- * It also offer the {@link CompositeMailProcessor} implementation which allow to inject
{@link Mail} into the routes.
+ * It also offer the {@link CompositeProcessor} implementation which allow to inject {@link
Mail} into the routes.
  *
  * Beside the basic {@link Mailet} / {@link Matcher} support this implementation also supports
{@link CompositeMatcher} implementations.
  * See JAMES-948 
  * 
  */
-public class CamelCompositeMailProcessor extends AbstractCompositeMailProcessor implements
CamelContextAware{
+public class CamelCompositeProcessor extends AbstractCompositeProcessor implements CamelContextAware{
 
     private CamelContext camelContext;
     private MailetContext mailetContext;
@@ -105,7 +104,7 @@ public class CamelCompositeMailProcessor
      * @see org.apache.james.mailetcontainer.lib.AbstractCompositeMailProcessor#createMailProcessor(java.lang.String,
org.apache.commons.configuration.HierarchicalConfiguration)
      */
     protected MailProcessor createMailProcessor(String name, HierarchicalConfiguration config)
throws Exception{
-        CamelMailetContainer container = new CamelMailetContainer();
+        CamelMailetProcessor container = new CamelMailetProcessor();
         container.setLog(logger);
         container.setCamelContext(camelContext);
         container.setMailetContext(mailetContext);
@@ -121,8 +120,8 @@ public class CamelCompositeMailProcessor
         String names[] = getProcessorNames();
         for (int i = 0; i < names.length; i++) {
             MailProcessor processor = getProcessor(names[i]);
-            if (processor instanceof CamelMailetContainer) {
-                ((CamelMailetContainer) processor).destroy();
+            if (processor instanceof CamelMailetProcessor) {
+                ((CamelMailetProcessor) processor).destroy();
             }
 
         }

Copied: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java
(from r1051800, james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContainer.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java?p2=james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java&p1=james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContainer.java&r1=1051800&r2=1051885&rev=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetContainer.java
(original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java
Wed Dec 22 13:11:50 2010
@@ -33,7 +33,7 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
 import org.apache.commons.logging.Log;
-import org.apache.james.mailetcontainer.lib.AbstractMailetContainer;
+import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor;
 import org.apache.james.mailetcontainer.lib.MailetConfigImpl;
 import org.apache.james.mailetcontainer.lib.MatcherMailetPair;
 import org.apache.mailet.Mail;
@@ -43,10 +43,10 @@ import org.apache.mailet.Matcher;
 
 
 /**
- * {@link AbstractMailetContainer} implementation which use Camel DSL for the {@link Matcher}
/ {@link Mailet} routing
+ * {@link AbstractMailetProcessor} implementation which use Camel DSL for the {@link Matcher}
/ {@link Mailet} routing
  *
  */
-public class CamelMailetContainer extends AbstractMailetContainer implements CamelContextAware{
+public class CamelMailetProcessor extends AbstractMailetProcessor implements CamelContextAware{
 
     private CamelContext context;
 
@@ -159,10 +159,10 @@ public class CamelMailetContainer extend
                     onMatchException = ((MailetConfigImpl) mailetConfig).getInitAttribute("onMatchException");
                 }
                 
-                MailetProcessor mailetProccessor = new MailetProcessor(mailet, logger, CamelMailetContainer.this);
+                CamelProcessor mailetProccessor = new CamelProcessor(mailet, logger, CamelMailetProcessor.this);
                 // Store the matcher to use for splitter in properties
                 processorDef
-                    .setProperty(MatcherSplitter.MATCHER_PROPERTY, constant(matcher)).setProperty(MatcherSplitter.ON_MATCH_EXCEPTION_PROPERTY,
constant(onMatchException)).setProperty(MatcherSplitter.MAILETCONTAINER_PROPERTY, constant(CamelMailetContainer.this))
+                    .setProperty(MatcherSplitter.MATCHER_PROPERTY, constant(matcher)).setProperty(MatcherSplitter.ON_MATCH_EXCEPTION_PROPERTY,
constant(onMatchException)).setProperty(MatcherSplitter.MAILETCONTAINER_PROPERTY, constant(CamelMailetProcessor.this))
                    
                     // do splitting of the mail based on the stored matcher
                     .split().method(MatcherSplitter.class).aggregationStrategy(aggr).parallelProcessing()
@@ -178,7 +178,7 @@ public class CamelMailetContainer extend
 
             
             
-            Processor terminatingMailetProcessor = new MailetProcessor(new TerminatingMailet(),
getLogger(), CamelMailetContainer.this);
+            Processor terminatingMailetProcessor = new CamelProcessor(new TerminatingMailet(),
getLogger(), CamelMailetProcessor.this);
 
             
             processorDef

Copied: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java
(from r1051767, james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailetProcessor.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java?p2=james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java&p1=james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailetProcessor.java&r1=1051767&r2=1051885&rev=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MailetProcessor.java
(original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java
Wed Dec 22 13:11:50 2010
@@ -26,8 +26,7 @@ import javax.mail.MessagingException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.commons.logging.Log;
-import org.apache.james.mailetcontainer.api.MailetContainer;
-import org.apache.james.mailetcontainer.api.MailetContainerListener;
+import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.MailetConfigImpl;
 import org.apache.james.mailetcontainer.lib.ProcessorUtil;
 import org.apache.mailet.Mail;
@@ -38,21 +37,21 @@ import org.apache.mailet.MailetConfig;
  * Mailet wrapper which execute a Mailet in a Processor
  *
  */
-public class MailetProcessor implements Processor{
+public class CamelProcessor implements Processor{
 
     private Mailet mailet;
     private Log logger;
-    private MailetContainer container;
+    private CamelMailetProcessor processor;
     
     /**
      * Mailet to call on process
      * 
      * @param mailet
      */
-    public MailetProcessor(Mailet mailet, Log logger, MailetContainer container) {
+    public CamelProcessor(Mailet mailet, Log logger, CamelMailetProcessor container) {
         this.mailet = mailet;
         this.logger = logger;
-        this.container = container;
+        this.processor = processor;
     }
     
     /**
@@ -88,10 +87,10 @@ public class MailetProcessor implements 
             }
 
         } finally {
-            List<MailetContainerListener> listeners = container.getListeners();
+            List<MailetProcessorListener> listeners = processor.getListeners();
             long complete = System.currentTimeMillis() - start;
             for (int i = 0; i < listeners.size(); i++) {
-                MailetContainerListener listener = listeners.get(i);
+                MailetProcessorListener listener = listeners.get(i);
                 listener.afterMailet(mailet, mail.getName(), mail.getState(), complete, ex);
             }
         }

Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java?rev=1051885&r1=1051884&r2=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java
(original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java
Wed Dec 22 13:11:50 2010
@@ -33,8 +33,7 @@ import org.apache.camel.InOnly;
 import org.apache.camel.Property;
 import org.apache.commons.logging.Log;
 import org.apache.james.core.MailImpl;
-import org.apache.james.mailetcontainer.api.MailetContainer;
-import org.apache.james.mailetcontainer.api.MailetContainerListener;
+import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.ProcessorUtil;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
@@ -78,7 +77,7 @@ public class MatcherSplitter {
      */
     @SuppressWarnings("unchecked")
     @Handler
-    public List<Mail> split(@Property(MATCHER_PROPERTY) Matcher matcher, @Property(ON_MATCH_EXCEPTION_PROPERTY)
String onMatchException, @Property(LOGGER_PROPERTY) Log logger, @Property(MAILETCONTAINER_PROPERTY)
MailetContainer container,
+    public List<Mail> split(@Property(MATCHER_PROPERTY) Matcher matcher, @Property(ON_MATCH_EXCEPTION_PROPERTY)
String onMatchException, @Property(LOGGER_PROPERTY) Log logger, @Property(MAILETCONTAINER_PROPERTY)
CamelMailetProcessor container,
             @Body Mail mail) throws MessagingException {
         Collection<MailAddress> matchedRcpts = null;
         Collection<MailAddress> origRcpts = new ArrayList<MailAddress>(mail.getRecipients());
@@ -164,9 +163,9 @@ public class MatcherSplitter {
         } finally {
 
             long complete = System.currentTimeMillis() - start;
-            List<MailetContainerListener> listeners = container.getListeners();
+            List<MailetProcessorListener> listeners = container.getListeners();
             for (int i = 0; i < listeners.size(); i++) {
-                MailetContainerListener listener = listeners.get(i);
+                MailetProcessorListener listener = listeners.get(i);
                 if (matchedRcpts.isEmpty()) {
                     listener.afterMatcher(matcher, mail.getName(), origRcpts, null,  complete,
ex);
                 } else {

Copied: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java
(from r1051862, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeMailProcessor.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java?p2=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java&p1=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeMailProcessor.java&r1=1051862&r2=1051885&rev=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeMailProcessor.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractCompositeProcessor.java
Wed Dec 22 13:11:50 2010
@@ -36,20 +36,18 @@ import org.apache.james.lifecycle.api.Co
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.mailetcontainer.api.CompositeMailProcessor;
-import org.apache.james.mailetcontainer.api.CompositeMailProcessorListener;
 import org.apache.james.mailetcontainer.api.jmx.ProcessorManagementMBean;
 import org.apache.james.mailetcontainer.lib.jmx.JMXCompositeMailProcessorListener;
 import org.apache.mailet.Mail;
 
 /**
- * Abstract base class for {@link CompositeMailProcessor} which service the {@link Mail}
with a {@link MailetContainer} instances
+ * Abstract base class for {@link CompositeProcessor} which service the {@link Mail} with
a {@link CamelProcessor} instances
  * 
  *
  */
-public abstract class AbstractCompositeMailProcessor implements CompositeMailProcessor, Configurable,
LogEnabled, ProcessorManagementMBean{
+public abstract class AbstractCompositeProcessor implements MailProcessor, Configurable,
LogEnabled, ProcessorManagementMBean{
 
-    private List<CompositeMailProcessorListener> listeners = Collections.synchronizedList(new
ArrayList<CompositeMailProcessorListener>());
+    private List<CompositeProcessorListener> listeners = Collections.synchronizedList(new
ArrayList<CompositeProcessorListener>());
     private final Map<String,MailProcessor> processors = new HashMap<String,MailProcessor>();
     protected Log logger;
     protected HierarchicalConfiguration config;
@@ -67,29 +65,17 @@ public abstract class AbstractCompositeM
     }
     
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.CompositeMailProcessor#addListener(org.apache.james.mailetcontainer.api.CompositeMailProcessorListener)
-     */
-    public void addListener(CompositeMailProcessorListener listener) {
+    public void addListener(CompositeProcessorListener listener) {
         listeners.add(listener);
     }
     
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.CompositeMailProcessor#getListeners()
-     */
-    public List<CompositeMailProcessorListener> getListeners() {
+    public List<CompositeProcessorListener> getListeners() {
         return listeners;
     }
     
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.CompositeMailProcessor#removeListener(org.apache.james.mailetcontainer.api.CompositeMailProcessorListener)
-     */
-    public void removeListener(CompositeMailProcessorListener listener) {
+    public void removeListener(CompositeProcessorListener listener) {
         listeners.remove(listener);
     }
     
@@ -133,7 +119,7 @@ public abstract class AbstractCompositeM
             } finally {
                 long end = System.currentTimeMillis() - start;
                 for (int i = 0; i < listeners.size(); i++) {
-                    CompositeMailProcessorListener listener = listeners.get(i);
+                    CompositeProcessorListener listener = listeners.get(i);
                     
                     listener.afterProcessor(processor, mail.getName(), end, ex);
                 } 
@@ -143,9 +129,11 @@ public abstract class AbstractCompositeM
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.transport.ProcessorList#getProcessor(java.lang.String)
+    /**
+     * Return a {@link MailProcessor} for a given name
+     * 
+     * @param name
+     * @return processor
      */
     public MailProcessor getProcessor(String name) {
         return processors.get(name);
@@ -197,6 +185,10 @@ public abstract class AbstractCompositeM
             final HierarchicalConfiguration processorConf = processorConfs.get(i);
             String processorName = processorConf.getString("[@name]");
             
+            // if the "child" processor has no jmx config we just use the one of the composite
+            if (processorConf.containsKey("[@enableJmx]") == false) {
+                processorConf.addProperty("[@enableJmx]", enableJmx);
+            }
             processors.put(processorName, createMailProcessor(processorName, processorConf));
         }
         
@@ -228,4 +220,23 @@ public abstract class AbstractCompositeM
      */
     protected abstract MailProcessor createMailProcessor(String name, HierarchicalConfiguration
config) throws Exception;
     
+    
+    /**
+     * A Listener which will get called after {@link CompositeProcessor#service(org.apache.mailet.Mail)}
was called
+     *
+     */
+    public interface CompositeProcessorListener {
+
+        /**
+         * Get called after the processing via a {@link MailProcessor} was complete
+         * 
+         * @param processor
+         * @param mailName
+         * @param processTime in ms
+         * @param e or null if no exception was thrown
+         */
+        public void afterProcessor(MailProcessor processor, String mailName, long processTime,
MessagingException e);
+
+    }
+
 }

Copied: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java
(from r1051800, james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetContainer.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java?p2=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java&p1=james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetContainer.java&r1=1051800&r2=1051885&rev=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetContainer.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractMailetProcessor.java
Wed Dec 22 13:11:50 2010
@@ -19,6 +19,7 @@
 package org.apache.james.mailetcontainer.lib;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -35,13 +36,13 @@ import org.apache.commons.configuration.
 import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LogEnabled;
-import org.apache.james.mailetcontainer.api.MailetContainer;
-import org.apache.james.mailetcontainer.api.MailetContainerListener;
+import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.api.MailetLoader;
 import org.apache.james.mailetcontainer.api.MatcherLoader;
 import org.apache.james.mailetcontainer.lib.jmx.JMXMailetContainerListener;
 import org.apache.james.mailetcontainer.lib.matchers.CompositeMatcher;
 import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetConfig;
 import org.apache.mailet.MailetContext;
@@ -51,14 +52,14 @@ import org.apache.mailet.base.GenericMai
 import org.apache.mailet.base.MatcherInverter;
 
 /**
- * Abstract base class for {@link MailetContainer} implementations which simplify to implement
your own implementation
+ * Abstract base class for {@link MailProcessor} implementations which want to process {@link
Mail} via {@link Matcher} and {@link Mailet}
  *
  */
-public abstract class AbstractMailetContainer implements MailetContainer, Configurable, LogEnabled{
+public abstract class AbstractMailetProcessor implements MailProcessor, Configurable, LogEnabled{
 
     private MailetContext mailetContext;
     private MatcherLoader matcherLoader;
-    private List<MailetContainerListener> listeners = Collections.synchronizedList(new
ArrayList<MailetContainerListener>());
+    private List<MailetProcessorListener> listeners = Collections.synchronizedList(new
ArrayList<MailetProcessorListener>());
     private String processorName;
     private JMXMailetContainerListener jmxListener;
     private boolean enableJmx = true;
@@ -161,9 +162,10 @@ public abstract class AbstractMailetCont
         return processorName;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainer#getMailets()
+    /**
+     * Return a unmodifiable {@link List} of the configured {@link Mailet}'s
+     * 
+     * @return mailets
      */
     public List<Mailet> getMailets() {
         List<Mailet> mailets = new ArrayList<Mailet>();
@@ -173,9 +175,11 @@ public abstract class AbstractMailetCont
         return Collections.unmodifiableList(mailets);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainer#getMatchers()
+
+    /**
+     * Return a unmodifiable {@link List} of the configured {@link Matcher}'s
+     * 
+     * @return matchers
      */
     public List<Matcher> getMatchers() {
         List<Matcher> matchers = new ArrayList<Matcher>();
@@ -186,28 +190,16 @@ public abstract class AbstractMailetCont
     }
 
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainer#addListener(org.apache.james.mailetcontainer.api.MailetContainerListener)
-     */
-    public void addListener(MailetContainerListener listener) {
+    public void addListener(MailetProcessorListener listener) {
         listeners.add(listener);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainer#removeListener(org.apache.james.mailetcontainer.api.MailetContainerListener)
-     */
-    public void removeListener(MailetContainerListener listener) {
+    public void removeListener(MailetProcessorListener listener) {
         listeners.remove(listener);
     }
 
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainer#getListeners()
-     */
-    public List<MailetContainerListener> getListeners() {
+    public List<MailetProcessorListener> getListeners() {
         return listeners;
     }
 
@@ -404,7 +396,7 @@ public abstract class AbstractMailetCont
     }
     
     /**
-     * Setup the routing for the configured {@link MatcherMailetPair}'s for this {@link MailetContainer}
+     * Setup the routing for the configured {@link MatcherMailetPair}'s for this {@link CamelProcessor}
      * 
      * 
      */
@@ -458,5 +450,39 @@ public abstract class AbstractMailetCont
         }
     }
     
+    /**
+     * A Listener which will get notified after {@link Mailet#service(org.apache.mailet.Mail)}
and {@link Matcher#match(org.apache.mailet.Mail)} methods are called from
+     * the container
+     *  
+     *
+     */
+    public interface MailetProcessorListener {
+
+        /**
+         * Get called after each {@link Mailet} call was complete 
+         * 
+         * @param m
+         * @param mailName
+         * @param state
+         * @param processTime in ms
+         * @param e or null if no {@link MessagingException} was thrown
+         */
+        public void afterMailet( Mailet m, String mailName, String state, long processTime,
MessagingException e);
+        
+        /**
+         * Get called after each {@link Matcher} call was complete 
+
+         * @param m
+         * @param mailName
+         * @param recipients
+         * @param matches 
+         * @param processTime in ms
+         * @param e or null if no {@link MessagingException} was thrown
+         * 
+         */
+        public void afterMatcher( Matcher m,  String mailName, Collection<MailAddress>
recipients, Collection<MailAddress> matches, long processTime, MessagingException e);
+        
+    }
+    
 
 }

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java?rev=1051885&r1=1051884&r2=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXCompositeMailProcessorListener.java
Wed Dec 22 13:11:50 2010
@@ -32,21 +32,21 @@ import javax.management.ObjectName;
 
 import org.apache.james.lifecycle.api.Disposable;
 import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.mailetcontainer.api.CompositeMailProcessor;
-import org.apache.james.mailetcontainer.api.CompositeMailProcessorListener;
+import org.apache.james.mailetcontainer.lib.AbstractCompositeProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractCompositeProcessor.CompositeProcessorListener;
 
 /**
- * {@link CompositeMailProcessorListener} implementation which register MBeans for its child
{@link MailProcessor} 
+ * {@link CompositeProcessorListener} implementation which register MBeans for its child
{@link MailProcessor} 
  * and keep track of the stats
  *
  */
-public class JMXCompositeMailProcessorListener implements CompositeMailProcessorListener,
Disposable{
+public class JMXCompositeMailProcessorListener implements CompositeProcessorListener, Disposable{
 
-    private CompositeMailProcessor mList;
+    private AbstractCompositeProcessor mList;
     private MBeanServer mbeanserver;
     private List<ObjectName> mbeans = new ArrayList<ObjectName>();
     private Map<MailProcessor, MailProcessorManagement> mMap = new HashMap<MailProcessor,
MailProcessorManagement>();
-    public JMXCompositeMailProcessorListener(CompositeMailProcessor mList) throws MalformedObjectNameException,
JMException {
+    public JMXCompositeMailProcessorListener(AbstractCompositeProcessor mList) throws MalformedObjectNameException,
JMException {
         this.mList = mList;
         
         mbeanserver = ManagementFactory.getPlatformMBeanServer();

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java?rev=1051885&r1=1051884&r2=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXMailetContainerListener.java
Wed Dec 22 13:11:50 2010
@@ -33,22 +33,22 @@ import javax.management.MalformedObjectN
 import javax.management.ObjectName;
 
 import org.apache.james.lifecycle.api.Disposable;
-import org.apache.james.mailetcontainer.api.MailetContainer;
-import org.apache.james.mailetcontainer.api.MailetContainerListener;
+import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor;
+import org.apache.james.mailetcontainer.lib.AbstractMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.matchers.CompositeMatcher;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.Matcher;
 
 /**
- * {@link MailetContainerListener} implementation which register MBean's for all the contained
+ * {@link MailetProcessorListener} implementation which register MBean's for all the contained
  * {@link Mailet} and {@link Matcher} and keep track of the stats
  * 
  *
  */
-public class JMXMailetContainerListener implements MailetContainerListener, Disposable{
+public class JMXMailetContainerListener implements MailetProcessorListener, Disposable{
 
-    private MailetContainer container;
+    private AbstractMailetProcessor processor;
     private MBeanServer mbeanserver;
     private List<ObjectName> mbeans = new ArrayList<ObjectName>();
     private Map<Mailet, MailetManagement> mailetMap = new HashMap<Mailet, MailetManagement>();
@@ -56,8 +56,8 @@ public class JMXMailetContainerListener 
 
     private String name;
 
-    public JMXMailetContainerListener(String name, MailetContainer container) throws MalformedObjectNameException,
JMException {
-        this.container = container;
+    public JMXMailetContainerListener(String name, AbstractMailetProcessor processor) throws
MalformedObjectNameException, JMException {
+        this.processor = processor;
         this.name = name;
         
         mbeanserver = ManagementFactory.getPlatformMBeanServer();
@@ -102,8 +102,8 @@ public class JMXMailetContainerListener 
     private void registerMBeans() throws MalformedObjectNameException, JMException {
         String baseObjectName = "org.apache.james:type=component,name=processor,processor="
+ name;
         
-        registerMailets(baseObjectName, container.getMailets().iterator());
-        registerMatchers(baseObjectName, container.getMatchers().iterator(), 0);
+        registerMailets(baseObjectName, processor.getMailets().iterator());
+        registerMatchers(baseObjectName, processor.getMatchers().iterator(), 0);
     }
 
    

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailProcessorManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailProcessorManagement.java?rev=1051885&r1=1051884&r2=1051885&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailProcessorManagement.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailProcessorManagement.java
Wed Dec 22 13:11:50 2010
@@ -25,11 +25,10 @@ import javax.management.NotCompliantMBea
 import javax.management.StandardMBean;
 
 import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.mailetcontainer.api.MailetContainer;
 import org.apache.james.mailetcontainer.api.jmx.MailProcessorManagementMBean;
 
 /**
- * Wrapper which helps to expose JMX statistics for {@link MailProcessor} and {@link MailetContainer}
implementations
+ * Wrapper which helps to expose JMX statistics for {@link MailProcessor} and {@link CamelProcessor}
implementations
  * 
  *
  */



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