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 fe...@apache.org on 2011/04/04 18:36:45 UTC

svn commit: r1088681 [3/10] - in /james/server/trunk: jpa/src/main/java/org/apache/james/domainlist/jpa/ jpa/src/main/java/org/apache/james/domainlist/jpa/model/ jpa/src/main/java/org/apache/james/user/jpa/ jpa/src/main/java/org/apache/james/user/jpa/m...

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java Mon Apr  4 16:36:42 2011
@@ -52,10 +52,10 @@ import org.apache.mailet.base.MatcherInv
 import org.slf4j.Logger;
 
 /**
- * Abstract base class for {@link MailProcessor} implementations which want to process {@link Mail} via {@link Matcher} and {@link Mailet}
- *
+ * Abstract base class for {@link MailProcessor} implementations which want to
+ * process {@link Mail} via {@link Matcher} and {@link Mailet}
  */
-public abstract class AbstractStateMailetProcessor implements MailProcessor, Configurable, LogEnabled{
+public abstract class AbstractStateMailetProcessor implements MailProcessor, Configurable, LogEnabled {
 
     private MailetContext mailetContext;
     private MatcherLoader matcherLoader;
@@ -68,13 +68,12 @@ public abstract class AbstractStateMaile
     private List<MatcherMailetPair> pairs = new ArrayList<MatcherMailetPair>();
     private String state;
 
-    
     @Resource(name = "matcherloader")
     public void setMatcherLoader(MatcherLoader matcherLoader) {
         this.matcherLoader = matcherLoader;
     }
 
-    @Resource(name= "mailetcontext")
+    @Resource(name = "mailetcontext")
     public void setMailetContext(MailetContext mailetContext) {
         this.mailetContext = mailetContext;
     }
@@ -86,29 +85,32 @@ public abstract class AbstractStateMaile
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.lifecycle.api.LogEnabled#setLog(org.slf4j.Logger)
      */
     public void setLog(Logger log) {
         this.logger = log;
     }
 
-    
-    
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+     * 
+     * @see
+     * org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons
+     * .configuration.HierarchicalConfiguration)
      */
     public void configure(HierarchicalConfiguration config) throws ConfigurationException {
         this.state = config.getString("[@state]", null);
-        if (state == null) throw new ConfigurationException("Processor state attribute must be configured");
-        if (state.equals(Mail.GHOST)) throw new ConfigurationException("Processor state of " + Mail.GHOST + " is reserved for internal use, choose a different one");
+        if (state == null)
+            throw new ConfigurationException("Processor state attribute must be configured");
+        if (state.equals(Mail.GHOST))
+            throw new ConfigurationException("Processor state of " + Mail.GHOST + " is reserved for internal use, choose a different one");
 
         this.enableJmx = config.getBoolean("[@enableJmx]", true);
         this.config = config;
-        
+
     }
-   
-   
+
     /**
      * Init the container
      * 
@@ -118,14 +120,13 @@ public abstract class AbstractStateMaile
     public void init() throws Exception {
         parseConfiguration();
         setupRouting(pairs);
-        
+
         if (enableJmx) {
             this.jmxListener = new JMXStateMailetProcessorListener(state, this);
             addListener(jmxListener);
         }
     }
-    
-    
+
     /**
      * Destroy the container
      */
@@ -144,7 +145,7 @@ public abstract class AbstractStateMaile
                 logger.debug("Shutdown matcher " + matcher.getMatcherInfo());
             }
             matcher.destroy();
-            
+
             if (logger.isDebugEnabled()) {
                 logger.debug("Shutdown mailet " + mailet.getMailetInfo());
             }
@@ -152,21 +153,21 @@ public abstract class AbstractStateMaile
 
         }
     }
-    
+
     /**
      * Hand the mail over to another processor
      * 
      * @param mail
      * @throws MessagingException
      */
-    protected void toProcessor(Mail mail) throws MessagingException{
+    protected void toProcessor(Mail mail) throws MessagingException {
         mailetContext.sendMail(mail);
     }
-    
+
     protected Logger getLogger() {
         return logger;
     }
-    
+
     protected String getState() {
         return state;
     }
@@ -184,7 +185,6 @@ public abstract class AbstractStateMaile
         return Collections.unmodifiableList(mailets);
     }
 
-
     /**
      * Return a unmodifiable {@link List} of the configured {@link Matcher}'s
      * 
@@ -195,10 +195,9 @@ public abstract class AbstractStateMaile
         for (int i = 0; i < pairs.size(); i++) {
             matchers.add(pairs.get(i).getMatcher());
         }
-        return Collections.unmodifiableList(matchers);       
+        return Collections.unmodifiableList(matchers);
     }
 
-
     public void addListener(MailetProcessorListener listener) {
         listeners.add(listener);
     }
@@ -207,12 +206,10 @@ public abstract class AbstractStateMaile
         listeners.remove(listener);
     }
 
-
     public List<MailetProcessorListener> getListeners() {
         return listeners;
     }
 
-
     /**
      * Create a {@link MailetConfig} for the given mailetname and configuration
      * 
@@ -228,9 +225,9 @@ public abstract class AbstractStateMaile
         configImpl.setMailetContext(mailetContext);
         return configImpl;
     }
-    
+
     /**
-     * Create a {@link MatcherConfig} for the given "match=" attribute. 
+     * Create a {@link MatcherConfig} for the given "match=" attribute.
      * 
      * @param matchName
      * @return matcherConfig
@@ -249,11 +246,10 @@ public abstract class AbstractStateMaile
         return configImpl;
 
     }
-    
 
-    
     /**
-     * Load  {@link CompositeMatcher} implementations and their child {@link Matcher}'s
+     * Load {@link CompositeMatcher} implementations and their child
+     * {@link Matcher}'s
      * 
      * CompositeMatcher were added by JAMES-948
      * 
@@ -266,10 +262,10 @@ public abstract class AbstractStateMaile
      * @throws NotCompliantMBeanException
      */
     @SuppressWarnings("unchecked")
-    private List<Matcher> loadCompositeMatchers(String state, Map<String,Matcher> compMap, List<HierarchicalConfiguration> compMatcherConfs) throws ConfigurationException, MessagingException {
+    private List<Matcher> loadCompositeMatchers(String state, Map<String, Matcher> compMap, List<HierarchicalConfiguration> compMatcherConfs) throws ConfigurationException, MessagingException {
         List<Matcher> matchers = new ArrayList<Matcher>();
 
-        for (int j= 0 ; j < compMatcherConfs.size(); j++) {
+        for (int j = 0; j < compMatcherConfs.size(); j++) {
             HierarchicalConfiguration c = compMatcherConfs.get(j);
             String compName = c.getString("[@name]", null);
             String matcherName = c.getString("[@match]", null);
@@ -283,9 +279,9 @@ public abstract class AbstractStateMaile
                 matcher = matcherLoader.getMatcher(createMatcherConfig(matcherName));
                 if (matcher instanceof CompositeMatcher) {
                     CompositeMatcher compMatcher = (CompositeMatcher) matcher;
-                    
-                    List<Matcher> childMatcher = loadCompositeMatchers(state, compMap,c.configurationsAt("matcher"));
-                    for (int i = 0 ; i < childMatcher.size(); i++) {
+
+                    List<Matcher> childMatcher = loadCompositeMatchers(state, compMap, c.configurationsAt("matcher"));
+                    for (int i = 0; i < childMatcher.size(); i++) {
                         compMatcher.add(childMatcher.get(i));
                     }
                 }
@@ -293,35 +289,37 @@ public abstract class AbstractStateMaile
                 Matcher m = matcherLoader.getMatcher(createMatcherConfig(invertedMatcherName));
                 if (m instanceof CompositeMatcher) {
                     CompositeMatcher compMatcher = (CompositeMatcher) m;
-                    
-                    List<Matcher> childMatcher = loadCompositeMatchers(state, compMap,c.configurationsAt("matcher"));
-                    for (int i = 0 ; i < childMatcher.size(); i++) {
+
+                    List<Matcher> childMatcher = loadCompositeMatchers(state, compMap, c.configurationsAt("matcher"));
+                    for (int i = 0; i < childMatcher.size(); i++) {
                         compMatcher.add(childMatcher.get(i));
                     }
                 }
                 matcher = new MatcherInverter(m);
             }
-            if (matcher == null) throw new ConfigurationException("Unable to load matcher instance");
+            if (matcher == null)
+                throw new ConfigurationException("Unable to load matcher instance");
             matchers.add(matcher);
             if (compName != null) {
-                // check if there is already a composite Matcher with the name registered in the processor
-                if (compMap.containsKey(compName)) throw new ConfigurationException("CompositeMatcher with name " + compName + " is already defined in processor " + state);
+                // check if there is already a composite Matcher with the name
+                // registered in the processor
+                if (compMap.containsKey(compName))
+                    throw new ConfigurationException("CompositeMatcher with name " + compName + " is already defined in processor " + state);
                 compMap.put(compName, matcher);
             }
         }
         return matchers;
     }
-    
+
     @SuppressWarnings("unchecked")
     private void parseConfiguration() throws MessagingException, ConfigurationException {
-        
+
         // load composite matchers if there are any
-        Map<String,Matcher> compositeMatchers = new HashMap<String, Matcher>();
+        Map<String, Matcher> compositeMatchers = new HashMap<String, Matcher>();
         loadCompositeMatchers(getState(), compositeMatchers, config.configurationsAt("matcher"));
-        
-        
+
         final List<HierarchicalConfiguration> mailetConfs = config.configurationsAt("mailet");
-    
+
         // Loop through the mailet configuration, load
         // all of the matcher and mailets, and add
         // them to the processor.
@@ -332,10 +330,10 @@ public abstract class AbstractStateMaile
             String mailetClassName = c.getString("[@class]");
             String matcherName = c.getString("[@match]", null);
             String invertedMatcherName = c.getString("[@notmatch]", null);
-        
+
             Mailet mailet = null;
             Matcher matcher = null;
-            
+
             try {
 
                 if (matcherName != null && invertedMatcherName != null) {
@@ -345,14 +343,16 @@ public abstract class AbstractStateMaile
                     // try to load from compositeMatchers first
                     matcher = compositeMatchers.get(matcherName);
                     if (matcher == null) {
-                        // no composite Matcher found, try to load it via MatcherLoader
+                        // no composite Matcher found, try to load it via
+                        // MatcherLoader
                         matcher = matcherLoader.getMatcher(createMatcherConfig(matcherName));
                     }
                 } else if (invertedMatcherName != null) {
                     // try to load from compositeMatchers first
                     matcher = compositeMatchers.get(matcherName);
                     if (matcher == null) {
-                        // no composite Matcher found, try to load it via MatcherLoader
+                        // no composite Matcher found, try to load it via
+                        // MatcherLoader
                         matcher = matcherLoader.getMatcher(createMatcherConfig(invertedMatcherName));
                     }
                     matcher = new MatcherInverter(matcher);
@@ -395,7 +395,7 @@ public abstract class AbstractStateMaile
                 }
                 throw new ConfigurationException("Unable to init mailet " + mailetClassName, ex);
             }
-            
+
             if (matcher != null && mailet != null) {
                 pairs.add(new MatcherMailetPair(matcher, mailet));
             } else {
@@ -403,95 +403,92 @@ public abstract class AbstractStateMaile
             }
         }
     }
-    
+
     /**
-     * Setup the routing for the configured {@link MatcherMailetPair}'s for this {@link CamelProcessor}
-     * 
-     * 
+     * Setup the routing for the configured {@link MatcherMailetPair}'s for this
+     * {@link CamelProcessor}
      */
     protected abstract void setupRouting(List<MatcherMailetPair> pairs) throws MessagingException;
-    
-    
-    
+
     /**
-     * Mailet which protect us to not fall into an endless loop caused by an configuration error
-     *
+     * Mailet which protect us to not fall into an endless loop caused by an
+     * configuration error
      */
     public final class TerminatingMailet extends GenericMailet {
         /**
-         *  The name of the mailet used to terminate the mailet chain.  The
-         *  end of the matcher/mailet chain must be a matcher that matches
-         *  all mails and a mailet that sets every mail to GHOST status.
-         *  This is necessary to ensure that mails are removed from the spool
-         *  in an orderly fashion.
+         * The name of the mailet used to terminate the mailet chain. The end of
+         * the matcher/mailet chain must be a matcher that matches all mails and
+         * a mailet that sets every mail to GHOST status. This is necessary to
+         * ensure that mails are removed from the spool in an orderly fashion.
          */
         private static final String TERMINATING_MAILET_NAME = "Terminating%Mailet%Name";
 
         /*
          * (non-Javadoc)
-         * @see org.apache.mailet.base.GenericMailet#service(org.apache.mailet.Mail)
+         * 
+         * @see
+         * org.apache.mailet.base.GenericMailet#service(org.apache.mailet.Mail)
          */
         public void service(Mail mail) {
             if (!(Mail.ERROR.equals(mail.getState()))) {
                 // Don't complain if we fall off the end of the
-                // error processor.  That is currently the
+                // error processor. That is currently the
                 // normal situation for James, and the message
                 // will show up in the error store.
-                StringBuffer warnBuffer = new StringBuffer(256)
-                                      .append("Message ")
-                                      .append(mail.getName())
-                                      .append(" reached the end of this processor, and is automatically deleted.  This may indicate a configuration error.");
+                StringBuffer warnBuffer = new StringBuffer(256).append("Message ").append(mail.getName()).append(" reached the end of this processor, and is automatically deleted.  This may indicate a configuration error.");
                 logger.warn(warnBuffer.toString());
             }
-            
+
             // Set the mail to ghost state
             mail.setState(Mail.GHOST);
         }
-    
+
         @Override
         public String getMailetInfo() {
             return getMailetName();
         }
-    
+
         @Override
         public String getMailetName() {
             return TERMINATING_MAILET_NAME;
         }
     }
-    
+
     /**
-     * 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
-     *  
-     *
+     * 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 
+         * 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
+         * @param processTime
+         *            in ms
+         * @param e
+         *            or null if no {@link MessagingException} was thrown
          */
-        void afterMailet( Mailet m, String mailName, String state, long processTime, MessagingException e);
-        
-        /**
-         * Get called after each {@link Matcher} call was complete 
+        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
-         * 
+         * @param matches
+         * @param processTime
+         *            in ms
+         * @param e
+         *            or null if no {@link MessagingException} was thrown
          */
-        void afterMatcher( Matcher m,  String mailName, Collection<MailAddress> recipients, Collection<MailAddress> matches, long processTime, MessagingException e);
-        
+        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/JamesMailSpooler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java Mon Apr  4 16:36:42 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.mailetcontainer.lib;
 
 import java.util.Collection;
@@ -43,70 +41,57 @@ import org.apache.mailet.Mail;
 import org.slf4j.Logger;
 
 /**
- * Manages the mail spool.  This class is responsible for retrieving
- * messages from the spool, directing messages to the appropriate
- * processor, and removing them from the spool when processing is
- * complete.
- *
- * @version CVS $Revision$ $Date$
+ * Manages the mail spool. This class is responsible for retrieving messages
+ * from the spool, directing messages to the appropriate processor, and removing
+ * them from the spool when processing is complete.
  * 
- * TODO: We should better use a ExecutorService here and only spawn a new Thread if needed
+ * TODO: We should better use a ExecutorService here and only spawn a new Thread
+ * if needed
  */
 public class JamesMailSpooler implements Runnable, Configurable, LogEnabled, MailSpoolerMBean {
 
-    
     private MailQueue queue;
 
-    /**
-     * The number of threads used to move mail through the spool.
-     */
+    /** The number of threads used to move mail through the spool. */
     private int numThreads;
 
-  
-    /**
-     * Number of active threads
-     */
+    /** Number of active threads */
     private AtomicInteger numActive = new AtomicInteger(0);;
 
     private AtomicInteger processingActive = new AtomicInteger(0);;
 
-    
-    /**
-     * Spool threads are active
-     */
+    /** Spool threads are active */
     private AtomicBoolean active = new AtomicBoolean(false);
 
-    /**
-     * Spool threads
-     */
+    /** Spool threads */
     private Collection<Thread> spoolThreads;
 
-    /**
-     * The mail processor 
-     */
+    /** The mail processor */
     private MailProcessor mailProcessor;
 
     private Logger logger;
 
     private MailQueueFactory queueFactory;
 
-
-    @Resource(name="mailqueuefactory")
+    @Resource(name = "mailqueuefactory")
     public void setMailQueueFactory(MailQueueFactory queueFactory) {
         this.queueFactory = queueFactory;
     }
 
-    @Resource(name="mailprocessor")
+    @Resource(name = "mailprocessor")
     public void setMailProcessor(MailProcessor mailProcessor) {
         this.mailProcessor = mailProcessor;
     }
-    
+
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+     * 
+     * @see
+     * org.apache.james.lifecycle.Configurable#configure(org.apache.commons.
+     * configuration.HierarchicalConfiguration)
      */
     public void configure(HierarchicalConfiguration config) throws ConfigurationException {
-        numThreads = config.getInt("threads",100);
+        numThreads = config.getInt("threads", 100);
     }
 
     /**
@@ -115,22 +100,17 @@ public class JamesMailSpooler implements
     @PostConstruct
     public void init() throws Exception {
         logger.info(getClass().getName() + " init...");
-        
+
         queue = queueFactory.getQueue(MailQueueFactory.SPOOL);
 
         if (logger.isInfoEnabled()) {
-            StringBuffer infoBuffer =
-                new StringBuffer(64)
-                    .append(getClass().getName())
-                    .append(" uses ")
-                    .append(numThreads)
-                    .append(" Thread(s)");
+            StringBuffer infoBuffer = new StringBuffer(64).append(getClass().getName()).append(" uses ").append(numThreads).append(" Thread(s)");
             logger.info(infoBuffer.toString());
         }
 
         active.set(true);
         spoolThreads = new java.util.ArrayList<Thread>(numThreads);
-        for ( int i = 0 ; i < numThreads ; i++ ) {
+        for (int i = 0; i < numThreads; i++) {
             Thread reader = new Thread(this, "Spool Thread #" + i);
             spoolThreads.add(reader);
             reader.start();
@@ -138,33 +118,28 @@ public class JamesMailSpooler implements
     }
 
     /**
-     * This routinely checks the message spool for messages, and processes
-     * them as necessary
+     * This routinely checks the message spool for messages, and processes them
+     * as necessary
      */
     public void run() {
 
         if (logger.isInfoEnabled()) {
-            logger.info("Run " + getClass().getName() +": "
-                             + Thread.currentThread().getName());
+            logger.info("Run " + getClass().getName() + ": " + Thread.currentThread().getName());
             logger.info("Queue=" + queue.toString());
         }
 
-        while(active.get()) {
+        while (active.get()) {
             numActive.incrementAndGet();
 
             try {
                 MailQueueItem queueItem = queue.deQueue();
-                
+
                 // increase count
                 processingActive.incrementAndGet();
-                
+
                 Mail mail = queueItem.getMail();
                 if (logger.isDebugEnabled()) {
-                    StringBuffer debugBuffer =
-                        new StringBuffer(64)
-                                .append("==== Begin processing mail ")
-                                .append(mail.getName())
-                                .append("====");
+                    StringBuffer debugBuffer = new StringBuffer(64).append("==== Begin processing mail ").append(mail.getName()).append("====");
                     logger.debug(debugBuffer.toString());
                 }
 
@@ -181,7 +156,7 @@ public class JamesMailSpooler implements
                     LifecycleUtil.dispose(mail);
                     mail = null;
                 }
-               
+
             } catch (Throwable e) {
                 if (active.get() && logger.isErrorEnabled()) {
                     logger.error("Exception processing mail while spooling " + e.getMessage(), e);
@@ -193,8 +168,8 @@ public class JamesMailSpooler implements
             }
 
         }
-        if (logger.isInfoEnabled()){
-            logger.info("Stop " +  getClass().getName() +": " + Thread.currentThread().getName());
+        if (logger.isInfoEnabled()) {
+            logger.info("Stop " + getClass().getName() + ": " + Thread.currentThread().getName());
         }
     }
 
@@ -202,7 +177,7 @@ public class JamesMailSpooler implements
      * The dispose operation is called at the end of a components lifecycle.
      * Instances of this class use this method to release and destroy any
      * resources that they own.
-     *
+     * 
      * This implementation shuts down the LinearProcessors managed by this
      * JamesSpoolManager
      * 
@@ -210,25 +185,27 @@ public class JamesMailSpooler implements
      */
     @PreDestroy
     public void dispose() {
-        logger.info(getClass().getName() +" dispose...");
+        logger.info(getClass().getName() + " dispose...");
         active.set(false); // shutdown the threads
-        for (Thread thread: spoolThreads) {
+        for (Thread thread : spoolThreads) {
             thread.interrupt(); // interrupt any waiting accept() calls.
         }
 
         long stop = System.currentTimeMillis() + 60000;
-        // give the spooler threads one minute to terminate gracefully      
+        // give the spooler threads one minute to terminate gracefully
         while (numActive.get() != 0 && stop > System.currentTimeMillis()) {
             try {
                 Thread.sleep(1000);
-            } catch (Exception ignored) {}
+            } catch (Exception ignored) {
+            }
         }
-        
-        logger.info(getClass().getName() +" thread shutdown completed.");
+
+        logger.info(getClass().getName() + " thread shutdown completed.");
     }
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
     public void setLog(Logger log) {
@@ -237,7 +214,9 @@ public class JamesMailSpooler implements
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailSpoolerMBean#getThreadCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.MailSpoolerMBean#getThreadCount()
      */
     public int getThreadCount() {
         return numThreads;
@@ -245,7 +224,10 @@ public class JamesMailSpooler implements
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailSpoolerMBean#getCurrentSpoolCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.MailSpoolerMBean#getCurrentSpoolCount
+     * ()
      */
     public int getCurrentSpoolCount() {
         return processingActive.get();

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MailetConfigImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MailetConfigImpl.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MailetConfigImpl.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MailetConfigImpl.java Mon Apr  4 16:36:42 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.mailetcontainer.lib;
 
 import org.apache.commons.configuration.Configuration;
@@ -32,27 +30,19 @@ import java.util.List;
 
 /**
  * Implements the configuration object for a Mailet.
- *
- * @version CVS $Revision$ $Date$
  */
 public class MailetConfigImpl implements MailetConfig {
 
-    /**
-     * The mailet MailetContext
-     */
+    /** The mailet MailetContext */
     private MailetContext mailetContext;
 
-    /**
-     * The mailet name
-     */
+    /** The mailet name */
     private String name;
 
-    //This would probably be better.
-    //Properties params = new Properties();
-    //Instead, we're tied to the Configuration object
-    /**
-     * The mailet Avalon Configuration
-     */
+    // This would probably be better.
+    // Properties params = new Properties();
+    // Instead, we're tied to the Configuration object
+    /** The mailet Avalon Configuration */
     private Configuration configuration;
 
     /**
@@ -62,11 +52,12 @@ public class MailetConfigImpl implements
     }
 
     /**
-     * Get the value of an parameter stored in this MailetConfig.  Multi-valued
+     * Get the value of an parameter stored in this MailetConfig. Multi-valued
      * parameters are returned as a comma-delineated string.
-     *
-     * @param name the name of the parameter whose value is to be retrieved.
-     *
+     * 
+     * @param name
+     *            the name of the parameter whose value is to be retrieved.
+     * 
      * @return the parameter value
      */
     public String getInitParameter(String name) {
@@ -75,7 +66,7 @@ public class MailetConfigImpl implements
 
     /**
      * Returns an iterator over the set of configuration parameter names.
-     *
+     * 
      * @return an iterator over the set of configuration parameter names.
      */
     @SuppressWarnings("unchecked")
@@ -85,7 +76,7 @@ public class MailetConfigImpl implements
         while (it.hasNext()) {
             String param = it.next();
             if ((param.startsWith("[@") && param.endsWith("]")) == false) {
-                
+
                 params.add(param);
             }
         }
@@ -94,18 +85,19 @@ public class MailetConfigImpl implements
 
     /**
      * Get the value of an (XML) attribute stored in this MailetConfig.
-     *
-     * @param name the name of the attribute whose value is to be retrieved.
-     *
+     * 
+     * @param name
+     *            the name of the attribute whose value is to be retrieved.
+     * 
      * @return the attribute value or null if missing
      */
     public String getInitAttribute(String name) {
-        return configuration.getString("[@" +name+ "]", null);
+        return configuration.getString("[@" + name + "]", null);
     }
 
     /**
      * Get the mailet's MailetContext object.
-     *
+     * 
      * @return the MailetContext for the mailet
      */
     public MailetContext getMailetContext() {
@@ -114,8 +106,9 @@ public class MailetConfigImpl implements
 
     /**
      * Set the mailet's Avalon Configuration object.
-     *
-     * @param newContext the MailetContext for the mailet
+     * 
+     * @param newContext
+     *            the MailetContext for the mailet
      */
     public void setMailetContext(MailetContext newContext) {
         mailetContext = newContext;
@@ -123,31 +116,32 @@ public class MailetConfigImpl implements
 
     /**
      * Set the Avalon Configuration object for the mailet.
-     *
-     * @param newConfiguration the new Configuration for the mailet
+     * 
+     * @param newConfiguration
+     *            the new Configuration for the mailet
      */
     @SuppressWarnings("unchecked")
     public void setConfiguration(Configuration newConfiguration) {
         DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
         Iterator<String> keys = newConfiguration.getKeys();
-        while(keys.hasNext()) {
+        while (keys.hasNext()) {
             String key = keys.next();
             String value = newConfiguration.getString(key);
             // See JAMES-1177
-            // Need to replace ".." with "." 
-            // See http://commons.apache.org/configuration/userguide-1.2/howto_xml.html 
+            // Need to replace ".." with "."
+            // See
+            // http://commons.apache.org/configuration/userguide-1.2/howto_xml.html
             // Escaping dot characters in XML tags
             key = key.replaceAll("\\.\\.", "\\.");
             builder.addProperty(key, value);
         }
-     
-        
+
         configuration = builder;
     }
 
     /**
      * Get the name of the mailet.
-     *
+     * 
      * @return the name of the mailet
      */
     public String getMailetName() {
@@ -156,8 +150,9 @@ public class MailetConfigImpl implements
 
     /**
      * Set the name for the mailet.
-     *
-     * @param newName the new name for the mailet
+     * 
+     * @param newName
+     *            the new name for the mailet
      */
     public void setMailetName(String newName) {
         name = newName;

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherConfigImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherConfigImpl.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherConfigImpl.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherConfigImpl.java Mon Apr  4 16:36:42 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.mailetcontainer.lib;
 
 import org.apache.mailet.MailetContext;
@@ -26,29 +24,22 @@ import org.apache.mailet.MatcherConfig;
 
 /**
  * Implements the configuration object for a Matcher.
- *
  */
 public class MatcherConfigImpl implements MatcherConfig {
 
-    /**
-     * A String representation of the value for the matching condition
-     */
+    /** A String representation of the value for the matching condition */
     private String condition;
 
-    /**
-     * The name of the Matcher
-     */
+    /** The name of the Matcher */
     private String name;
 
-    /**
-     * The MailetContext associated with the Matcher configuration
-     */
+    /** The MailetContext associated with the Matcher configuration */
     private MailetContext context;
 
     /**
      * The simple condition defined for this matcher, e.g., for
      * SenderIs=admin@localhost, this would return admin@localhost.
-     *
+     * 
      * @return a String containing the value of the initialization parameter
      */
     public String getCondition() {
@@ -63,11 +54,11 @@ public class MatcherConfigImpl implement
     }
 
     /**
-     * Returns the name of this matcher instance. The name may be provided via server
-     * administration, assigned in the application deployment descriptor, or for
-     * an unregistered (and thus unnamed) matcher instance it will be the matcher's
-     * class name.
-     *
+     * Returns the name of this matcher instance. The name may be provided via
+     * server administration, assigned in the application deployment descriptor,
+     * or for an unregistered (and thus unnamed) matcher instance it will be the
+     * matcher's class name.
+     * 
      * @return the name of the matcher instance
      */
     public String getMatcherName() {
@@ -76,18 +67,20 @@ public class MatcherConfigImpl implement
 
     /**
      * Sets the name of this matcher instance.
-     *
-     * @param newName the name of the matcher instance
+     * 
+     * @param newName
+     *            the name of the matcher instance
      */
     public void setMatcherName(String newName) {
         name = newName;
     }
 
     /**
-     * Returns a reference to the MailetContext in which the matcher is executing
-     *
+     * Returns a reference to the MailetContext in which the matcher is
+     * executing
+     * 
      * @return a MailetContext object, used by the matcher to interact with its
-     *      mailet container
+     *         mailet container
      */
     public MailetContext getMailetContext() {
         return context;
@@ -95,9 +88,10 @@ public class MatcherConfigImpl implement
 
     /**
      * Sets a reference to the MailetContext in which the matcher is executing
-     *
-     * @param newContext a MailetContext object, used by the matcher to interact
-     *      with its mailet container
+     * 
+     * @param newContext
+     *            a MailetContext object, used by the matcher to interact with
+     *            its mailet container
      */
     public void setMailetContext(MailetContext newContext) {
         context = newContext;

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherMailetPair.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherMailetPair.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherMailetPair.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/MatcherMailetPair.java Mon Apr  4 16:36:42 2011
@@ -23,7 +23,6 @@ import org.apache.mailet.Matcher;
 
 /**
  * A pair of {@link Matcher} and {@link Mailet}
- *
  */
 public class MatcherMailetPair {
     private Matcher matcher;
@@ -33,7 +32,7 @@ public class MatcherMailetPair {
         this.matcher = matcher;
         this.mailet = mailet;
     }
-    
+
     /**
      * Return the {@link Matcher} of this pair
      * 
@@ -42,7 +41,7 @@ public class MatcherMailetPair {
     public Matcher getMatcher() {
         return matcher;
     }
-    
+
     /**
      * Return the {@link Mailet} of this pair
      * 
@@ -51,6 +50,5 @@ public class MatcherMailetPair {
     public Mailet getMailet() {
         return mailet;
     }
-    
-    
+
 }

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java Mon Apr  4 16:36:42 2011
@@ -17,7 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
 package org.apache.james.mailetcontainer.lib;
 
 import java.io.PrintWriter;
@@ -36,30 +35,30 @@ public class ProcessorUtil {
     /**
      * This is a helper method that updates the state of the mail object to
      * Mail.ERROR as well as recording the exception to the log
-     *
-     * @param me the exception to be handled
-     * @param mail the mail being processed when the exception was generated
-     * @param offendersName the matcher or mailet than generated the exception
-     * @param nextState the next state to set
-     *
-     * @throws MessagingException thrown always, rethrowing the passed in exception
+     * 
+     * @param me
+     *            the exception to be handled
+     * @param mail
+     *            the mail being processed when the exception was generated
+     * @param offendersName
+     *            the matcher or mailet than generated the exception
+     * @param nextState
+     *            the next state to set
+     * 
+     * @throws MessagingException
+     *             thrown always, rethrowing the passed in exception
      */
     public static void handleException(MessagingException me, Mail mail, String offendersName, String nextState, Logger logger) throws MessagingException {
         mail.setState(nextState);
         StringWriter sout = new StringWriter();
         PrintWriter out = new PrintWriter(sout, true);
-        StringBuffer exceptionBuffer =
-            new StringBuffer(128)
-                    .append("Exception calling ")
-                    .append(offendersName)
-                    .append(": ")
-                    .append(me.getMessage());
+        StringBuffer exceptionBuffer = new StringBuffer(128).append("Exception calling ").append(offendersName).append(": ").append(me.getMessage());
         out.println(exceptionBuffer.toString());
         Exception e = me;
         while (e != null) {
             e.printStackTrace(out);
             if (e instanceof MessagingException) {
-                e = ((MessagingException)e).getNextException();
+                e = ((MessagingException) e).getNextException();
             } else {
                 e = null;
             }
@@ -69,20 +68,22 @@ public class ProcessorUtil {
         logger.error(errorString);
         throw me;
     }
-    
+
     /**
      * Checks that all objects in this class are of the form MailAddress.
-     *
-     * @throws MessagingException when the <code>Collection</code> contains objects that are not <code>MailAddress</code> objects
+     * 
+     * @throws MessagingException
+     *             when the <code>Collection</code> contains objects that are
+     *             not <code>MailAddress</code> objects
      */
     @SuppressWarnings("rawtypes")
     public static void verifyMailAddresses(Collection col) throws MessagingException {
         try {
-            MailAddress addresses[] = (MailAddress[])col.toArray(new MailAddress[0]);
+            MailAddress addresses[] = (MailAddress[]) col.toArray(new MailAddress[0]);
 
-            // Why is this here?  According to the javadoc for
+            // Why is this here? According to the javadoc for
             // java.util.Collection.toArray(Object[]), this should
-            // never happen.  The exception will be thrown.
+            // never happen. The exception will be thrown.
             if (addresses.length != col.size()) {
                 throw new MailetException("The recipient list contains objects other than MailAddress objects");
             }

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateCompositeProcessorListener.java Mon Apr  4 16:36:42 2011
@@ -36,24 +36,23 @@ import org.apache.james.mailetcontainer.
 import org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.CompositeProcessorListener;
 
 /**
- * {@link CompositeProcessorListener} implementation which register MBeans for its child {@link MailProcessor} 
- * and keep track of the stats
- *
+ * {@link CompositeProcessorListener} implementation which register MBeans for
+ * its child {@link MailProcessor} and keep track of the stats
  */
-public class JMXStateCompositeProcessorListener implements CompositeProcessorListener, Disposable{
+public class JMXStateCompositeProcessorListener implements CompositeProcessorListener, Disposable {
 
     private AbstractStateCompositeProcessor mList;
     private MBeanServer mbeanserver;
     private List<ObjectName> mbeans = new ArrayList<ObjectName>();
     private Map<MailProcessor, MailProcessorManagement> mMap = new HashMap<MailProcessor, MailProcessorManagement>();
+
     public JMXStateCompositeProcessorListener(AbstractStateCompositeProcessor mList) throws MalformedObjectNameException, JMException {
         this.mList = mList;
-        
+
         mbeanserver = ManagementFactory.getPlatformMBeanServer();
         registerMBeans();
     }
-    
-    
+
     /**
      * Unregister all JMX MBeans
      */
@@ -61,25 +60,25 @@ public class JMXStateCompositeProcessorL
         List<ObjectName> unregistered = new ArrayList<ObjectName>();
         for (int i = 0; i < mbeans.size(); i++) {
             ObjectName name = mbeans.get(i);
-            
+
             try {
                 mbeanserver.unregisterMBean(name);
                 unregistered.add(name);
             } catch (javax.management.JMException e) {
-                //logger.error("Unable to unregister mbean " + name, e);
+                // logger.error("Unable to unregister mbean " + name, e);
             }
         }
         mbeans.removeAll(unregistered);
     }
 
-
     /**
      * Register all JMX MBeans
-     * @throws JMException 
-     * @throws MalformedObjectNameException 
+     * 
+     * @throws JMException
+     * @throws MalformedObjectNameException
      */
     private void registerMBeans() throws MalformedObjectNameException, JMException {
-       
+
         String baseObjectName = "org.apache.james:type=component,component=mailetcontainer,name=processor,";
 
         String[] processorNames = mList.getProcessorStates();
@@ -88,36 +87,39 @@ public class JMXStateCompositeProcessorL
             registerProcessorMBean(baseObjectName, processorName);
         }
     }
-    
+
     /**
      * Register a JMX MBean for a {@link MailProcessor}
      * 
      * @param baseObjectName
      * @param processorName
-     * @throws JMException 
-     * @throws MalformedObjectNameException 
+     * @throws JMException
+     * @throws MalformedObjectNameException
      */
     private void registerProcessorMBean(String baseObjectName, String processorName) throws MalformedObjectNameException, JMException {
         String processorMBeanName = baseObjectName + "processor=" + processorName;
-        
+
         MailProcessorManagement processorDetail = new MailProcessorManagement(processorName);
         registerMBean(processorMBeanName, processorDetail);
         mMap.put(mList.getProcessor(processorName), processorDetail);
 
     }
-    
 
-    private void registerMBean(String mBeanName, Object object) throws MalformedObjectNameException, JMException{
-         ObjectName objectName = new ObjectName(mBeanName);
-       
+    private void registerMBean(String mBeanName, Object object) throws MalformedObjectNameException, JMException {
+        ObjectName objectName = new ObjectName(mBeanName);
+
         mbeanserver.registerMBean(object, objectName);
         mbeans.add(objectName);
-       
+
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailProcessorListListener#afterProcessor(org.apache.james.mailetcontainer.api.MailProcessor, java.lang.String, long, javax.mail.MessagingException)
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.MailProcessorListListener#afterProcessor
+     * (org.apache.james.mailetcontainer.api.MailProcessor, java.lang.String,
+     * long, javax.mail.MessagingException)
      */
     public void afterProcessor(MailProcessor processor, String mailName, long processTime, MessagingException e) {
         MailProcessorManagement m = mMap.get(processor);
@@ -126,13 +128,13 @@ public class JMXStateCompositeProcessorL
         }
     }
 
-
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.lifecycle.api.Disposable#dispose()
      */
     public void dispose() {
-        unregisterMBeans();      
+        unregisterMBeans();
         mMap.clear();
     }
 

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/JMXStateMailetProcessorListener.java Mon Apr  4 16:36:42 2011
@@ -41,12 +41,10 @@ import org.apache.mailet.Mailet;
 import org.apache.mailet.Matcher;
 
 /**
- * {@link MailetProcessorListener} implementation which register MBean's for all the contained
- * {@link Mailet} and {@link Matcher} and keep track of the stats
- * 
- *
+ * {@link MailetProcessorListener} implementation which register MBean's for all
+ * the contained {@link Mailet} and {@link Matcher} and keep track of the stats
  */
-public class JMXStateMailetProcessorListener implements MailetProcessorListener, Disposable{
+public class JMXStateMailetProcessorListener implements MailetProcessorListener, Disposable {
 
     private AbstractStateMailetProcessor processor;
     private MBeanServer mbeanserver;
@@ -59,15 +57,18 @@ public class JMXStateMailetProcessorList
     public JMXStateMailetProcessorListener(String name, AbstractStateMailetProcessor processor) throws MalformedObjectNameException, JMException {
         this.processor = processor;
         this.name = name;
-        
+
         mbeanserver = ManagementFactory.getPlatformMBeanServer();
         registerMBeans();
     }
-    
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainerListener#afterMailet(org.apache.mailet.Mailet, java.lang.String, java.lang.String, long, javax.mail.MessagingException)
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.MailetContainerListener#afterMailet
+     * (org.apache.mailet.Mailet, java.lang.String, java.lang.String, long,
+     * javax.mail.MessagingException)
      */
     public void afterMailet(Mailet m, String mailName, String state, long processTime, MessagingException e) {
         MailetManagement mgmt = mailetMap.get(m);
@@ -76,14 +77,17 @@ public class JMXStateMailetProcessorList
         }
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.MailetContainerListener#afterMatcher(org.apache.mailet.Matcher, java.lang.String, java.util.Collection, java.util.Collection, long, javax.mail.MessagingException)
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.MailetContainerListener#afterMatcher
+     * (org.apache.mailet.Matcher, java.lang.String, java.util.Collection,
+     * java.util.Collection, long, javax.mail.MessagingException)
      */
-    public void afterMatcher(Matcher m,  String mailName, Collection<MailAddress> rcpts,Collection<MailAddress> matches, long processTime, MessagingException e) {
+    public void afterMatcher(Matcher m, String mailName, Collection<MailAddress> rcpts, Collection<MailAddress> matches, long processTime, MessagingException e) {
         MatcherManagement mgmt = matcherMap.get(m);
-        
+
         if (mgmt != null) {
             boolean matched = false;
             if (matches != null) {
@@ -92,33 +96,31 @@ public class JMXStateMailetProcessorList
             mgmt.update(processTime, e == null, matched);
         }
     }
-    
 
     /**
      * Register all JMX MBeans
-     * @throws JMException 
-     * @throws MalformedObjectNameException 
+     * 
+     * @throws JMException
+     * @throws MalformedObjectNameException
      */
     private void registerMBeans() throws MalformedObjectNameException, JMException {
         String baseObjectName = "org.apache.james:type=component,component=mailetcontainer,name=processor,processor=" + name;
-        
+
         registerMailets(baseObjectName, processor.getMailets().iterator());
         registerMatchers(baseObjectName, processor.getMatchers().iterator(), 0);
     }
 
-   
-    
     /**
      * Register the Mailets as JMX MBeans
      * 
      * @param parentMBeanName
      * @param mailets
-     * @throws JMException 
-     * @throws MalformedObjectNameException 
+     * @throws JMException
+     * @throws MalformedObjectNameException
      */
     private void registerMailets(String parentMBeanName, Iterator<Mailet> mailets) throws MalformedObjectNameException, JMException {
         int i = 0;
-        while(mailets.hasNext()) {
+        while (mailets.hasNext()) {
             Mailet mailet = mailets.next();
             MailetManagement mailetManagement = new MailetManagement(mailet.getMailetConfig());
 
@@ -126,9 +128,8 @@ public class JMXStateMailetProcessorList
             registerMBean(mailetMBeanName, mailetManagement);
             mailetMap.put(mailet, mailetManagement);
         }
-        
+
     }
-    
 
     /**
      * Register the {@link Matcher}'s as JMX MBeans
@@ -136,8 +137,8 @@ public class JMXStateMailetProcessorList
      * @param parentMBeanName
      * @param matchers
      * @param nestingLevel
-     * @throws JMException 
-     * @throws MalformedObjectNameException 
+     * @throws JMException
+     * @throws MalformedObjectNameException
      */
     @SuppressWarnings("unchecked")
     private void registerMatchers(String parentMBeanName, Iterator<Matcher> matchers, int nestingLevel) throws MalformedObjectNameException, JMException {
@@ -149,30 +150,30 @@ public class JMXStateMailetProcessorList
             Matcher matcher = matchers.next();
             MatcherManagement matcherManagement = new MatcherManagement(matcher.getMatcherConfig());
 
-
-            String matcherMBeanName = parentMBeanName + ",subtype" + currentLevel +"=matcher,index" + currentLevel+"=" + (i++) + ",matchername" + currentLevel+"=" + matcherManagement.getMatcherName();
+            String matcherMBeanName = parentMBeanName + ",subtype" + currentLevel + "=matcher,index" + currentLevel + "=" + (i++) + ",matchername" + currentLevel + "=" + matcherManagement.getMatcherName();
             registerMBean(matcherMBeanName, matcherManagement);
-            matcherMap.put(matcher, matcherManagement);           
+            matcherMap.put(matcher, matcherManagement);
             // Handle CompositeMatcher which were added by JAMES-948
             if (matcher instanceof CompositeMatcher) {
-                // we increment the nesting as we have one more child level and register the child matchers
+                // we increment the nesting as we have one more child level and
+                // register the child matchers
                 registerMatchers(matcherMBeanName, ((CompositeMatcher) matcher).iterator(), ++nestingLevel);
             }
-            
+
         }
     }
 
-    private void registerMBean(String mBeanName, Object object) throws MalformedObjectNameException, JMException{
-         ObjectName objectName = new ObjectName(mBeanName);
-       
+    private void registerMBean(String mBeanName, Object object) throws MalformedObjectNameException, JMException {
+        ObjectName objectName = new ObjectName(mBeanName);
+
         mbeanserver.registerMBean(object, objectName);
         mbeans.add(objectName);
-       
-    }
 
+    }
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.lifecycle.api.Disposable#dispose()
      */
     public void dispose() {
@@ -181,7 +182,6 @@ public class JMXStateMailetProcessorList
         matcherMap.clear();
     }
 
-    
     /**
      * Unregister all JMX MBeans
      */
@@ -189,16 +189,15 @@ public class JMXStateMailetProcessorList
         List<ObjectName> unregistered = new ArrayList<ObjectName>();
         for (int i = 0; i < mbeans.size(); i++) {
             ObjectName name = mbeans.get(i);
-            
+
             try {
                 mbeanserver.unregisterMBean(name);
                 unregistered.add(name);
             } catch (javax.management.JMException e) {
-                //logger.error("Unable to unregister mbean " + name, e);
+                // logger.error("Unable to unregister mbean " + name, e);
             }
         }
         mbeans.removeAll(unregistered);
     }
 
-
 }

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=1088681&r1=1088680&r2=1088681&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 Mon Apr  4 16:36:42 2011
@@ -28,11 +28,10 @@ import org.apache.james.mailetcontainer.
 import org.apache.james.mailetcontainer.api.jmx.MailProcessorManagementMBean;
 
 /**
- * Wrapper which helps to expose JMX statistics for {@link MailProcessor} and {@link CamelProcessor} implementations
- * 
- *
+ * Wrapper which helps to expose JMX statistics for {@link MailProcessor} and
+ * {@link CamelProcessor} implementations
  */
-public class MailProcessorManagement extends StandardMBean implements MailProcessorManagementMBean{
+public class MailProcessorManagement extends StandardMBean implements MailProcessorManagementMBean {
     private String processorName;
     private AtomicLong errorCount = new AtomicLong(0);
     private AtomicLong successCount = new AtomicLong(0);
@@ -40,14 +39,11 @@ public class MailProcessorManagement ext
     private AtomicLong slowestProcessing = new AtomicLong(-1);
     private AtomicLong lastProcessing = new AtomicLong(-1);
 
-
-        
     public MailProcessorManagement(String processorName) throws NotCompliantMBeanException {
         super(MailProcessorManagementMBean.class);
         this.processorName = processorName;
     }
 
-
     /**
      * Update the stats
      * 
@@ -56,12 +52,11 @@ public class MailProcessorManagement ext
      */
     public void update(long processTime, boolean success) {
         long fastest = fastestProcessing.get();
-        
-        if ( fastest > processTime || fastest == -1) {
+
+        if (fastest > processTime || fastest == -1) {
             fastestProcessing.set(processTime);
         }
-        
-        
+
         if (slowestProcessing.get() < processTime) {
             slowestProcessing.set(processTime);
         }
@@ -70,17 +65,16 @@ public class MailProcessorManagement ext
         } else {
             errorCount.incrementAndGet();
         }
-        
-        lastProcessing.set(processTime);
 
-       
-     }
-    
+        lastProcessing.set(processTime);
 
+    }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getHandledMailCount()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getHandledMailCount()
      */
     public long getHandledMailCount() {
         return getSuccessCount() + getErrorCount();
@@ -88,7 +82,10 @@ public class MailProcessorManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessorDetailMBean#getName()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.jmx.MailProcessorDetailMBean#getName
+     * ()
      */
     public String getName() {
         return processorName;
@@ -96,7 +93,9 @@ public class MailProcessorManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getFastestProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getFastestProcessing()
      */
     public long getFastestProcessing() {
         return fastestProcessing.get();
@@ -104,7 +103,9 @@ public class MailProcessorManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getSlowestProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getSlowestProcessing()
      */
     public long getSlowestProcessing() {
         return slowestProcessing.get();
@@ -112,16 +113,21 @@ public class MailProcessorManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getErrorCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getErrorCount
+     * ()
      */
     public long getErrorCount() {
         return errorCount.get();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getSuccessCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getSuccessCount
+     * ()
      */
     public long getSuccessCount() {
         return successCount.get();
@@ -129,7 +135,9 @@ public class MailProcessorManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getLastProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getLastProcessing()
      */
     public long getLastProcessing() {
         return lastProcessing.get();

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailetManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailetManagement.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailetManagement.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MailetManagement.java Mon Apr  4 16:36:42 2011
@@ -29,7 +29,7 @@ import javax.management.StandardMBean;
 import org.apache.james.mailetcontainer.api.jmx.MailetManagementMBean;
 import org.apache.mailet.MailetConfig;
 
-public final class MailetManagement extends StandardMBean implements MailetManagementMBean{
+public final class MailetManagement extends StandardMBean implements MailetManagementMBean {
 
     private AtomicLong errorCount = new AtomicLong(0);
     private AtomicLong successCount = new AtomicLong(0);
@@ -38,21 +38,20 @@ public final class MailetManagement exte
     private AtomicLong lastProcessing = new AtomicLong(-1);
 
     private final MailetConfig config;
-    
+
     public MailetManagement(MailetConfig config) throws NotCompliantMBeanException {
         super(MailetManagementMBean.class);
         this.config = config;
-        
+
     }
- 
-   
+
     public void update(long processTime, boolean success) {
         long fastest = fastestProcessing.get();
-        
-        if ( fastest > processTime || fastest == -1) {
+
+        if (fastest > processTime || fastest == -1) {
             fastestProcessing.set(processTime);
         }
-        
+
         if (slowestProcessing.get() < processTime) {
             slowestProcessing.set(processTime);
         }
@@ -62,11 +61,14 @@ public final class MailetManagement exte
             errorCount.incrementAndGet();
         }
         lastProcessing.set(processTime);
-    } 
-    
+    }
+
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailetManagementMBean#getMailetName()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.jmx.MailetManagementMBean#getMailetName
+     * ()
      */
     public String getMailetName() {
         return config.getMailetName();
@@ -74,7 +76,9 @@ public final class MailetManagement exte
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailetManagementMBean#getMailetParameters()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailetManagementMBean#
+     * getMailetParameters()
      */
     @SuppressWarnings("unchecked")
     public String[] getMailetParameters() {
@@ -89,28 +93,32 @@ public final class MailetManagement exte
         return result;
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getErrorCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getErrorCount
+     * ()
      */
     public long getErrorCount() {
         return errorCount.get();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getFastestProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getFastestProcessing()
      */
     public long getFastestProcessing() {
         return fastestProcessing.get();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getHandledMailCount()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getHandledMailCount()
      */
     public long getHandledMailCount() {
         return getErrorCount() + getSuccessCount();
@@ -118,7 +126,9 @@ public final class MailetManagement exte
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getSlowestProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getSlowestProcessing()
      */
     public long getSlowestProcessing() {
         return slowestProcessing.get();
@@ -126,16 +136,19 @@ public final class MailetManagement exte
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MailetManagementMBean#getSuccessCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MailetManagementMBean#getSuccessCount()
      */
     public long getSuccessCount() {
         return successCount.get();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getLastProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getLastProcessing()
      */
     public long getLastProcessing() {
         return lastProcessing.get();

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MatcherManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MatcherManagement.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MatcherManagement.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/jmx/MatcherManagement.java Mon Apr  4 16:36:42 2011
@@ -26,8 +26,7 @@ import javax.management.StandardMBean;
 import org.apache.james.mailetcontainer.api.jmx.MatcherManagementMBean;
 import org.apache.mailet.MatcherConfig;
 
-
-public final class MatcherManagement extends StandardMBean implements MatcherManagementMBean{
+public final class MatcherManagement extends StandardMBean implements MatcherManagementMBean {
     private MatcherConfig matcherConfig;
     private AtomicLong errorCount = new AtomicLong(0);
     private AtomicLong successCount = new AtomicLong(0);
@@ -36,21 +35,20 @@ public final class MatcherManagement ext
     private AtomicLong matchedCount = new AtomicLong(0);
     private AtomicLong notMatchedCount = new AtomicLong(0);
     private AtomicLong lastProcessing = new AtomicLong(-1);
-    
+
     public MatcherManagement(MatcherConfig matcherConfig) throws NotCompliantMBeanException {
         super(MatcherManagementMBean.class);
         this.matcherConfig = matcherConfig;
 
     }
 
-
     public void update(long processTime, boolean success, boolean matched) {
         long fastest = fastestProcessing.get();
-        
-        if ( fastest > processTime || fastest == -1) {
+
+        if (fastest > processTime || fastest == -1) {
             fastestProcessing.set(processTime);
         }
-        
+
         if (slowestProcessing.get() < processTime) {
             slowestProcessing.set(processTime);
         }
@@ -64,25 +62,27 @@ public final class MatcherManagement ext
         } else {
             notMatchedCount.incrementAndGet();
         }
-        
+
         lastProcessing.set(processTime);
 
-    } 
-    
-    
-    
+    }
+
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MatcherManagementMBean#getMatcherName()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MatcherManagementMBean#getMatcherName()
      */
     public String getMatcherName() {
         return matcherConfig.getMatcherName();
     }
-    
-    
+
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MatcherManagementMBean#getMatcherCondition()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MatcherManagementMBean#getMatcherCondition
+     * ()
      */
     public String getMatcherCondition() {
         return matcherConfig.getCondition();
@@ -90,6 +90,7 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.mailetcontainer.MailProcessingMBean#getErrorCount()
      */
     public long getErrorCount() {
@@ -98,7 +99,10 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MailProcessingMBean#getFastestProcessing()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MailProcessingMBean#getFastestProcessing
+     * ()
      */
     public long getFastestProcessing() {
         return fastestProcessing.get();
@@ -106,7 +110,10 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MailProcessingMBean#getHandledMailCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MailProcessingMBean#getHandledMailCount
+     * ()
      */
     public long getHandledMailCount() {
         return getSuccessCount() + getErrorCount();
@@ -115,7 +122,10 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MailProcessingMBean#getSlowestProcessing()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MailProcessingMBean#getSlowestProcessing
+     * ()
      */
     public long getSlowestProcessing() {
         return slowestProcessing.get();
@@ -123,7 +133,9 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.MailProcessingMBean#getSuccessCount()
+     * 
+     * @see
+     * org.apache.james.mailetcontainer.MailProcessingMBean#getSuccessCount()
      */
     public long getSuccessCount() {
         return successCount.get();
@@ -131,7 +143,9 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MatcherManagementMBean#getMatchedCount()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MatcherManagementMBean#
+     * getMatchedCount()
      */
     public long getMatchedCount() {
         return matchedCount.get();
@@ -139,19 +153,21 @@ public final class MatcherManagement ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MatcherManagementMBean#getNotMatchedCount()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MatcherManagementMBean#
+     * getNotMatchedCount()
      */
     public long getNotMatchedCount() {
         return notMatchedCount.get();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#getLastProcessing()
+     * 
+     * @see org.apache.james.mailetcontainer.api.jmx.MailProcessingMBean#
+     * getLastProcessing()
      */
     public long getLastProcessing() {
         return lastProcessing.get();
     }
 }
-

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/And.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/And.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/And.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/And.java Mon Apr  4 16:36:42 2011
@@ -30,7 +30,6 @@ import org.apache.mailet.Matcher;
 
 /**
  * This matcher performs And conjunction between the two recipients
- * 
  */
 public class And extends GenericCompositeMatcher {
 

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/CompositeMatcher.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/CompositeMatcher.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/CompositeMatcher.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/CompositeMatcher.java Mon Apr  4 16:36:42 2011
@@ -17,7 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
 package org.apache.james.mailetcontainer.lib.matchers;
 
 import java.util.Iterator;

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/GenericCompositeMatcher.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/GenericCompositeMatcher.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/GenericCompositeMatcher.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/GenericCompositeMatcher.java Mon Apr  4 16:36:42 2011
@@ -17,7 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
 package org.apache.james.mailetcontainer.lib.matchers;
 
 import java.util.Collection;

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/Not.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/Not.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/Not.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/matchers/Not.java Mon Apr  4 16:36:42 2011
@@ -1,5 +1,3 @@
-package org.apache.james.mailetcontainer.lib.matchers;
-
 /****************************************************************
  * Licensed to the Apache Software Foundation (ASF) under one   *
  * or more contributor license agreements.  See the NOTICE file *
@@ -19,6 +17,8 @@ package org.apache.james.mailetcontainer
  * under the License.                                           *
  ****************************************************************/
 
+package org.apache.james.mailetcontainer.lib.matchers;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java?rev=1088681&r1=1088680&r2=1088681&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractNotify.java Mon Apr  4 16:36:42 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.transport.mailets;
 
 import org.apache.mailet.base.RFC2822Headers;
@@ -34,79 +32,87 @@ import java.util.Collection;
 import java.util.Iterator;
 
 /**
- * <P>Abstract mailet providing configurable notification services.<BR>
- * This mailet can be subclassed to make authoring notification mailets simple.<BR>
- * <P>Provides the following functionalities to all notification subclasses:</P>
- * <UL>
- * <LI>A common notification message layout.</LI>
- * <LI>A sender of the notification message can optionally be specified.
- * If one is not specified, the postmaster's address will be used.</LI>
- * <LI>A notice text can be specified, and in such case will be inserted into the 
- * notification inline text.</LI>
- * <LI>If the notified message has an "error message" set, it will be inserted into the 
- * notification inline text. If the <CODE>attachStackTrace</CODE> init parameter
- * is set to true, such error message will be attached to the notification message.</LI>
- * <LI>The notified messages are attached in their entirety (headers and
- * content) and the resulting MIME part type is "message/rfc822".</LI>
- * <LI>Supports by default the <CODE>passThrough</CODE> init parameter (true if missing).</LI>
- * </UL>
- *
- * <P>Sample configuration common to all notification mailet subclasses:</P>
- * <PRE><CODE>
- * &lt;mailet match="All" class="<I>a notification mailet</I>">
- *   &lt;sender&gt;<I>an address or postmaster or sender or unaltered, default=postmaster</I>&lt;/sender&gt;
- *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
- *   &lt;message&gt;<I>notice attached to the original message text (optional)</I>&lt;/message&gt;
- *   &lt;prefix&gt;<I>optional subject prefix prepended to the original message</I>&lt;/prefix&gt;
- *   &lt;inline&gt;<I>see {@link Redirect}, default=none</I>&lt;/inline&gt;
- *   &lt;attachment&gt;<I>see {@link Redirect}, default=message</I>&lt;/attachment&gt;
- *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
- *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
- *   &lt;debug&gt;<I>true or false, default=false</I>&lt;/debug&gt;
+ * <p>
+ * Abstract mailet providing configurable notification services.<br>
+ * This mailet can be subclassed to make authoring notification mailets simple.
+ * <br>
+ * <p>
+ * Provides the following functionalities to all notification subclasses:
+ * </p>
+ * <ul>
+ * <li>A common notification message layout.</li>
+ * <li>A sender of the notification message can optionally be specified. If one
+ * is not specified, the postmaster's address will be used.</li>
+ * <li>A notice text can be specified, and in such case will be inserted into
+ * the notification inline text.</li>
+ * <li>If the notified message has an "error message" set, it will be inserted
+ * into the notification inline text. If the <code>attachStackTrace</code> init
+ * parameter is set to true, such error message will be attached to the
+ * notification message.</li>
+ * <li>The notified messages are attached in their entirety (headers and
+ * content) and the resulting MIME part type is "message/rfc822".</li>
+ * <li>Supports by default the <code>passThrough</code> init parameter (true if
+ * missing).</li>
+ * </ul>
+ * 
+ * <p>
+ * Sample configuration common to all notification mailet subclasses:
+ * </p>
+ * 
+ * <pre>
+ * <code>
+ * &lt;mailet match="All" class="<i>a notification mailet</i>">
+ *   &lt;sender&gt;<i>an address or postmaster or sender or unaltered, default=postmaster</i>&lt;/sender&gt;
+ *   &lt;attachError&gt;<i>true or false, default=false</i>&lt;/attachError&gt;
+ *   &lt;message&gt;<i>notice attached to the original message text (optional)</i>&lt;/message&gt;
+ *   &lt;prefix&gt;<i>optional subject prefix prepended to the original message</i>&lt;/prefix&gt;
+ *   &lt;inline&gt;<i>see {@link Redirect}, default=none</i>&lt;/inline&gt;
+ *   &lt;attachment&gt;<i>see {@link Redirect}, default=message</i>&lt;/attachment&gt;
+ *   &lt;passThrough&gt;<i>true or false, default=true</i>&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<i>true or false, default=true</i>&lt;/fakeDomainCheck&gt;
+ *   &lt;debug&gt;<i>true or false, default=false</i>&lt;/debug&gt;
  * &lt;/mailet&gt;
- * </CODE></PRE>
- * <P><I>notice</I> and <I>senderAddress</I> can be used instead of
- * <I>message</I> and <I>sender</I>; such names are kept for backward compatibility.</P>
- *
- * @version CVS $Revision$ $Date$
+ * </code>
+ * </pre>
+ * <p>
+ * <i>notice</i> and <i>senderAddress</i> can be used instead of <i>message</i>
+ * and <i>sender</i>; such names are kept for backward compatibility.
+ * </p>
+ * 
  * @since 2.2.0
  */
 public abstract class AbstractNotify extends AbstractRedirect {
 
-    /* ******************************************************************** */
-    /* ****************** Begin of getX and setX methods ****************** */
-    /* ******************************************************************** */
-
     /**
-     * @return the <CODE>passThrough</CODE> init parameter, or true if missing
+     * @return the <code>passThrough</code> init parameter, or true if missing
      */
     protected boolean getPassThrough() throws MessagingException {
-        return Boolean.valueOf(getInitParameter("passThrough","true"));
+        return Boolean.valueOf(getInitParameter("passThrough", "true"));
     }
 
     /**
-     * @return the <CODE>inline</CODE> init parameter, or <CODE>NONE</CODE> if missing
+     * @return the <code>inline</code> init parameter, or <code>NONE</code> if
+     *         missing
      */
     protected int getInLineType() throws MessagingException {
-        return getTypeCode(getInitParameter("inline","none"));
+        return getTypeCode(getInitParameter("inline", "none"));
     }
 
     /**
-     * @return the <CODE>attachment</CODE> init parameter, or <CODE>MESSAGE</CODE> if missing
+     * @return the <code>attachment</code> init parameter, or
+     *         <code>MESSAGE</code> if missing
      */
     protected int getAttachmentType() throws MessagingException {
-        return getTypeCode(getInitParameter("attachment","message"));
+        return getTypeCode(getInitParameter("attachment", "message"));
     }
 
     /**
-     * @return the <CODE>notice</CODE> init parameter,
-     * or the <CODE>message</CODE> init parameter if missing,
-     * or a default string if both are missing
+     * @return the <code>notice</code> init parameter, or the
+     *         <code>message</code> init parameter if missing, or a default
+     *         string if both are missing
      */
     protected String getMessage() {
-        return getInitParameter("notice",
-                getInitParameter("message",
-                "We were unable to deliver the attached message because of an error in the mail server."));
+        return getInitParameter("notice", getInitParameter("message", "We were unable to deliver the attached message because of an error in the mail server."));
     }
 
     /**
@@ -174,7 +180,8 @@ public abstract class AbstractNotify ext
         return sout.toString();
     }
 
-    // All subclasses of AbstractNotify are expected to establish their own recipients
+    // All subclasses of AbstractNotify are expected to establish their own
+    // recipients
     abstract protected Collection getRecipients() throws MessagingException;
 
     /**
@@ -185,43 +192,43 @@ public abstract class AbstractNotify ext
     }
 
     /**
-     * @return <CODE>SpecialAddress.NULL</CODE>, that will remove the "ReplyTo:" header
+     * @return <code>SpecialAddress.NULL</code>, that will remove the "ReplyTo:"
+     *         header
      */
     protected MailAddress getReplyTo() throws MessagingException {
         return SpecialAddress.NULL;
     }
 
     /**
-     * @return {@link AbstractRedirect#getSender(Mail)}, meaning the new requested sender if any
+     * @return {@link AbstractRedirect#getSender(Mail)}, meaning the new
+     *         requested sender if any
      */
     protected MailAddress getReversePath(Mail originalMail) throws MessagingException {
         return getSender(originalMail);
     }
 
     /**
-     * @return the <CODE>sendingAddress</CODE> init parameter
-     * or the <CODE>sender</CODE> init parameter
-     * or the postmaster address if both are missing;
-     * possible special addresses returned are
-     * <CODE>SpecialAddress.SENDER</CODE>
-     * and <CODE>SpecialAddress.UNALTERED</CODE>
+     * @return the <code>sendingAddress</code> init parameter or the
+     *         <code>sender</code> init parameter or the postmaster address if
+     *         both are missing; possible special addresses returned are
+     *         <code>SpecialAddress.SENDER</code> and
+     *         <code>SpecialAddress.UNALTERED</code>
      */
     protected MailAddress getSender() throws MessagingException {
-        String addressString = getInitParameter("sendingAddress",getInitParameter("sender"));
-        
+        String addressString = getInitParameter("sendingAddress", getInitParameter("sender"));
+
         if (addressString == null) {
             return getMailetContext().getPostmaster();
         }
-        
-        MailAddress specialAddress = getSpecialAddress(addressString,
-                                        new String[] {"postmaster", "sender", "unaltered"});
+
+        MailAddress specialAddress = getSpecialAddress(addressString, new String[] { "postmaster", "sender", "unaltered" });
         if (specialAddress != null) {
             return specialAddress;
         }
 
         try {
             return new MailAddress(addressString);
-        } catch(Exception e) {
+        } catch (Exception e) {
             throw new MessagingException("Exception thrown in getSender() parsing: " + addressString, e);
         }
     }
@@ -234,22 +241,22 @@ public abstract class AbstractNotify ext
     }
 
     /**
-     * @return the <CODE>prefix</CODE> init parameter or "Re:" if missing
+     * @return the <code>prefix</code> init parameter or "Re:" if missing
      */
     protected String getSubjectPrefix() {
-        return getInitParameter("prefix","Re:");
+        return getInitParameter("prefix", "Re:");
     }
 
     /**
-     * Builds the subject of <I>newMail</I> appending the subject
-     * of <I>originalMail</I> to <I>subjectPrefix</I>, but avoiding a duplicate.
+     * Builds the subject of <i>newMail</i> appending the subject of
+     * <i>originalMail</i> to <i>subjectPrefix</i>, but avoiding a duplicate.
      */
     protected void setSubjectPrefix(Mail newMail, String subjectPrefix, Mail originalMail) throws MessagingException {
         String subject = originalMail.getMessage().getSubject();
         if (subject == null) {
             subject = "";
         }
-        if (subjectPrefix==null || subject.indexOf(subjectPrefix) == 0) {
+        if (subjectPrefix == null || subject.indexOf(subjectPrefix) == 0) {
             newMail.getMessage().setSubject(subject);
         } else {
             newMail.getMessage().setSubject(subjectPrefix + subject);
@@ -262,9 +269,4 @@ public abstract class AbstractNotify ext
     protected boolean isReply() {
         return true;
     }
-
-    /* ******************************************************************** */
-    /* ******************* End of getX and setX methods ******************* */
-    /* ******************************************************************** */
-
 }



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