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 20:44:59 UTC

svn commit: r1088712 [5/5] - in /james/server/trunk: osgi/src/main/java/org/apache/james/container/osgi/ pop3server/src/main/java/org/apache/james/pop3server/ pop3server/src/main/java/org/apache/james/pop3server/core/ pop3server/src/main/java/org/apach...

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java Mon Apr  4 18:44:55 2011
@@ -17,9 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
-
 package org.apache.james.smtpserver.fastfail;
 
 import java.io.IOException;
@@ -51,38 +48,44 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Extract domains from message and check against URIRBLServer. For more informations see http://www.surbl.org
+ * Extract domains from message and check against URIRBLServer. For more
+ * informations see <a href="http://www.surbl.org">www.surbl.org</a>
  */
 public class URIRBLHandler implements LogEnabled, JamesMessageHook, Configurable {
 
     /** This log is the fall back shared by all instances */
     private static final Logger FALLBACK_LOG = LoggerFactory.getLogger(URIRBLHandler.class);
-    
-    /** Non context specific log should only be used when no context specific log is available */
+
+    /**
+     * Non context specific log should only be used when no context specific log
+     * is available
+     */
     private Logger serviceLog = FALLBACK_LOG;
-    
-    private final static String LISTED_DOMAIN ="LISTED_DOMAIN";
-    
+
+    private final static String LISTED_DOMAIN = "LISTED_DOMAIN";
+
     private final static String URBLSERVER = "URBL_SERVER";
-    
+
     private DNSService dnsService;
 
     private Collection<String> uriRbl;
 
     private boolean getDetail = false;
 
-
     /**
-     * Sets the service log.
+     * Sets the service log.<br>
      * Where available, a context sensitive log should be used.
-     * @param Log not null
+     * 
+     * @param Log
+     *            not null
      */
     public void setLog(Logger log) {
         this.serviceLog = log;
     }
-    
+
     /**
      * Gets the DNS service.
+     * 
      * @return the dnsService
      */
     public final DNSService getDNSService() {
@@ -91,23 +94,26 @@ public class URIRBLHandler implements Lo
 
     /**
      * Sets the DNS service.
-     * @param dnsService the dnsService to set
+     * 
+     * @param dnsService
+     *            the dnsService to set
      */
-    @Resource(name="dnsservice")
+    @Resource(name = "dnsservice")
     public final void setDNSService(DNSService dnsService) {
         this.dnsService = dnsService;
     }
-    
-    
 
     /*
      * (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 {
         String[] servers = config.getStringArray("uriRblServers.server");
         Collection<String> serverCollection = new ArrayList<String>();
-        for ( int i = 0 ; i < servers.length ; i++ ) {
+        for (int i = 0; i < servers.length; i++) {
             String rblServerName = servers[i];
             serverCollection.add(rblServerName);
             if (serviceLog.isInfoEnabled()) {
@@ -119,31 +125,34 @@ public class URIRBLHandler implements Lo
         } else {
             throw new ConfigurationException("Please provide at least one server");
         }
-            
-        setGetDetail(config.getBoolean("getDetail",false));        
-        
+
+        setGetDetail(config.getBoolean("getDetail", false));
+
     }
-   
+
     /**
      * Set the UriRBL Servers
      * 
-     * @param uriRbl The Collection holding the servers
+     * @param uriRbl
+     *            The Collection holding the servers
      */
     public void setUriRblServer(Collection<String> uriRbl) {
         this.uriRbl = uriRbl;
     }
 
     /**
-     * Set for try to get a TXT record for the blocked record. 
+     * Set for try to get a TXT record for the blocked record.
      * 
-     * @param getDetail Set to ture for enable
+     * @param getDetail
+     *            Set to ture for enable
      */
     public void setGetDetail(boolean getDetail) {
         this.getDetail = getDetail;
     }
-    
+
     /**
-     * @see org.apache.james.smtpserver.JamesMessageHook#onMessage(org.apache.james.protocols.smtp.SMTPSession, org.apache.mailet.Mail)
+     * @see org.apache.james.smtpserver.JamesMessageHook#onMessage(org.apache.james.protocols.smtp.SMTPSession,
+     *      org.apache.mailet.Mail)
      */
     public HookResult onMessage(SMTPSession session, Mail mail) {
         if (check(session, mail)) {
@@ -153,7 +162,7 @@ public class URIRBLHandler implements Lo
 
             // we should try to retrieve details
             if (getDetail) {
-                Collection<String> txt = dnsService.findTXTRecords(target+ "." + uRblServer);
+                Collection<String> txt = dnsService.findTXTRecords(target + "." + uRblServer);
 
                 // Check if we found a txt record
                 if (!txt.isEmpty()) {
@@ -164,13 +173,10 @@ public class URIRBLHandler implements Lo
             }
 
             if (detail != null) {
-                return new HookResult(HookReturnCode.DENY, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
-                    + "Rejected: message contains domain " + target + " listed by " + uRblServer +" . Details: " 
-                    + detail);
+                return new HookResult(HookReturnCode.DENY, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER) + "Rejected: message contains domain " + target + " listed by " + uRblServer + " . Details: " + detail);
             } else {
-                return new HookResult(HookReturnCode.DENY, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
-                    + " Rejected: message contains domain " + target + " listed by " + uRblServer);
-            }  
+                return new HookResult(HookReturnCode.DENY, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER) + " Rejected: message contains domain " + target + " listed by " + uRblServer);
+            }
 
         } else {
             return new HookResult(HookReturnCode.DECLINED);
@@ -180,20 +186,23 @@ public class URIRBLHandler implements Lo
     /**
      * Recursively scans all MimeParts of an email for domain strings. Domain
      * strings that are found are added to the supplied HashSet.
-     *
-     * @param part MimePart to scan
-     * @param session not null
-     * @return domains The HashSet that contains the domains which were extracted
+     * 
+     * @param part
+     *            MimePart to scan
+     * @param session
+     *            not null
+     * @return domains The HashSet that contains the domains which were
+     *         extracted
      */
     private HashSet<String> scanMailForDomains(MimePart part, SMTPSession session) throws MessagingException, IOException {
         HashSet<String> domains = new HashSet<String>();
         session.getLogger().debug("mime type is: \"" + part.getContentType() + "\"");
-       
+
         if (part.isMimeType("text/plain") || part.isMimeType("text/html")) {
             session.getLogger().debug("scanning: \"" + part.getContent().toString() + "\"");
             HashSet<String> newDom = URIScanner.scanContentForDomains(domains, part.getContent().toString());
-           
-            // Check if new domains are found and add the domains 
+
+            // Check if new domains are found and add the domains
             if (newDom != null && newDom.size() > 0) {
                 domains.addAll(newDom);
             }
@@ -201,14 +210,14 @@ public class URIRBLHandler implements Lo
             MimeMultipart multipart = (MimeMultipart) part.getContent();
             int count = multipart.getCount();
             session.getLogger().debug("multipart count is: " + count);
-          
+
             for (int index = 0; index < count; index++) {
                 session.getLogger().debug("recursing index: " + index);
                 MimeBodyPart mimeBodyPart = (MimeBodyPart) multipart.getBodyPart(index);
                 HashSet<String> newDomains = scanMailForDomains(mimeBodyPart, session);
-                
-                // Check if new domains are found and add the domains 
-                if(newDomains != null && newDomains.size() > 0) {
+
+                // Check if new domains are found and add the domains
+                if (newDomains != null && newDomains.size() > 0) {
                     domains.addAll(newDomains);
                 }
             }
@@ -221,7 +230,7 @@ public class URIRBLHandler implements Lo
      */
     protected boolean check(SMTPSession session, Mail mail) {
         MimeMessage message;
-        
+
         try {
             message = mail.getMessage();
 
@@ -232,21 +241,21 @@ public class URIRBLHandler implements Lo
             while (fDomains.hasNext()) {
                 Iterator<String> uRbl = uriRbl.iterator();
                 String target = fDomains.next().toString();
-                
+
                 while (uRbl.hasNext()) {
                     try {
                         String uRblServer = uRbl.next().toString();
                         String address = target + "." + uRblServer;
-                        
+
                         if (session.getLogger().isDebugEnabled()) {
                             session.getLogger().debug("Lookup " + address);
                         }
-                        
+
                         dnsService.getByName(address);
-            
+
                         // store server name for later use
                         session.getState().put(URBLSERVER, uRblServer);
-                        session.getState().put(LISTED_DOMAIN,target);
+                        session.getState().put(LISTED_DOMAIN, target);
 
                         return true;
 

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIScanner.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIScanner.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIScanner.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/URIScanner.java Mon Apr  4 18:44:55 2011
@@ -17,9 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
-
 package org.apache.james.smtpserver.fastfail;
 
 import java.net.URI;
@@ -39,27 +36,23 @@ public class URIScanner {
 
     static private final String mark = "-_.!~*'()";
 
-    static private final String unreserved = "A-Za-z0-9" + escape(mark)
-        + "\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f";
+    static private final String unreserved = "A-Za-z0-9" + escape(mark) + "\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f";
 
     static private final String uricSet = escape(reserved) + unreserved + "%";
 
-    static private final String uricNoColon = escape(reservedNoColon)
-        + unreserved + "%";
+    static private final String uricNoColon = escape(reservedNoColon) + unreserved + "%";
 
     static private final String schemeRE = "(?-xism:(?:https?|ftp|mailto|javascript|file))";
 
     static private final String schemelessRE = "(?-xism:(?<![.=])(?:(?i)www\\d*\\.|(?i)ftp\\.))";
 
-    static private final String uriRE = "(?-xism:\\b(?:" + schemeRE + ":["
-        + uricNoColon + "]|" + schemelessRE + ")[" + uricSet + "#]*)";
+    static private final String uriRE = "(?-xism:\\b(?:" + schemeRE + ":[" + uricNoColon + "]|" + schemelessRE + ")[" + uricSet + "#]*)";
 
     /** Pre-compiled pattern that matches URIs */
     static private final Pattern uriPattern = Pattern.compile(uriRE);
 
     /** Pre-compiled pattern that matches URI scheme strings */
-    static private final Pattern schemePattern = Pattern.compile("^" + schemeRE
-        + ":");
+    static private final Pattern schemePattern = Pattern.compile("^" + schemeRE + ":");
 
     /** Pre-compiled pattern used to cleanup a found URI string */
     static private final Pattern uriCleanup = Pattern.compile("^<(.*)>$");
@@ -68,8 +61,7 @@ public class URIScanner {
     static private final Pattern uriCleanup2 = Pattern.compile("[\\]\\)>#]$");
 
     /** Pre-compile pattern for identifying "mailto" patterns */
-    static private final Pattern uriCleanup3 = Pattern
-        .compile("^(?i)mailto:([^\\/]{2})(.*)$");
+    static private final Pattern uriCleanup3 = Pattern.compile("^(?i)mailto:([^\\/]{2})(.*)$");
 
     // These regular expressions also "inspired" by Spamassassin
     static private final String esc = "\\\\";
@@ -90,47 +82,40 @@ public class URIScanner {
 
     static private final String qtext = "[^" + esc + nonASCII + cr_list + "\"]";
 
-    static private final String dtext = "[^" + esc + nonASCII + cr_list
-        + open_br + close_br + "]";
+    static private final String dtext = "[^" + esc + nonASCII + cr_list + open_br + close_br + "]";
 
     static private final String quoted_pair = esc + "[^" + nonASCII + "]";
 
-    static private final String atom_char = "[^(" + space + ")<>@,;:\"." + esc
-        + open_br + close_br + ctrl + nonASCII + "]";
+    static private final String atom_char = "[^(" + space + ")<>@,;:\"." + esc + open_br + close_br + ctrl + nonASCII + "]";
 
     static private final String atom = "(?>" + atom_char + "+)";
 
-    static private final String quoted_str = "\"" + qtext + "*(?:"
-        + quoted_pair + qtext + "*)*\"";
+    static private final String quoted_str = "\"" + qtext + "*(?:" + quoted_pair + qtext + "*)*\"";
 
     static private final String word = "(?:" + atom + "|" + quoted_str + ")";
 
-    static private final String local_part = word + "(?:" + period + word
-        + ")*";
+    static private final String local_part = word + "(?:" + period + word + ")*";
 
     static private final String label = "[A-Za-z\\d](?:[A-Za-z\\d-]*[A-Za-z\\d])?";
 
-    static private final String domain_ref = label + "(?:" + period + label
-        + ")*";
+    static private final String domain_ref = label + "(?:" + period + label + ")*";
 
-    static private final String domain_lit = open_br + "(?:" + dtext + "|"
-        + quoted_pair + ")*" + close_br;
+    static private final String domain_lit = open_br + "(?:" + dtext + "|" + quoted_pair + ")*" + close_br;
 
-    static private final String domain = "(?:" + domain_ref + "|" + domain_lit
-        + ")";
+    static private final String domain = "(?:" + domain_ref + "|" + domain_lit + ")";
 
-    static private final String Addr_spec_re = "(?-xism:" + local_part
-        + "\\s*\\@\\s*" + domain + ")";
+    static private final String Addr_spec_re = "(?-xism:" + local_part + "\\s*\\@\\s*" + domain + ")";
 
     /** Pre-compiled pattern for matching "schemeless" mailto strings */
-    static private final Pattern emailAddrPattern = Pattern
-        .compile(Addr_spec_re);
+    static private final Pattern emailAddrPattern = Pattern.compile(Addr_spec_re);
 
     /** Simple reqular expression to match an octet part of an IP address */
     static private final String octet = "(?:[1-2][0-9][0-9])|(?:[1-9][0-9])|(?:[0-9])";
 
-    /** Simple regular expression to match a part of a domain string in the
-     TLDLookup cache. */
+    /**
+     * Simple regular expression to match a part of a domain string in the
+     * TLDLookup cache.
+     */
     static private final String tld = "[A-Za-z0-9\\-]*";
 
     /** Simple regular expression that matches a two-part TLD */
@@ -139,59 +124,75 @@ public class URIScanner {
     /** Simple regular expression that matches a three-part TLD */
     static private final String tld3 = tld + "\\." + tld + "\\." + tld;
 
-    /** Regular expression that matches and captures parts of a possible 
-     one-part TLD domain string */
+    /**
+     * Regular expression that matches and captures parts of a possible one-part
+     * TLD domain string
+     */
     static private final String tldCap = "(" + tld + "\\.(" + tld + "))$";
 
-    /** Regular expression that matches and captures parts of a possible 
-     two-part TLD domain string */
+    /**
+     * Regular expression that matches and captures parts of a possible two-part
+     * TLD domain string
+     */
     static private final String tld2Cap = "(" + tld + "\\.(" + tld2 + "))$";
 
-    /** Regular expression that matches and captures parts of a possible 
-     three-part TLD domain string */
+    /**
+     * Regular expression that matches and captures parts of a possible
+     * three-part TLD domain string
+     */
     static private final String tld3Cap = "(" + tld + "\\.(" + tld3 + "))$";
 
     /** Regular expression that matches and captures parts of an IP address */
-    static private final String ipCap = "((" + octet + ")\\.(" + octet
-        + ")\\.(" + octet + ")\\.(" + octet + "))$";
+    static private final String ipCap = "((" + octet + ")\\.(" + octet + ")\\.(" + octet + ")\\.(" + octet + "))$";
 
     /** Pre-compiled pattern that matches IP addresses */
     static private final Pattern ipCapPattern = Pattern.compile(ipCap);
 
-    /** Pre-compiled pattern that matches domain string that is possibly
-     contained in a one-part TLD */
+    /**
+     * Pre-compiled pattern that matches domain string that is possibly
+     * contained in a one-part TLD
+     */
     static private final Pattern tldCapPattern = Pattern.compile(tldCap);
 
-    /** Pre-compiled pattern that matches domain string that is possibly
-     contained in a two-part TLD */
+    /**
+     * Pre-compiled pattern that matches domain string that is possibly
+     * contained in a two-part TLD
+     */
     static private final Pattern tld2CapPattern = Pattern.compile(tld2Cap);
 
-    /** Pre-compiled pattern that matches domain string that is possibly
-     contained in a three-part TLD */
+    /**
+     * Pre-compiled pattern that matches domain string that is possibly
+     * contained in a three-part TLD
+     */
     static private final Pattern tld3CapPattern = Pattern.compile(tld3Cap);
- 
+
     /** controls testing/debug output */
     static private boolean testing = false;
 
     /**
-     * Scans a character sequence for URIs. Then add all unique domain strings 
+     * <p>
+     * Scans a character sequence for URIs. Then add all unique domain strings
      * derived from those found URIs to the supplied HashSet.
+     * </p>
      * <p>
      * This function calls scanContentForHosts() to grab all the host strings.
      * Then it calls domainFromHost() on each host string found to distill them
-     * to their basic "registrar" domains. 
-     *
-     * @param domains a HashSet to be populated with all domain strings found in
-     *        the content
-     * @param content a character sequence to be scanned for URIs
+     * to their basic "registrar" domains.
+     * </p>
+     * 
+     * @param domains
+     *            a HashSet to be populated with all domain strings found in the
+     *            content
+     * @param content
+     *            a character sequence to be scanned for URIs
      * @return newDomains the domains which were extracted
      */
     static public HashSet<String> scanContentForDomains(HashSet<String> domains, CharSequence content) {
         HashSet<String> newDomains = new HashSet<String>();
         HashSet<String> hosts = scanContentForHosts(content);
-        for (final String host:hosts) {
+        for (final String host : hosts) {
             final String domain = domainFromHost(host);
-    
+
             if (null != domain) {
                 if (false == domains.contains(domain)) {
                     newDomains.add(domain);
@@ -202,15 +203,16 @@ public class URIScanner {
     }
 
     /**
-     * Scans a character sequence for URIs. Then returns all unique host strings 
+     * Scans a character sequence for URIs. Then returns all unique host strings
      * derived from those found URIs in a HashSet
-     *
-     * @param content a character sequence to be scanned for URIs
+     * 
+     * @param content
+     *            a character sequence to be scanned for URIs
      * @return a HashSet containing host strings
      */
     static protected HashSet<String> scanContentForHosts(CharSequence content) {
         HashSet<String> set = new HashSet<String>();
-        
+
         // look for URIs
         Matcher mat = uriPattern.matcher(content);
         while (mat.find()) {
@@ -219,17 +221,17 @@ public class URIScanner {
             if (cleanMat.find()) {
                 found = cleanMat.group(1);
             }
-                
+
             cleanMat = uriCleanup2.matcher(found);
             if (cleanMat.find()) {
-               found = cleanMat.replaceAll("");
+                found = cleanMat.replaceAll("");
             }
-                
+
             cleanMat = uriCleanup3.matcher(found);
             if (cleanMat.find()) {
                 found = "mailto://" + cleanMat.group(1) + cleanMat.group(2);
             }
-        
+
             cleanMat = schemePattern.matcher(found);
             if (!cleanMat.find()) {
                 if (found.matches("^(?i)www\\d*\\..*")) {
@@ -238,7 +240,7 @@ public class URIScanner {
                     found = "ftp://" + found;
                 }
             }
-       
+
             String host = hostFromUriStr(found);
             if (null != host) {
                 host = host.toLowerCase();
@@ -254,12 +256,11 @@ public class URIScanner {
             String found = mat.group();
             debugOut("******** mailfound=\"" + found + "\"");
             found = "mailto://" + found;
-            debugOut("*******6 mailfoundfound=\"" + found
-                + "\" after cleanup 6");
-          
+            debugOut("*******6 mailfoundfound=\"" + found + "\" after cleanup 6");
+
             String host = hostFromUriStr(found);
             if (null != host) {
-                
+
                 host = host.toLowerCase();
                 if (false == set.contains(host)) {
                     set.add(host);
@@ -271,10 +272,11 @@ public class URIScanner {
 
     /**
      * Extracts and returns the host portion of URI string.
-     *
+     * 
      * This function uses java.net.URI.
-     *
-     * @param uriStr a string containing a URI
+     * 
+     * @param uriStr
+     *            a string containing a URI
      * @return the host portion of the supplied URI, null if no host string
      *         could be found
      */
@@ -299,16 +301,17 @@ public class URIScanner {
      * the correct registrar domain is not "co.uk", but "example.co.uk". If the
      * domain string is an IP address, then the octets are returned in reverse
      * order.
-     *
-     * @param host a string containing a host name
+     * 
+     * @param host
+     *            a string containing a host name
      * @return the registrar domain portion of the supplied host string
      */
     static protected String domainFromHost(String host) {
         debugOut("domainFromHost(\"" + host + "\")");
         String domain = null;
         Matcher mat;
-            
-        // IP addrs 
+
+        // IP addrs
         mat = ipCapPattern.matcher(host);
         if (mat.find()) {
             // reverse the octets now
@@ -361,8 +364,9 @@ public class URIScanner {
 
     /**
      * A utility function that "escapes" special characters in a string.
-     *
-     * @param str a string to be processed
+     * 
+     * @param str
+     *            a string to be processed
      * @return modified "escaped" string
      */
     private static String escape(String str) {

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java Mon Apr  4 18:44:55 2011
@@ -105,43 +105,47 @@ public class ValidRcptHandler extends Ab
         // check if the server use virtualhosting, if not use only the localpart
         // as username
         try {
-        if (users.supportVirtualHosting() == false) {
-            username = recipient.getLocalPart();
-        }
-
-        if (users.contains(username) == true) {
-            return true;
-        } else {
-
-            if (useVut == true) {
-                session.getLogger().debug("Unknown user " + username + " check if its an alias");
-
-                try {
-                    Collection<String> targetString = vut.getMappings(recipient.getLocalPart(), recipient.getDomain());
+            if (users.supportVirtualHosting() == false) {
+                username = recipient.getLocalPart();
+            }
 
-                    if (targetString != null && targetString.isEmpty() == false) {
-                        return true;
+            if (users.contains(username) == true) {
+                return true;
+            } else {
+
+                if (useVut == true) {
+                    session.getLogger().debug("Unknown user " + username + " check if its an alias");
+
+                    try {
+                        Collection<String> targetString = vut.getMappings(recipient.getLocalPart(), recipient.getDomain());
+
+                        if (targetString != null && targetString.isEmpty() == false) {
+                            return true;
+                        }
+                    } catch (ErrorMappingException e) {
+                        return false;
+                    } catch (VirtualUserTableException e) {
+                        session.getLogger().info("Unable to access VirtualUserTable", e);
+                        return false;
                     }
-                } catch (ErrorMappingException e) {
-                    return false;
-                } catch (VirtualUserTableException e) {
-                    session.getLogger().info("Unable to access VirtualUserTable", e);
-                    return false;
                 }
-            }
 
-            return false;
-        }
+                return false;
+            }
         } catch (UsersRepositoryException e) {
             session.getLogger().info("Unable to access UsersRepository", e);
             return false;
 
         }
     }
-    
+
     /*
      * (non-Javadoc)
-     * @see org.apache.james.protocols.smtp.core.fastfail.AbstractValidRcptHandler#isLocalDomain(org.apache.james.protocols.smtp.SMTPSession, java.lang.String)
+     * 
+     * @see
+     * org.apache.james.protocols.smtp.core.fastfail.AbstractValidRcptHandler
+     * #isLocalDomain(org.apache.james.protocols.smtp.SMTPSession,
+     * java.lang.String)
      */
     protected boolean isLocalDomain(SMTPSession session, String domain) {
         try {

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java Mon Apr  4 18:44:55 2011
@@ -45,35 +45,40 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * This class can be used to reject email with bogus MX which is send from a authorized user or an authorized
- * network.
+ * This class can be used to reject email with bogus MX which is send from a
+ * authorized user or an authorized network.
  */
-public class ValidRcptMX implements LogEnabled, RcptHook, Configurable{
+public class ValidRcptMX implements LogEnabled, RcptHook, Configurable {
 
     /** This log is the fall back shared by all instances */
     private static final Logger FALLBACK_LOG = LoggerFactory.getLogger(ValidRcptMX.class);
-    
-    /** Non context specific log should only be used when no context specific log is available */
+
+    /**
+     * Non context specific log should only be used when no context specific log
+     * is available
+     */
     private Logger serviceLog = FALLBACK_LOG;
-    
+
     private DNSService dnsService = null;
 
     private static final String LOCALHOST = "localhost";
 
     private NetMatcher bNetwork = null;
 
-
     /**
-     * Sets the service log.
+     * Sets the service log.<br>
      * Where available, a context sensitive log should be used.
-     * @param Log not null
+     * 
+     * @param Log
+     *            not null
      */
     public void setLog(Logger log) {
         this.serviceLog = log;
     }
-    
+
     /**
      * Gets the DNS service.
+     * 
      * @return the dnsService
      */
     public final DNSService getDNSService() {
@@ -82,23 +87,25 @@ public class ValidRcptMX implements LogE
 
     /**
      * Sets the DNS service.
-     * @param dnsService the dnsService to set
+     * 
+     * @param dnsService
+     *            the dnsService to set
      */
-    @Resource(name="dnsservice")
+    @Resource(name = "dnsservice")
     public final void setDNSService(DNSService dnsService) {
         this.dnsService = dnsService;
     }
-    
+
     /**
      * @see org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.Configuration)
      */
     @SuppressWarnings("unchecked")
-	public void configure(HierarchicalConfiguration config) throws ConfigurationException {
+    public void configure(HierarchicalConfiguration config) throws ConfigurationException {
 
         List<String> networks = config.getList("invalidMXNetworks");
 
         if (networks.isEmpty() == false) {
-        	
+
             Collection<String> bannedNetworks = new ArrayList<String>();
 
             for (int i = 0; i < networks.size(); i++) {
@@ -111,17 +118,18 @@ public class ValidRcptMX implements LogE
             serviceLog.info("Invalid MX Networks: " + bNetwork.toString());
 
         } else {
-            throw new ConfigurationException(
-                "Please configure at least on invalid MX network");
+            throw new ConfigurationException("Please configure at least on invalid MX network");
         }
-        
+
     }
 
     /**
      * Set the banned networks
      * 
-     * @param networks Collection of networks 
-     * @param dnsServer The DNSServer
+     * @param networks
+     *            Collection of networks
+     * @param dnsServer
+     *            The DNSServer
      */
     public void setBannedNetworks(Collection<String> networks, DNSService dnsServer) {
         bNetwork = new NetMatcher(networks, dnsServer) {
@@ -132,7 +140,8 @@ public class ValidRcptMX implements LogE
     }
 
     /**
-     * @see org.apache.james.protocols.smtp.hook.RcptHook#doRcpt(org.apache.james.protocols.smtp.SMTPSession, org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)
+     * @see org.apache.james.protocols.smtp.hook.RcptHook#doRcpt(org.apache.james.protocols.smtp.SMTPSession,
+     *      org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)
      */
     public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rcpt) {
 
@@ -140,7 +149,7 @@ public class ValidRcptMX implements LogE
 
         // Email should be deliver local
         if (!domain.equals(LOCALHOST)) {
- 
+
             Iterator<String> mx = null;
             try {
                 mx = dnsService.findMXRecords(domain).iterator();
@@ -152,13 +161,12 @@ public class ValidRcptMX implements LogE
                 while (mx.hasNext()) {
                     String mxRec = mx.next();
 
-                     try {
+                    try {
                         String ip = dnsService.getByName(mxRec).getHostAddress();
 
                         // Check for invalid MX
                         if (bNetwork.matchInetNetwork(ip)) {
-                            return new HookResult(HookReturnCode.DENY,SMTPRetCode.AUTH_REQUIRED, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_AUTH) + " Invalid MX " + session.getRemoteIPAddress() 
-                                    + " for domain " + domain + ". Reject email");
+                            return new HookResult(HookReturnCode.DENY, SMTPRetCode.AUTH_REQUIRED, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_AUTH) + " Invalid MX " + session.getRemoteIPAddress() + " for domain " + domain + ". Reject email");
                         }
                     } catch (UnknownHostException e) {
                         // Ignore this

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java Mon Apr  4 18:44:55 2011
@@ -17,7 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
 package org.apache.james.smtpserver.fastfail;
 
 import javax.annotation.Resource;
@@ -25,9 +24,9 @@ import javax.annotation.Resource;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.smtpserver.SMTPServerDNSServiceAdapter;
 
-public class ValidSenderDomainHandler extends org.apache.james.protocols.smtp.core.fastfail.ValidSenderDomainHandler{
+public class ValidSenderDomainHandler extends org.apache.james.protocols.smtp.core.fastfail.ValidSenderDomainHandler {
 
-    @Resource(name="dnsservice")
+    @Resource(name = "dnsservice")
     public void setDNSService(DNSService dns) {
         super.setDNSService(new SMTPServerDNSServiceAdapter(dns));
     }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/CommandHandlerResultJMXMonitor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/CommandHandlerResultJMXMonitor.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/CommandHandlerResultJMXMonitor.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/CommandHandlerResultJMXMonitor.java Mon Apr  4 18:44:55 2011
@@ -31,34 +31,35 @@ import org.apache.james.protocols.smtp.S
 
 /**
  * Expose JMX statistics for {@link CommandHandler}
- *
  */
 public class CommandHandlerResultJMXMonitor extends AbstractCommandHandlerResultJMXMonitor<SMTPResponse, SMTPSession> implements Configurable {
 
     private String jmxPath;
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.socket.AbstractCommandHandlerResultJMXMonitor#createCommandHandlerStats(org.apache.james.protocols.api.CommandHandler)
+     * 
+     * @see org.apache.james.socket.AbstractCommandHandlerResultJMXMonitor#
+     * createCommandHandlerStats(org.apache.james.protocols.api.CommandHandler)
      */
-    protected AbstractCommandHandlerStats<SMTPResponse> createCommandHandlerStats(CommandHandler<SMTPSession> handler) throws Exception{
+    protected AbstractCommandHandlerStats<SMTPResponse> createCommandHandlerStats(CommandHandler<SMTPSession> handler) throws Exception {
         Collection<String> col = handler.getImplCommands();
         String cName = handler.getClass().getName();
 
         return new SMTPCommandHandlerStats(jmxPath, cName, col.toArray(new String[col.size()]));
     }
 
-
-
     /*
      * (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 {
         this.jmxPath = config.getString("jmxName", getDefaultJMXName());
     }
-    
+
     protected String getDefaultJMXName() {
         return "smtpserver";
     }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/ConnectHandlerResultJMXMonitor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/ConnectHandlerResultJMXMonitor.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/ConnectHandlerResultJMXMonitor.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/ConnectHandlerResultJMXMonitor.java Mon Apr  4 18:44:55 2011
@@ -21,12 +21,13 @@ package org.apache.james.smtpserver.jmx;
 import org.apache.james.protocols.lib.jmx.AbstractConnectHandlerResultJMXMonitor;
 import org.apache.james.protocols.smtp.SMTPSession;
 
-public class ConnectHandlerResultJMXMonitor extends AbstractConnectHandlerResultJMXMonitor<SMTPSession>{
-
+public class ConnectHandlerResultJMXMonitor extends AbstractConnectHandlerResultJMXMonitor<SMTPSession> {
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.socket.AbstractConnectHandlerResultJMXMonitor#getDefaultJMXName()
+     * 
+     * @see org.apache.james.socket.AbstractConnectHandlerResultJMXMonitor#
+     * getDefaultJMXName()
      */
     protected String getDefaultJMXName() {
         return "smtpserver";

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java Mon Apr  4 18:44:55 2011
@@ -37,20 +37,24 @@ import org.apache.james.protocols.smtp.h
 import org.apache.james.protocols.smtp.hook.HookResultHook;
 
 /**
- * {@link HookResultHook} implementation which will register a {@link HookStatsMBean} under JMX for every Hook it processed 
- *
+ * {@link HookResultHook} implementation which will register a
+ * {@link HookStatsMBean} under JMX for every Hook it processed
  */
-public class HookResultJMXMonitor implements HookResultHook, ExtensibleHandler,Configurable {
+public class HookResultJMXMonitor implements HookResultHook, ExtensibleHandler, Configurable {
 
     private Map<String, HookStats> hookStats = new HashMap<String, HookStats>();
     private String jmxPath;
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.protocols.smtp.hook.HookResultHook#onHookResult(org.apache.james.protocols.smtp.SMTPSession, org.apache.james.protocols.smtp.hook.HookResult, long, org.apache.james.protocols.smtp.hook.Hook)
+     * 
+     * @see
+     * org.apache.james.protocols.smtp.hook.HookResultHook#onHookResult(org.
+     * apache.james.protocols.smtp.SMTPSession,
+     * org.apache.james.protocols.smtp.hook.HookResult, long,
+     * org.apache.james.protocols.smtp.hook.Hook)
      */
-    public HookResult onHookResult(SMTPSession session, HookResult result, long executionTime,
-            Hook hook) {
+    public HookResult onHookResult(SMTPSession session, HookResult result, long executionTime, Hook hook) {
         String hookName = hook.getClass().getName();
         HookStats stats = hookStats.get(hookName);
         if (stats != null) {
@@ -59,22 +63,22 @@ public class HookResultJMXMonitor implem
         return result;
     }
 
-
     @PreDestroy
     public void dispose() {
         synchronized (hookStats) {
             Iterator<HookStats> stats = hookStats.values().iterator();
-            while(stats.hasNext()) {
+            while (stats.hasNext()) {
                 stats.next().dispose();
             }
             hookStats.clear();
         }
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.protocols.api.ExtensibleHandler#getMarkerInterfaces()
+     * 
+     * @see
+     * org.apache.james.protocols.api.ExtensibleHandler#getMarkerInterfaces()
      */
     public List<Class<?>> getMarkerInterfaces() {
         List<Class<?>> marker = new ArrayList<Class<?>>();
@@ -82,39 +86,43 @@ public class HookResultJMXMonitor implem
         return marker;
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.protocols.api.ExtensibleHandler#wireExtensions(java.lang.Class, java.util.List)
+     * 
+     * @see
+     * org.apache.james.protocols.api.ExtensibleHandler#wireExtensions(java.
+     * lang.Class, java.util.List)
      */
     public void wireExtensions(Class<?> interfaceName, List<?> extension) throws WiringException {
         if (interfaceName.equals(Hook.class)) {
-            
+
             // add stats for all hooks
-            for (int i = 0; i < extension.size(); i++ ) {
-                Object hook =  extension.get(i);
+            for (int i = 0; i < extension.size(); i++) {
+                Object hook = extension.get(i);
                 if (equals(hook) == false) {
                     String hookName = hook.getClass().getName();
                     try {
                         hookStats.put(hookName, new HookStats(jmxPath, hookName));
                     } catch (Exception e) {
-                        throw new WiringException("Unable to wire Hooks",  e);
+                        throw new WiringException("Unable to wire Hooks", e);
                     }
                 }
             }
         }
-        
+
     }
-    
 
     /*
      * (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 {
         this.jmxPath = config.getString("jmxName", getDefaultJMXName());
     }
-    
+
     protected String getDefaultJMXName() {
         return "smtpserver";
     }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStats.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStats.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStats.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStats.java Mon Apr  4 18:44:55 2011
@@ -34,11 +34,9 @@ import org.apache.james.protocols.smtp.h
 
 /**
  * JMX Bean which keep track of statistics for a given Hook
- * 
- *
  */
 public class HookStats extends StandardMBean implements HookStatsMBean, Disposable {
-    
+
     private AtomicLong ok = new AtomicLong(0);
     private AtomicLong declined = new AtomicLong(0);
     private AtomicLong deny = new AtomicLong(0);
@@ -57,7 +55,7 @@ public class HookStats extends StandardM
         ObjectName baseObjectName = new ObjectName(name);
         mbeanserver.registerMBean(this, baseObjectName);
     }
-    
+
     public void increment(int code) {
         if ((code & HookReturnCode.OK) == HookReturnCode.OK) {
             ok.incrementAndGet();
@@ -71,12 +69,13 @@ public class HookStats extends StandardM
         if ((code & HookReturnCode.DENY) == HookReturnCode.DENY) {
             deny.incrementAndGet();
         }
-       
+
         all.incrementAndGet();
     }
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.HookStatsMBean#getOk()
      */
     public long getOk() {
@@ -85,6 +84,7 @@ public class HookStats extends StandardM
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.HookStatsMBean#getDeclined()
      */
     public long getDeclined() {
@@ -93,6 +93,7 @@ public class HookStats extends StandardM
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.HookStatsMBean#getDeny()
      */
     public long getDeny() {
@@ -101,6 +102,7 @@ public class HookStats extends StandardM
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.HookStatsMBean#getDenysoft()
      */
     public long getDenysoft() {
@@ -109,6 +111,7 @@ public class HookStats extends StandardM
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.lifecycle.Disposable#dispose()
      */
     public void dispose() {
@@ -121,6 +124,7 @@ public class HookStats extends StandardM
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.HookStatsMBean#getName()
      */
     public String getName() {
@@ -129,6 +133,7 @@ public class HookStats extends StandardM
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.HookStatsMBean#getAll()
      */
     public long getAll() {

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/HookStatsMBean.java Mon Apr  4 18:44:55 2011
@@ -18,11 +18,8 @@
  ****************************************************************/
 package org.apache.james.smtpserver.jmx;
 
-
 /**
  * JMX Bean which shows Hook statistics
- * 
- *
  */
 public interface HookStatsMBean {
 
@@ -32,38 +29,38 @@ public interface HookStatsMBean {
      * @return name
      */
     String getName();
-    
+
     /**
      * Return the count of how many OK the hook returned
      * 
      * @return ok
      */
     long getOk();
-    
+
     /**
      * Return the count of how many DECLINED the hook returned
      * 
      * @return declined
      */
     long getDeclined();
-    
+
     /**
      * Return the count of how many DENY the hook returned
      * 
      * @return deny
      */
     long getDeny();
-    
+
     /**
      * Return the count of how many DENYSOFT the hook returned
      * 
      * @return denysoft
      */
     long getDenysoft();
-    
+
     /**
      * Return the count of how many transaction this hook as processed
-     *  
+     * 
      * @return all
      */
     long getAll();

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java Mon Apr  4 18:44:55 2011
@@ -23,9 +23,10 @@ import java.util.List;
 
 import org.apache.james.protocols.api.HandlersPackage;
 
-public class JMXHandlersLoader implements HandlersPackage{
+public class JMXHandlersLoader implements HandlersPackage {
 
     private final List<String> handlers = new ArrayList<String>();
+
     public JMXHandlersLoader() {
         handlers.add(ConnectHandlerResultJMXMonitor.class.getName());
         handlers.add(CommandHandlerResultJMXMonitor.class.getName());
@@ -35,6 +36,7 @@ public class JMXHandlersLoader implement
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.protocols.api.HandlersPackage#getHandlers()
      */
     public List<String> getHandlers() {

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/LineHandlerResultJMXMonitor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/LineHandlerResultJMXMonitor.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/LineHandlerResultJMXMonitor.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/LineHandlerResultJMXMonitor.java Mon Apr  4 18:44:55 2011
@@ -21,12 +21,14 @@ package org.apache.james.smtpserver.jmx;
 import org.apache.james.protocols.lib.jmx.AbstractLineHandlerResultJMXMonitor;
 import org.apache.james.protocols.smtp.SMTPSession;
 
-public class LineHandlerResultJMXMonitor extends AbstractLineHandlerResultJMXMonitor<SMTPSession>{
-
+public class LineHandlerResultJMXMonitor extends AbstractLineHandlerResultJMXMonitor<SMTPSession> {
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.socket.AbstractLineHandlerResultJMXMonitor#getDefaultJMXName()
+     * 
+     * @see
+     * org.apache.james.socket.AbstractLineHandlerResultJMXMonitor#getDefaultJMXName
+     * ()
      */
     protected String getDefaultJMXName() {
         return "smtpserver";

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java Mon Apr  4 18:44:55 2011
@@ -32,22 +32,22 @@ import org.apache.james.protocols.smtp.S
 
 /**
  * Expose statistics for {@link CommandHandler} via JMX
- *
  */
 public class SMTPCommandHandlerStats extends AbstractCommandHandlerStats<SMTPResponse> implements SMTPCommandHandlerStatsMBean, Disposable {
 
     private AtomicLong temp = new AtomicLong(0);
     private AtomicLong perm = new AtomicLong(0);
-    private AtomicLong ok  = new AtomicLong(0);
- 
+    private AtomicLong ok = new AtomicLong(0);
+
     public SMTPCommandHandlerStats(String jmxPath, String handlerName, String[] commands) throws NotCompliantMBeanException, MalformedObjectNameException, NullPointerException, InstanceAlreadyExistsException, MBeanRegistrationException {
         super(SMTPCommandHandlerStatsMBean.class, jmxPath, handlerName, commands);
     }
 
-    
     /*
      * (non-Javadoc)
-     * @see org.apache.james.smtpserver.CommandHandlerStatsMBean#getTemporaryError()
+     * 
+     * @see
+     * org.apache.james.smtpserver.CommandHandlerStatsMBean#getTemporaryError()
      */
     public long getTemporaryError() {
         return temp.get();
@@ -55,7 +55,9 @@ public class SMTPCommandHandlerStats ext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.smtpserver.CommandHandlerStatsMBean#getPermantError()
+     * 
+     * @see
+     * org.apache.james.smtpserver.CommandHandlerStatsMBean#getPermantError()
      */
     public long getPermantError() {
         return perm.get();
@@ -63,32 +65,35 @@ public class SMTPCommandHandlerStats ext
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.CommandHandlerStatsMBean#getOk()
      */
     public long getOk() {
         return ok.get();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.socket.AbstractCommandHandlerStats#incrementStats(org.apache.james.protocols.api.Response)
+     * 
+     * @see
+     * org.apache.james.socket.AbstractCommandHandlerStats#incrementStats(org
+     * .apache.james.protocols.api.Response)
      */
     protected void incrementStats(SMTPResponse response) {
         try {
             String code = response.getRetCode();
-            char c = code.charAt(0) ;
+            char c = code.charAt(0);
             if (c == '5') {
                 perm.incrementAndGet();
             } else if (c == '4') {
                 temp.incrementAndGet();
-            } else if ( c == '2' || c == '3') {
+            } else if (c == '2' || c == '3') {
                 ok.incrementAndGet();
-            } 
-            
+            }
+
         } catch (NumberFormatException e) {
             // should never happen
-        }        
+        }
     }
 
 }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStatsMBean.java Mon Apr  4 18:44:55 2011
@@ -20,12 +20,10 @@ package org.apache.james.smtpserver.jmx;
 
 import org.apache.james.protocols.lib.jmx.CommandHandlerStatsMBean;
 
-
 /**
  * JMX MBean for CommandHandler
- *
  */
-public interface SMTPCommandHandlerStatsMBean extends CommandHandlerStatsMBean{
+public interface SMTPCommandHandlerStatsMBean extends CommandHandlerStatsMBean {
 
     /**
      * Return the count of temporary errors returned by the handler
@@ -33,7 +31,7 @@ public interface SMTPCommandHandlerStats
      * @return tempCount
      */
     long getTemporaryError();
-    
+
     /**
      * Return the count of permanent errors returned by the handler
      * 
@@ -41,8 +39,6 @@ public interface SMTPCommandHandlerStats
      */
     long getPermantError();
 
-    
-    
     /**
      * Return the count of successful handling returned by the handler
      * 

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/OioSMTPServer.java Mon Apr  4 18:44:55 2011
@@ -22,11 +22,10 @@ import org.jboss.netty.channel.socket.Se
 import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
 
 /**
- * SMTPServer which use old IO and not NIO. If you want to use NIO you should use {@link SMTPServer}
- * 
- *
+ * SMTPServer which use old IO and not NIO. If you want to use NIO you should
+ * use {@link SMTPServer}
  */
-public class OioSMTPServer extends SMTPServer{
+public class OioSMTPServer extends SMTPServer {
 
     @Override
     protected ServerSocketChannelFactory createSocketChannelFactory() {
@@ -35,8 +34,6 @@ public class OioSMTPServer extends SMTPS
 
     /**
      * Return -1 as it is not known
-     * 
-     * 
      */
     @Override
     public int getIoWorkerCount() {

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java Mon Apr  4 18:44:55 2011
@@ -39,28 +39,25 @@ import org.slf4j.Logger;
 
 /**
  * {@link ChannelUpstreamHandler} which is used by the SMTPServer
- *
  */
-public class SMTPChannelUpstreamHandler extends AbstractChannelUpstreamHandler{
+public class SMTPChannelUpstreamHandler extends AbstractChannelUpstreamHandler {
     private final Logger logger;
     private final SMTPConfiguration conf;
     private final SSLContext context;
     private String[] enabledCipherSuites;
 
-    public SMTPChannelUpstreamHandler(ProtocolHandlerChain chain,
-            SMTPConfiguration conf, Logger logger) {
+    public SMTPChannelUpstreamHandler(ProtocolHandlerChain chain, SMTPConfiguration conf, Logger logger) {
         this(chain, conf, logger, null, null);
     }
-    
-    public SMTPChannelUpstreamHandler(ProtocolHandlerChain chain,
-            SMTPConfiguration conf, Logger logger, SSLContext context, String[] enabledCipherSuites) {
+
+    public SMTPChannelUpstreamHandler(ProtocolHandlerChain chain, SMTPConfiguration conf, Logger logger, SSLContext context, String[] enabledCipherSuites) {
         super(chain);
         this.conf = conf;
         this.logger = logger;
         this.context = context;
         this.enabledCipherSuites = enabledCipherSuites;
     }
-    
+
     @Override
     protected ProtocolSession createSession(ChannelHandlerContext ctx) throws Exception {
         if (context != null) {
@@ -70,13 +67,12 @@ public class SMTPChannelUpstreamHandler 
             }
             return new SMTPNettySession(conf, logger, ctx, engine);
         } else {
-            return  new SMTPNettySession(conf, logger, ctx);
+            return new SMTPNettySession(conf, logger, ctx);
         }
     }
 
-    
     @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {        
+    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
         Channel channel = ctx.getChannel();
         if (e.getCause() instanceof TooLongFrameException) {
             ctx.getChannel().write(new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED, "Line length exceeded. See RFC 2821 #4.5.3.1."));
@@ -88,25 +84,25 @@ public class SMTPChannelUpstreamHandler 
             cleanup(channel);
             channel.close();
         }
-       
+
         super.exceptionCaught(ctx, e);
     }
 
     /**
-     * Cleanup temporary files 
+     * Cleanup temporary files
      * 
      * @param channel
      */
     protected void cleanup(Channel channel) {
         // Make sure we dispose everything on exit on session close
         SMTPSession smtpSession = (SMTPSession) attributes.get(channel);
-        
+
         if (smtpSession != null) {
             LifecycleUtil.dispose(smtpSession.getState().get(SMTPConstants.MAIL));
             LifecycleUtil.dispose(smtpSession.getState().get(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE));
         }
-        
+
         super.cleanup(channel);
     }
-    
+
 }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java Mon Apr  4 18:44:55 2011
@@ -35,31 +35,28 @@ import org.slf4j.Logger;
 
 /**
  * {@link SMTPSession} implementation for use with Netty
- *
  */
-public class SMTPNettySession extends AbstractSession implements SMTPSession{
+public class SMTPNettySession extends AbstractSession implements SMTPSession {
     public final static String SMTP_SESSION = "SMTP_SESSION";
-    
 
     private boolean relayingAllowed;
 
-
     private Map<String, Object> connectionState;
 
     private SMTPConfiguration theConfigData;
 
     private int lineHandlerCount = 0;
-    
+
     public SMTPNettySession(SMTPConfiguration theConfigData, Logger logger, ChannelHandlerContext handlerContext, SSLEngine engine) {
         super(logger, handlerContext, engine);
         this.theConfigData = theConfigData;
         connectionState = new HashMap<String, Object>();
 
-        relayingAllowed = theConfigData.isRelayingAllowed(getRemoteIPAddress());    
+        relayingAllowed = theConfigData.isRelayingAllowed(getRemoteIPAddress());
     }
-   
+
     public SMTPNettySession(SMTPConfiguration theConfigData, Logger logger, ChannelHandlerContext handlerContext) {
-        this(theConfigData, logger, handlerContext, null);  
+        this(theConfigData, logger, handlerContext, null);
     }
 
     /**
@@ -68,15 +65,13 @@ public class SMTPNettySession extends Ab
     public Map<String, Object> getConnectionState() {
         return connectionState;
     }
-    
 
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#getState()
      */
     @SuppressWarnings("unchecked")
     public Map<String, Object> getState() {
-        Map<String, Object> res = (Map<String, Object>) getConnectionState()
-                .get(SMTPSession.SESSION_STATE_MAP);
+        Map<String, Object> res = (Map<String, Object>) getConnectionState().get(SMTPSession.SESSION_STATE_MAP);
         if (res == null) {
             res = new HashMap<String, Object>();
             getConnectionState().put(SMTPSession.SESSION_STATE_MAP, res);
@@ -111,8 +106,7 @@ public class SMTPNettySession extends Ab
      */
     public void popLineHandler() {
         if (lineHandlerCount > 0) {
-            getChannelHandlerContext().getPipeline()
-            .remove("lineHandler" + lineHandlerCount);
+            getChannelHandlerContext().getPipeline().remove("lineHandler" + lineHandlerCount);
             lineHandlerCount--;
         }
     }
@@ -123,13 +117,9 @@ public class SMTPNettySession extends Ab
     public void pushLineHandler(LineHandler<SMTPSession> overrideCommandHandler) {
         lineHandlerCount++;
 
-        getChannelHandlerContext().getPipeline().addAfter("timeoutHandler",
-                "lineHandler" + lineHandlerCount,
-                new LineHandlerUpstreamHandler<SMTPSession>(overrideCommandHandler));
+        getChannelHandlerContext().getPipeline().addAfter("timeoutHandler", "lineHandler" + lineHandlerCount, new LineHandlerUpstreamHandler<SMTPSession>(overrideCommandHandler));
     }
 
-
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#getHelloName()
      */
@@ -137,7 +127,6 @@ public class SMTPNettySession extends Ab
         return theConfigData.getHelloName();
     }
 
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#getMaxMessageSize()
      */
@@ -145,7 +134,6 @@ public class SMTPNettySession extends Ab
         return theConfigData.getMaxMessageSize();
     }
 
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#getRcptCount()
      */
@@ -168,7 +156,6 @@ public class SMTPNettySession extends Ab
         return theConfigData.getSMTPGreeting();
     }
 
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#isAuthSupported()
      */
@@ -176,7 +163,6 @@ public class SMTPNettySession extends Ab
         return theConfigData.isAuthRequired(socketAddress.getAddress().getHostAddress());
     }
 
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#setRelayingAllowed(boolean)
      */
@@ -184,15 +170,14 @@ public class SMTPNettySession extends Ab
         this.relayingAllowed = relayingAllowed;
     }
 
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#sleep(long)
      */
     public void sleep(long ms) {
-        //session.getFilterChain().addAfter("connectionFilter", "tarpitFilter",new TarpitFilter(ms));
+        // session.getFilterChain().addAfter("connectionFilter",
+        // "tarpitFilter",new TarpitFilter(ms));
     }
 
-
     /**
      * @see org.apache.james.protocols.smtp.SMTPSession#useAddressBracketsEnforcement()
      */
@@ -206,10 +191,12 @@ public class SMTPNettySession extends Ab
     public boolean useHeloEhloEnforcement() {
         return theConfigData.useHeloEhloEnforcement();
     }
-    
+
     /*
      * (non-Javadoc)
-     * @see org.apache.james.protocols.smtp.SMTPSession#getPushedLineHandlerCount()
+     * 
+     * @see
+     * org.apache.james.protocols.smtp.SMTPSession#getPushedLineHandlerCount()
      */
     public int getPushedLineHandlerCount() {
         return lineHandlerCount;
@@ -217,7 +204,7 @@ public class SMTPNettySession extends Ab
 
     public boolean verifyIdentity() {
         if (theConfigData instanceof SMTPHandlerConfigurationDataImpl) {
-            return ((SMTPHandlerConfigurationDataImpl)theConfigData).verifyIdentity();
+            return ((SMTPHandlerConfigurationDataImpl) theConfigData).verifyIdentity();
         } else {
             return true;
         }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPResponseEncoder.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPResponseEncoder.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPResponseEncoder.java Mon Apr  4 18:44:55 2011
@@ -27,9 +27,8 @@ import org.apache.james.protocols.smtp.S
 
 /**
  * {@link AbstractResponseEncoder} which encode {@link SMTPResponse} objects
- *
  */
-public class SMTPResponseEncoder extends AbstractResponseEncoder<SMTPResponse>{
+public class SMTPResponseEncoder extends AbstractResponseEncoder<SMTPResponse> {
 
     public SMTPResponseEncoder() {
         super(SMTPResponse.class, Charset.forName("US-ASCII"));
@@ -38,7 +37,7 @@ public class SMTPResponseEncoder extends
     @Override
     protected List<String> getResponse(SMTPResponse response) {
         List<String> responseList = new ArrayList<String>();
-        
+
         for (int k = 0; k < response.getLines().size(); k++) {
             StringBuffer respBuff = new StringBuffer(256);
             respBuff.append(response.getRetCode());
@@ -53,7 +52,7 @@ public class SMTPResponseEncoder extends
             }
             responseList.add(respBuff.toString());
         }
-        
+
         return responseList;
     }
 

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java Mon Apr  4 18:44:55 2011
@@ -18,7 +18,6 @@
  ****************************************************************/
 package org.apache.james.smtpserver.netty;
 
-
 import javax.annotation.Resource;
 import javax.net.ssl.SSLContext;
 
@@ -37,22 +36,18 @@ import org.jboss.netty.handler.codec.one
 
 /**
  * NIO SMTPServer which use Netty
- * 
- *
  */
-public class SMTPServer extends AbstractConfigurableAsyncServer implements SMTPServerMBean{
+public class SMTPServer extends AbstractConfigurableAsyncServer implements SMTPServerMBean {
 
-    
     /**
      * The handler chain - SMTPhandlers can lookup handlerchain to obtain
-     * Command handlers , Message handlers and connection handlers
-     * Constructed during initialisation to allow dependency injection.
+     * Command handlers , Message handlers and connection handlers Constructed
+     * during initialisation to allow dependency injection.
      */
     private ProtocolHandlerChain handlerChain;
 
     /**
-     * Whether authentication is required to use
-     * this SMTP server.
+     * Whether authentication is required to use this SMTP server.
      */
     private final static int AUTH_DISABLED = 0;
     private final static int AUTH_REQUIRED = 1;
@@ -65,26 +60,25 @@ public class SMTPServer extends Abstract
     private boolean heloEhloEnforcement = false;
 
     /**
-     * SMTPGreeting to use 
+     * SMTPGreeting to use
      */
     private String smtpGreeting = null;
 
     /**
-     * This is a Network Matcher that should be configured to contain
-     * authorized networks that bypass SMTP AUTH requirements.
+     * This is a Network Matcher that should be configured to contain authorized
+     * networks that bypass SMTP AUTH requirements.
      */
     private NetMatcher authorizedNetworks = null;
 
     /**
-     * The maximum message size allowed by this SMTP server.  The default
-     * value, 0, means no limit.
+     * The maximum message size allowed by this SMTP server. The default value,
+     * 0, means no limit.
      */
     private long maxMessageSize = 0;
 
     /**
-     * The number of bytes to read before resetting
-     * the connection timeout timer.  Defaults to
-     * 20 KB.
+     * The number of bytes to read before resetting the connection timeout
+     * timer. Defaults to 20 KB.
      */
     private int lengthReset = 20 * 1024;
 
@@ -96,41 +90,41 @@ public class SMTPServer extends Abstract
     private boolean addressBracketsEnforcement = true;
 
     private boolean verifyIdentity;
-       
 
-    @Resource(name="smtphandlerchain")
+    @Resource(name = "smtphandlerchain")
     public void setProtocolHandlerChain(ProtocolHandlerChain handlerChain) {
         this.handlerChain = handlerChain;
     }
 
-    
     public void doConfigure(final HierarchicalConfiguration configuration) throws ConfigurationException {
         if (isEnabled()) {
-            String authRequiredString = configuration.getString("authRequired","false").trim().toLowerCase();
-            if (authRequiredString.equals("true")) authRequired = AUTH_REQUIRED;
-            else if (authRequiredString.equals("announce")) authRequired = AUTH_ANNOUNCE;
-            else authRequired = AUTH_DISABLED;
+            String authRequiredString = configuration.getString("authRequired", "false").trim().toLowerCase();
+            if (authRequiredString.equals("true"))
+                authRequired = AUTH_REQUIRED;
+            else if (authRequiredString.equals("announce"))
+                authRequired = AUTH_ANNOUNCE;
+            else
+                authRequired = AUTH_DISABLED;
             if (authRequired != AUTH_DISABLED) {
                 getLogger().info("This SMTP server requires authentication.");
             } else {
                 getLogger().info("This SMTP server does not require authentication.");
             }
 
-            String authorizedAddresses = configuration.getString("authorizedAddresses",null);
+            String authorizedAddresses = configuration.getString("authorizedAddresses", null);
             if (authRequired == AUTH_DISABLED && authorizedAddresses == null) {
-                /* if SMTP AUTH is not requred then we will use
-                 * authorizedAddresses to determine whether or not to
-                 * relay e-mail.  Therefore if SMTP AUTH is not
-                 * required, we will not relay e-mail unless the
-                 * sending IP address is authorized.
-                 *
-                 * Since this is a change in behavior for James v2,
-                 * create a default authorizedAddresses network of
-                 * 0.0.0.0/0, which matches all possible addresses, thus
-                 * preserving the current behavior.
-                 *
-                 * James v3 should require the <authorizedAddresses>
-                 * element.
+                /*
+                 * if SMTP AUTH is not required then we will use
+                 * authorizedAddresses to determine whether or not to relay
+                 * e-mail. Therefore if SMTP AUTH is not required, we will not
+                 * relay e-mail unless the sending IP address is authorized.
+                 * 
+                 * Since this is a change in behavior for James v2, create a
+                 * default authorizedAddresses network of 0.0.0.0/0, which
+                 * matches all possible addresses, thus preserving the current
+                 * behavior.
+                 * 
+                 * James v3 should require the <authorizedAddresses> element.
                  */
                 authorizedAddresses = "0.0.0.0/0.0.0.0";
             }
@@ -151,23 +145,24 @@ public class SMTPServer extends Abstract
 
             // get the message size limit from the conf file and multiply
             // by 1024, to put it in bytes
-            maxMessageSize = configuration.getLong( "maxmessagesize",maxMessageSize ) * 1024;
+            maxMessageSize = configuration.getLong("maxmessagesize", maxMessageSize) * 1024;
             if (maxMessageSize > 0) {
                 getLogger().info("The maximum allowed message size is " + maxMessageSize + " bytes.");
             } else {
                 getLogger().info("No maximum message size is enforced for this server.");
             }
 
-            heloEhloEnforcement = configuration.getBoolean("heloEhloEnforcement",true);
+            heloEhloEnforcement = configuration.getBoolean("heloEhloEnforcement", true);
 
-            if (authRequiredString.equals("true")) authRequired = AUTH_REQUIRED;
+            if (authRequiredString.equals("true"))
+                authRequired = AUTH_REQUIRED;
 
             // get the smtpGreeting
-            smtpGreeting = configuration.getString("smtpGreeting",null);
+            smtpGreeting = configuration.getString("smtpGreeting", null);
+
+            addressBracketsEnforcement = configuration.getBoolean("addressBracketsEnforcement", true);
 
-            addressBracketsEnforcement = configuration.getBoolean("addressBracketsEnforcement",true);
-            
-            verifyIdentity = configuration.getBoolean("verifyIdentity",true);
+            verifyIdentity = configuration.getBoolean("verifyIdentity", true);
 
         }
     }
@@ -181,13 +176,13 @@ public class SMTPServer extends Abstract
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.socket.ServerMBean#getServiceType()
      */
     public String getServiceType() {
         return "SMTP Service";
     }
 
-
     /**
      * A class to provide SMTP handler configuration to the handlers
      */
@@ -232,7 +227,6 @@ public class SMTPServer extends Abstract
             return SMTPServer.this.heloEhloEnforcement;
         }
 
-
         /**
          * @see org.apache.james.protocols.smtp.SMTPConfiguration#getSMTPGreeting()
          */
@@ -251,7 +245,8 @@ public class SMTPServer extends Abstract
          * @see org.apache.james.protocols.smtp.SMTPConfiguration#isAuthRequired(java.lang.String)
          */
         public boolean isAuthRequired(String remoteIP) {
-            if (SMTPServer.this.authRequired == AUTH_ANNOUNCE) return true;
+            if (SMTPServer.this.authRequired == AUTH_ANNOUNCE)
+                return true;
             boolean authRequired = SMTPServer.this.authRequired != AUTH_DISABLED;
             if (authorizedNetworks != null) {
                 authRequired = authRequired && !SMTPServer.this.authorizedNetworks.matchInetNetwork(remoteIP);
@@ -267,7 +262,8 @@ public class SMTPServer extends Abstract
         }
 
         /**
-         * Return true if the username and mail from must match for a authorized user
+         * Return true if the username and mail from must match for a authorized
+         * user
          * 
          * @return verify
          */
@@ -276,17 +272,15 @@ public class SMTPServer extends Abstract
         }
 
     }
-    
+
     @Override
     protected ChannelPipelineFactory createPipelineFactory(ChannelGroup group) {
         return new SMTPChannelPipelineFactory(getTimeout(), connectionLimit, connPerIP, group, getEnabledCipherSuites());
     }
-    
-    
+
     private final class SMTPChannelPipelineFactory extends AbstractSSLAwareChannelPipelineFactory {
 
-        public SMTPChannelPipelineFactory(int timeout, int maxConnections,
-                int maxConnectsPerIp, ChannelGroup group, String[] enabledCipherSuites) {
+        public SMTPChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp, ChannelGroup group, String[] enabledCipherSuites) {
             super(timeout, maxConnections, maxConnectsPerIp, group, enabledCipherSuites);
         }
 
@@ -305,7 +299,7 @@ public class SMTPServer extends Abstract
 
         @Override
         protected boolean isSSLSocket() {
-            return  SMTPServer.this.isSSLSocket();
+            return SMTPServer.this.isSSLSocket();
         }
 
         @Override
@@ -317,7 +311,7 @@ public class SMTPServer extends Abstract
         protected ChannelUpstreamHandler createHandler() {
             return new SMTPChannelUpstreamHandler(handlerChain, theConfigData, getLogger(), getSSLContext(), getEnabledCipherSuites());
         }
-        
+
     }
 
     /*
@@ -361,47 +355,54 @@ public class SMTPServer extends Abstract
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer#getDefaultJMXName()
+     * 
+     * @see
+     * org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer#
+     * getDefaultJMXName()
      */
     protected String getDefaultJMXName() {
         return "smtpserver";
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.smtpserver.netty.SMTPServerMBean#setMaximalMessageSize(long)
+     * 
+     * @see
+     * org.apache.james.smtpserver.netty.SMTPServerMBean#setMaximalMessageSize
+     * (long)
      */
     public void setMaximalMessageSize(long maxSize) {
         this.maxMessageSize = maxSize;
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.smtpserver.netty.SMTPServerMBean#setAddressBracketsEnforcement(boolean)
+     * 
+     * @see org.apache.james.smtpserver.netty.SMTPServerMBean#
+     * setAddressBracketsEnforcement(boolean)
      */
     public void setAddressBracketsEnforcement(boolean enforceAddressBrackets) {
-        this.addressBracketsEnforcement  = enforceAddressBrackets;
+        this.addressBracketsEnforcement = enforceAddressBrackets;
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.smtpserver.netty.SMTPServerMBean#setHeloEhloEnforcement(boolean)
+     * 
+     * @see
+     * org.apache.james.smtpserver.netty.SMTPServerMBean#setHeloEhloEnforcement
+     * (boolean)
      */
     public void setHeloEhloEnforcement(boolean enforceHeloEHlo) {
         this.heloEhloEnforcement = enforceHeloEHlo;
     }
 
-
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.smtpserver.netty.SMTPServerMBean#getHeloName()
      */
     public String getHeloName() {
         return theConfigData.getHelloName();
     }
-   
 
 }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java?rev=1088712&r1=1088711&r2=1088712&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServerMBean.java Mon Apr  4 18:44:55 2011
@@ -22,59 +22,58 @@ import org.apache.james.protocols.lib.jm
 
 /**
  * JMX MBean interface for the SMTPServer
- * 
- *
  */
 public interface SMTPServerMBean extends org.apache.james.protocols.smtp.SMTPServerMBean, ServerMBean {
 
-	/**
-	 * Return the maximum allowed size of the message
-	 * 
-	 * @return maxMessageSize
-	 */
-	long getMaximalMessageSize();
-	
-	/**
-	 * Set the maximum allowed size of messages. Set this to 0 to accept every message
-	 * 
-	 * @param maxSize
-	 */
-	void setMaximalMessageSize(long maxSize);
-	
-	
-	/**
-	 * Return true if brackets around addresses in the MAIL and RCPT are required
-	 * 
-	 * @return bracketsEnforcement
-	 */
-	boolean getAddressBracketsEnforcement();
-	
-	/**
-	 * Enable or disable brackets enforcement around addressed in the MAIL and RCPT command
-	 * 
-	 * @param enforceAddressBrackets
-	 */
-	void setAddressBracketsEnforcement(boolean enforceAddressBrackets);
-	
-	/**
-	 * Return true if a HELO/EHLO is required when connecting to this server
-	 * 
-	 * @return heloEhloEnforcement
-	 */
-	boolean getHeloEhloEnforcement();
-	
-	
-	/**
-	 * Enable or disable the need of the HELO/EHLO
-	 * 
-	 * @param enforceHeloEHlo
-	 */
-	void setHeloEhloEnforcement(boolean enforceHeloEHlo);
-	
-	/**
-	 * Return the hello name
-	 * 
-	 * @return helo
-	 */
-	String getHeloName();
+    /**
+     * Return the maximum allowed size of the message
+     * 
+     * @return maxMessageSize
+     */
+    long getMaximalMessageSize();
+
+    /**
+     * Set the maximum allowed size of messages. Set this to 0 to accept every
+     * message
+     * 
+     * @param maxSize
+     */
+    void setMaximalMessageSize(long maxSize);
+
+    /**
+     * Return true if brackets around addresses in the MAIL and RCPT are
+     * required
+     * 
+     * @return bracketsEnforcement
+     */
+    boolean getAddressBracketsEnforcement();
+
+    /**
+     * Enable or disable brackets enforcement around addressed in the MAIL and
+     * RCPT command
+     * 
+     * @param enforceAddressBrackets
+     */
+    void setAddressBracketsEnforcement(boolean enforceAddressBrackets);
+
+    /**
+     * Return true if a HELO/EHLO is required when connecting to this server
+     * 
+     * @return heloEhloEnforcement
+     */
+    boolean getHeloEhloEnforcement();
+
+    /**
+     * Enable or disable the need of the HELO/EHLO
+     * 
+     * @param enforceHeloEHlo
+     */
+    void setHeloEhloEnforcement(boolean enforceHeloEHlo);
+
+    /**
+     * Return the hello name
+     * 
+     * @return helo
+     */
+    String getHeloName();
 }



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