james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r993421 - in /james/server/trunk: user-function/src/test/java/org/apache/james/vut/ user-library/ user-library/src/main/java/org/apache/james/impl/vut/ user-library/src/test/java/org/apache/james/vut/
Date Tue, 07 Sep 2010 16:38:30 GMT
Author: norman
Date: Tue Sep  7 16:38:29 2010
New Revision: 993421

URL: http://svn.apache.org/viewvc?rev=993421&view=rev
Log:
Remove unused dependency

Modified:
    james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java
    james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java
    james/server/trunk/user-library/pom.xml
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java
    james/server/trunk/user-library/src/test/java/org/apache/james/vut/AbstractVirtualUserTableTest.java

Modified: james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java?rev=993421&r1=993420&r2=993421&view=diff
==============================================================================
--- james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java
(original)
+++ james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java
Tue Sep  7 16:38:29 2010
@@ -34,7 +34,6 @@ public class JDBCVirtualUserTableTest ex
         JDBCVirtualUserTable mr = new JDBCVirtualUserTable();
         mr.setLog(new SimpleLog("MockLog"));
         mr.setDataSourceSelector(Util.getDataSourceSelector());
-        mr.setDNSService(setUpDNSServer());
         mr.setFileSystem(new MockFileSystem());
         DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
         defaultConfiguration.addProperty("[@destinationURL]","db://maildb/VirtualUserTable");

Modified: james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java?rev=993421&r1=993420&r2=993421&view=diff
==============================================================================
--- james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java
(original)
+++ james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java
Tue Sep  7 16:38:29 2010
@@ -41,7 +41,6 @@ public class XMLVirtualUserTableTest ext
 
     protected AbstractVirtualUserTable getVirtualUserTable() throws Exception {
         XMLVirtualUserTable mr = new XMLVirtualUserTable();
-        mr.setDNSService(setUpDNSServer());
         mr.setLog(new SimpleLog("MockLog"));
         return mr;
     }

Modified: james/server/trunk/user-library/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/pom.xml?rev=993421&r1=993420&r2=993421&view=diff
==============================================================================
--- james/server/trunk/user-library/pom.xml (original)
+++ james/server/trunk/user-library/pom.xml Tue Sep  7 16:38:29 2010
@@ -42,10 +42,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>james-server-domain-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.james</groupId>
       <artifactId>apache-mailet</artifactId>
     </dependency>
     

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java?rev=993421&r1=993420&r2=993421&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java
(original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java
Tue Sep  7 16:38:29 2010
@@ -18,22 +18,17 @@
  ****************************************************************/
 package org.apache.james.impl.vut;
 
-import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
-import javax.annotation.Resource;
 import javax.mail.internet.ParseException;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.logging.Log;
-import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.api.vut.ErrorMappingException;
 import org.apache.james.api.vut.VirtualUserTable;
 import org.apache.james.api.vut.management.InvalidMappingException;
@@ -47,25 +42,18 @@ import org.apache.oro.text.regex.Perl5Co
 /**
  * 
  */
-public abstract class AbstractVirtualUserTable implements VirtualUserTable, VirtualUserTableManagement,
LogEnabled, Configurable {
-    
-    private DNSService dns;
-    
+public abstract class AbstractVirtualUserTable implements VirtualUserTable, VirtualUserTableManagement,
LogEnabled, Configurable {       
     // The maximum mappings which will process before throwing exception
     private int mappingLimit = 10;
        
-    // TODO: Should we use true or false as default ?
     private boolean recursive = true;
-
-    private HierarchicalConfiguration config;
     
     private Log logger;
 
-    @Resource(name="dnsserver")
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+     */
     public void configure(HierarchicalConfiguration config) throws ConfigurationException
{
     	setRecursiveMapping(config.getBoolean("recursiveMapping", true));
         try {
@@ -80,7 +68,14 @@ public abstract class AbstractVirtualUse
         this.logger = logger;
     }
     
+    /**
+     * Override to handle config
+     * 
+     * @param conf
+     * @throws ConfigurationException
+     */
     protected void doConfigure(HierarchicalConfiguration conf) throws ConfigurationException
{
+    	
     }
     
     public void setRecursiveMapping(boolean recursive) {
@@ -191,7 +186,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addRegexMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean addRegexMapping(String user, String domain, String regex)
throws InvalidMappingException {     
+    public boolean addRegexMapping(String user, String domain, String regex) throws InvalidMappingException
{     
         try {
             new Perl5Compiler().compile(regex);
         } catch (MalformedPatternException e) {
@@ -210,7 +205,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeRegexMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean removeRegexMapping(String user, String domain, String regex)
throws InvalidMappingException {
+    public boolean removeRegexMapping(String user, String domain, String regex) throws InvalidMappingException
{
         getLogger().info("Remove regex mapping => " + regex + " for user: " + user + "
domain: " + domain);
         return removeMappingInternal(user,domain,VirtualUserTable.REGEX_PREFIX + regex);
     }
@@ -218,7 +213,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addAddressMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean addAddressMapping(String user, String domain, String address)
throws InvalidMappingException {
+    public boolean addAddressMapping(String user, String domain, String address) throws InvalidMappingException
{
         if (address.indexOf('@') < 0) {
             address =  address + "@localhost";
         } 
@@ -238,7 +233,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeAddressMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean removeAddressMapping(String user, String domain, String address)
throws InvalidMappingException {
+    public boolean removeAddressMapping(String user, String domain, String address) throws
InvalidMappingException {
         if (address.indexOf('@') < 0) {
             address =  address + "@localhost";
         } 
@@ -249,7 +244,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addErrorMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean addErrorMapping(String user, String domain, String error)
throws InvalidMappingException {   
+    public boolean addErrorMapping(String user, String domain, String error) throws InvalidMappingException
{   
         if (checkMapping(user,domain,error) == true) {          
             getLogger().info("Add error mapping => " + error + " for user: " + user +
" domain: " + domain);
             return addMappingInternal(user,domain, VirtualUserTable.ERROR_PREFIX + error);
@@ -261,7 +256,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeErrorMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean removeErrorMapping(String user, String domain, String error)
throws InvalidMappingException {
+    public boolean removeErrorMapping(String user, String domain, String error) throws InvalidMappingException
{
         getLogger().info("Remove error mapping => " + error + " for user: " + user + "
domain: " + domain);     
         return removeMappingInternal(user,domain,VirtualUserTable.ERROR_PREFIX + error);
     }
@@ -270,7 +265,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean addMapping(String user, String domain, String mapping) throws
InvalidMappingException {
+    public boolean addMapping(String user, String domain, String mapping) throws InvalidMappingException
{
 
         String map = mapping.toLowerCase();
         
@@ -290,7 +285,7 @@ public abstract class AbstractVirtualUse
     /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeMapping(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public synchronized boolean removeMapping(String user, String domain, String mapping)
throws InvalidMappingException {
+    public boolean removeMapping(String user, String domain, String mapping) throws InvalidMappingException
{
 
         String map = mapping.toLowerCase();
     
@@ -332,25 +327,6 @@ public abstract class AbstractVirtualUse
     }
 
     /**
-     * @see #getDomainsIP(List, DNSService, Logger)
-     */
-    private static List<String> getDomainIP(String domain, DNSService dns, Log log)
{
-        List<String> domainIP = new ArrayList<String>();
-        try {
-            InetAddress[]  addrs = dns.getAllByName(domain);
-            for (int j = 0; j < addrs.length ; j++) {
-                String ip = addrs[j].getHostAddress();
-                if (domainIP.contains(ip) == false) {
-                    domainIP.add(ip);
-                }
-            }
-        } catch (UnknownHostException e) {
-            log.error("Cannot get IP address(es) for " + domain);
-        }
-        return domainIP;
-    }
-
-    /**
      * @see org.apache.james.api.vut.management.VirtualUserTableManagement#getUserDomainMappings(java.lang.String,
java.lang.String)
      */
     public Collection<String> getUserDomainMappings(String user, String domain) {

Modified: james/server/trunk/user-library/src/test/java/org/apache/james/vut/AbstractVirtualUserTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/test/java/org/apache/james/vut/AbstractVirtualUserTableTest.java?rev=993421&r1=993420&r2=993421&view=diff
==============================================================================
--- james/server/trunk/user-library/src/test/java/org/apache/james/vut/AbstractVirtualUserTableTest.java
(original)
+++ james/server/trunk/user-library/src/test/java/org/apache/james/vut/AbstractVirtualUserTableTest.java
Tue Sep  7 16:38:29 2010
@@ -18,16 +18,12 @@
  ****************************************************************/
 package org.apache.james.vut;
 
-import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
 import junit.framework.TestCase;
 
-import org.apache.james.api.dnsservice.DNSService;
-import org.apache.james.api.dnsservice.TemporaryResolutionException;
 import org.apache.james.api.vut.ErrorMappingException;
 import org.apache.james.api.vut.VirtualUserTable;
 import org.apache.james.api.vut.management.InvalidMappingException;
@@ -95,41 +91,6 @@ public abstract class AbstractVirtualUse
 
     protected abstract boolean removeMapping(String user, String domain, String mapping,
int type) throws InvalidMappingException;
 
-    protected DNSService setUpDNSServer() {
-        
-        DNSService dns = new DNSService() {
-            public String getHostName(InetAddress inet) {
-                return "test";
-            }
-            public InetAddress[] getAllByName(String name) throws UnknownHostException {
-                return new InetAddress[] { InetAddress.getByName("127.0.0.1")};        
-            }
-            public InetAddress getLocalHost() throws UnknownHostException {
-                return InetAddress.getLocalHost();
-            }
-            @SuppressWarnings("unchecked")
-            public Collection findMXRecords(String hostname)
-            throws TemporaryResolutionException {
-                throw new UnsupportedOperationException("Should never be called");
-            }
-            @SuppressWarnings("unchecked")
-            public Collection findTXTRecords(String hostname) {
-                throw new UnsupportedOperationException("Should never be called");
-            }
-            public InetAddress getByName(String host)
-            throws UnknownHostException {
-                throw new UnsupportedOperationException("Should never be called");
-            }
-            @SuppressWarnings("unchecked")
-            public Iterator getSMTPHostAddresses(String domainName)
-            throws TemporaryResolutionException {
-                throw new UnsupportedOperationException("Should never be called");
-            }
-        };
-        
-        return dns;
-    
-    }
 
     public void testStoreAndRetrieveRegexMapping() throws ErrorMappingException {
         



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


Mime
View raw message