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 jo...@apache.org on 2006/11/07 18:51:51 UTC

svn commit: r472179 [1/2] - in /james/server/sandbox/mailbox-namespaces/src: java/org/apache/james/dnsserver/ java/org/apache/james/imapserver/ java/org/apache/james/imapserver/commands/ java/org/apache/james/mailboxmanager/ java/org/apache/james/mailb...

Author: joachim
Date: Tue Nov  7 09:51:49 2006
New Revision: 472179

URL: http://svn.apache.org/viewvc?view=rev&rev=472179
Log:
merged changes from trunk (especially needed mailboxmanager refactoring)

Added:
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/AbstractGeneralMailbox.java
      - copied unchanged from r472177, james/server/trunk/src/java/org/apache/james/mailboxmanager/mailbox/AbstractGeneralMailbox.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/dnsserver/dnstest.com.zone
      - copied unchanged from r472177, james/server/trunk/src/test/org/apache/james/dnsserver/dnstest.com.zone
Removed:
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailboxSession.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java
Modified:
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/dnsserver/DNSServer.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSession.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSessionImpl.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/AppendCommand.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/SelectCommand.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/MailboxManagerException.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.java
    james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/dnsserver/DNSServerTest.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/util/ImapServerLauncher.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractMailboxManagerSelfTestCase.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/AbstractMailboxRowTestCase.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/TorqueImapMailboxSelfTestCase.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerSelfTestCase.java
    james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/repository/TorqueMailboxManagerMailRepositoryNativeTestCase.java

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/dnsserver/DNSServer.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/dnsserver/DNSServer.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/dnsserver/DNSServer.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/dnsserver/DNSServer.java Tue Nov  7 09:51:49 2006
@@ -26,21 +26,19 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.xbill.DNS.CNAMERecord;
+import org.xbill.DNS.ARecord;
 import org.xbill.DNS.Cache;
 import org.xbill.DNS.Credibility;
 import org.xbill.DNS.DClass;
 import org.xbill.DNS.ExtendedResolver;
 import org.xbill.DNS.Lookup;
-import org.xbill.DNS.Message;
 import org.xbill.DNS.MXRecord;
 import org.xbill.DNS.Name;
-import org.xbill.DNS.Rcode;
+import org.xbill.DNS.PTRRecord;
 import org.xbill.DNS.Record;
 import org.xbill.DNS.Resolver;
-import org.xbill.DNS.RRset;
 import org.xbill.DNS.ResolverConfig;
-import org.xbill.DNS.SetResponse;
+import org.xbill.DNS.ReverseMap;
 import org.xbill.DNS.TXTRecord;
 import org.xbill.DNS.TextParseException;
 import org.xbill.DNS.Type;
@@ -74,7 +72,7 @@
      * A TTL cache of results received from the DNS server.  This
      * is a reference to a third party library object.
      */
-    private Cache cache;
+    protected Cache cache;
 
     /**
      * Maximum number of RR to cache.
@@ -86,7 +84,7 @@
      * Whether the DNS response is required to be authoritative
      */
     private int dnsCredibility;
-
+    
     /**
      * The DNS servers to be used by this service
      */
@@ -140,9 +138,9 @@
         }
 
         final boolean authoritative =
-            configuration.getChild( "authoritative" ).getValueAsBoolean( false );
+           configuration.getChild( "authoritative" ).getValueAsBoolean( false );
         // TODO: Check to see if the credibility field is being used correctly.  From the
-        //       docs I don't think so
+        //      docs I don't think so
         dnsCredibility = authoritative ? Credibility.AUTH_ANSWER : Credibility.NONAUTH_ANSWER;
 
         maxCacheSize = (int) configuration.getChild( "maxcachesize" ).getValueAsLong( maxCacheSize );
@@ -207,8 +205,8 @@
      *
      * @return a list of MX records corresponding to this mail domain
      */
-    public List findMXRecordsRaw(String hostname) {
-        Record answers[] = lookup(hostname, Type.MX);
+    private List findMXRecordsRaw(String hostname) {
+        Record answers[] = lookup(hostname, Type.MX, "MX");
         List servers = new ArrayList();
         if (answers == null) {
             return servers;
@@ -246,33 +244,18 @@
                             .append(hostname)
                             .append(".");
                 getLogger().info(logBuffer.toString());
-                Record cnames[] = lookup(hostname, Type.CNAME);
-                Collection cnameMXrecords = null;
-                if (cnames!=null && cnames.length > 0) {
-                    cnameMXrecords = findMXRecordsRaw(((CNAMERecord) cnames[0]).getTarget().toString());
-                } else {
+                try {
+                    getByName(hostname);
+                    servers.add(hostname);
+                } catch (UnknownHostException uhe) {
+                    // The original domain name is not a valid host,
+                    // so we can't add it to the server list.  In this
+                    // case we return an empty list of servers
                     logBuffer = new StringBuffer(128)
-                            .append("Couldn't find CNAME records for domain ")
-                            .append(hostname)
-                            .append(".");
-                    getLogger().info(logBuffer.toString());
-                }
-                if (cnameMXrecords==null) {
-                    try {
-                        getByName(hostname);
-                        servers.add(hostname);
-                    } catch (UnknownHostException uhe) {
-                        // The original domain name is not a valid host,
-                        // so we can't add it to the server list.  In this
-                        // case we return an empty list of servers
-                        logBuffer = new StringBuffer(128)
-                                  .append("Couldn't resolve IP address for host ")
-                                  .append(hostname)
-                                  .append(".");
-                        getLogger().error(logBuffer.toString());
-                    }
-                } else {
-                    servers.addAll(cnameMXrecords);
+                              .append("Couldn't resolve IP address for host ")
+                              .append(hostname)
+                              .append(".");
+                    getLogger().error(logBuffer.toString());
                 }
             }
         }
@@ -284,102 +267,27 @@
      * This method is a public wrapper for the private implementation
      * method
      *
-     * @param name the name of the host to be looked up
-     * @param type the type of record desired
-     */
-    public Record[] lookup(String name, int type) {
-        return rawDNSLookup(name,false,type);
-    }
-
-    /**
-     * Looks up DNS records of the specified type for the specified name
-     *
      * @param namestr the name of the host to be looked up
-     * @param querysent whether the query has already been sent to the DNS servers
      * @param type the type of record desired
-     * @return record the Record[] which holds all records or null if nothing is found
+     * @param typeDesc the description of the record type, for debugging purpose
      */
-    private Record[] rawDNSLookup(String namestr, boolean querysent, int type) {
-        Name name = null;
+    protected Record[] lookup(String namestr, int type, String typeDesc) {
+        // Name name = null;
         try {
-            name = Name.fromString(namestr, Name.root);
+            // name = Name.fromString(namestr, Name.root);
+            Lookup l = new Lookup(namestr, type);
+            l.setCache(cache);
+            l.setResolver(resolver);
+            l.setCredibility(dnsCredibility);
+            return l.run();
+            // return rawDNSLookup(name, false, type, typeDesc);
         } catch (TextParseException tpe) {
             // TODO: Figure out how to handle this correctly.
             getLogger().error("Couldn't parse name " + namestr, tpe);
             return null;
         }
-        int dclass = DClass.IN;
-
-        SetResponse cached = cache.lookupRecords(name, type, dnsCredibility);
-        if (cached.isSuccessful()) {
-            getLogger().debug(new StringBuffer(256)
-                             .append("Retrieving MX record for ")
-                             .append(name).append(" from cache")
-                             .toString());
-
-            return processSetResponse(cached);
-        }
-        else if (cached.isNXDOMAIN() || cached.isNXRRSET()) {
-            return null;
-        }
-        else if (querysent) {
-            return null;
-        }
-        else {
-            getLogger().debug(new StringBuffer(256)
-                             .append("Looking up MX record for ")
-                             .append(name)
-                             .toString());
-            Record question = Record.newRecord(name, type, dclass);
-            Message query = Message.newQuery(question);
-            Message response = null;
-
-            try {
-                response = resolver.send(query);
-            }
-            catch (Exception ex) {
-                getLogger().warn("Query error!", ex);
-                return null;
-            }
-
-            int rcode = response.getHeader().getRcode();
-            if (rcode == Rcode.NOERROR || rcode == Rcode.NXDOMAIN) {
-                cached = cache.addMessage(response);
-                if (cached != null && cached.isSuccessful()) {
-                    return processSetResponse(cached);
-                }
-            }
-
-            if (rcode != Rcode.NOERROR) {
-                return null;
-            }
-
-            return rawDNSLookup(namestr, true, type);
-        }
     }
     
-    protected Record[] processSetResponse(SetResponse sr) {
-        Record [] answers;
-        int answerCount = 0, n = 0;
-
-        RRset [] rrsets = sr.answers();
-        answerCount = 0;
-        for (int i = 0; i < rrsets.length; i++) {
-            answerCount += rrsets[i].size();
-        }
-
-        answers = new Record[answerCount];
-
-        for (int i = 0; i < rrsets.length; i++) {
-            Iterator iter = rrsets[i].rrs();
-            while (iter.hasNext()) {
-                Record r = (Record)iter.next();
-                answers[n++] = r;
-            }
-        }
-        return answers;
-    }
-
     /* RFC 2821 section 5 requires that we sort the MX records by their
      * preference, and introduce a randomization.  This Comparator does
      * comparisons as normal unless the values are equal, in which case
@@ -503,14 +411,37 @@
      * @see org.apache.james.services.DNSServer#getByName(String)
      */
     public InetAddress getByName(String host) throws UnknownHostException {
-        return org.xbill.DNS.Address.getByName(allowIPLiteral(host));
+        String name = allowIPLiteral(host);
+        try {
+            return org.xbill.DNS.Address.getByAddress(name);
+        } catch (UnknownHostException e) {
+            Record [] records = lookup(name, Type.A, "A");
+            if (records != null && records.length >= 1) {
+                ARecord a = (ARecord) records[0];
+                return InetAddress.getByAddress(name, a.getAddress().getAddress());
+            } else throw e;
+        }
     }
 
     /**
      * @see org.apache.james.services.DNSServer#getAllByName(String)
      */
     public InetAddress[] getAllByName(String host) throws UnknownHostException {
-        return org.xbill.DNS.Address.getAllByName(allowIPLiteral(host));
+        String name = allowIPLiteral(host);
+        try {
+            InetAddress addr = org.xbill.DNS.Address.getByAddress(name);
+            return new InetAddress[] {addr};
+        } catch (UnknownHostException e) {
+            Record [] records = lookup(name, Type.A, "A");
+            if (records != null && records.length >= 1) {
+                InetAddress [] addrs = new InetAddress[records.length];
+                for (int i = 0; i < records.length; i++) {
+                    ARecord a = (ARecord) records[i];
+                    addrs[i] = InetAddress.getByAddress(name, a.getAddress().getAddress());
+                }
+                return addrs;
+            } else throw e;
+        }
     }
     
     /**
@@ -520,7 +451,7 @@
         List txtR = new ArrayList();
         Record[] records;
         
-        records = lookup(hostname, Type.TXT);
+        records = lookup(hostname, Type.TXT, "TXT");
     
         if (records != null) {
            for (int i = 0; i < records.length; i++) {
@@ -536,11 +467,13 @@
      * @see org.apache.james.services.DNSServer#getHostName(java.net.InetAddress)
      */
     public String getHostName(InetAddress addr){
-        try {
-            return org.xbill.DNS.Address.getHostName(addr);
-        } catch (UnknownHostException e) {
-            return addr.getHostAddress();
+        Name name = ReverseMap.fromAddress(addr);
+        Record [] records = lookup(name.toString(), Type.PTR, "PTR");
+        if (records == null) {
+            addr.getHostAddress();
         }
+        PTRRecord ptr = (PTRRecord) records[0];
+        return ptr.getTarget().toString();
     }
 
     /**

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSession.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSession.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSession.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSession.java Tue Nov  7 09:51:49 2006
@@ -22,7 +22,7 @@
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.services.User;
 import org.apache.james.services.UsersRepository;
 
@@ -118,7 +118,7 @@
      */
     void closeMailbox();
 
-    GeneralManager getMailboxManager() throws MailboxManagerException;
+    MailboxManager getMailboxManager() throws MailboxManagerException;
 
     String buildFullName(String mailboxName) throws MailboxManagerException;
 

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSessionImpl.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSessionImpl.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/ImapSessionImpl.java Tue Nov  7 09:51:49 2006
@@ -27,7 +27,7 @@
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 import org.apache.james.services.User;
 import org.apache.james.services.UsersRepository;
@@ -49,7 +49,7 @@
     private MailboxManagerProvider mailboxManagerProvider;
     private UsersRepository users;
     
-    private GeneralManager mailboxManager = null;
+    private MailboxManager mailboxManager = null;
     private User mailboxManagerUser = null;
     
     public ImapSessionImpl( MailboxManagerProvider mailboxManagerProvider,
@@ -192,7 +192,7 @@
 
 
 
-    public GeneralManager getMailboxManager() throws MailboxManagerException {
+    public MailboxManager getMailboxManager() throws MailboxManagerException {
         final boolean usersEqual;
         if (mailboxManagerUser!=null) {
             usersEqual=mailboxManagerUser.equals(user);
@@ -203,7 +203,7 @@
             if (mailboxManager!=null) {
                 mailboxManager.close();
             }
-            mailboxManager=mailboxManagerProvider.getGeneralManagerInstance(user);
+            mailboxManager=mailboxManagerProvider.getMailboxManagerInstance(user);
         }
         return mailboxManager;
     }

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/AppendCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/AppendCommand.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/AppendCommand.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/AppendCommand.java Tue Nov  7 09:51:49 2006
@@ -69,7 +69,7 @@
         ImapMailboxSession mailbox = null;
         try {
             mailboxName=session.buildFullName(mailboxName);
-            mailbox = (ImapMailboxSession) session.getMailboxManager().getGenericGeneralMailboxSession(mailboxName);
+            mailbox = session.getMailboxManager().getImapMailboxSession(mailboxName);
         }
         catch ( MailboxManagerException mme ) {
             MailboxException me = new MailboxException(mme);

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/SelectCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/SelectCommand.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/SelectCommand.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/imapserver/commands/SelectCommand.java Tue Nov  7 09:51:49 2006
@@ -84,7 +84,7 @@
     }
 
     private boolean selectMailbox(String mailboxName, ImapSession session, boolean readOnly) throws MailboxException, MailboxManagerException {
-        ImapMailboxSession mailbox = session.getMailboxManager().getGenericImapMailboxSession(mailboxName);
+        ImapMailboxSession mailbox = session.getMailboxManager().getImapMailboxSession(mailboxName);
 
         if ( !mailbox.isSelectable() ) {
             throw new MailboxException( "Nonselectable mailbox." );

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/MailboxManagerException.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/MailboxManagerException.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/MailboxManagerException.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/MailboxManagerException.java Tue Nov  7 09:51:49 2006
@@ -19,7 +19,9 @@
 
 package org.apache.james.mailboxmanager;
 
-public class MailboxManagerException extends Exception {
+import javax.mail.MessagingException;
+
+public class MailboxManagerException extends MessagingException {
 
     private static final long serialVersionUID = -7034955921835169361L;
 

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.mailbox;
 
 import java.util.Date;
@@ -8,7 +27,7 @@
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;
 
-public interface GeneralMailbox {
+public interface GeneralMailbox extends Mailbox {
     
     /**
      * 
@@ -24,17 +43,7 @@
      */
     int getMessageSetTypes();
     
-    /**
-     * Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)
-     * 
-     * @return Full folder name with namespace
-     * @throws MailboxManagerException 
-     */
-
-    String getName() throws MailboxManagerException;
-
-    int getMessageCount() throws MailboxManagerException;
-    
+ 
 
     /**
      * @param internalDate

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java Tue Nov  7 09:51:49 2006
@@ -1,5 +1,61 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.mailbox;
 
+import java.util.Collection;
+
+import javax.mail.internet.MimeMessage;
+
+import org.apache.james.mailboxmanager.MailboxManagerException;
+
 public interface Mailbox {
+
+    /**
+     * Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)
+     * 
+     * @return Full folder name with namespace
+     * @throws MailboxManagerException
+     */
+
+    String getName() throws MailboxManagerException;
+
+    int getMessageCount() throws MailboxManagerException;
+
+    /** @return the key */
+    String store(MimeMessage message) throws MailboxManagerException;
+
+    /** @return keys */
+    Collection list() throws MailboxManagerException;
+
+    MimeMessage retrieve(String key) throws MailboxManagerException;
+
+    /**
+     * key changes by updating
+     * 
+     * @param key
+     *            the current key
+     * @return the new key
+     */
+    String update(String key, MimeMessage message)
+            throws MailboxManagerException;
+
+    void remove(String key) throws MailboxManagerException;
 
 }

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java Tue Nov  7 09:51:49 2006
@@ -1,10 +1,28 @@
-package org.apache.james.mailboxmanager.mailbox;
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
 
+package org.apache.james.mailboxmanager.mailbox;
 
 public interface MailboxSession extends Mailbox {
 
-    public void close();
-    
-    public boolean isWriteable();
-    
+    void close();
+
+    boolean isWriteable();
+
 }

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java Tue Nov  7 09:51:49 2006
@@ -1,5 +1,165 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.manager;
 
+import org.apache.james.mailboxmanager.GeneralMessageSet;
+import org.apache.james.mailboxmanager.ListResult;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.Namespace;
+import org.apache.james.mailboxmanager.Namespaces;
+import org.apache.james.mailboxmanager.mailbox.GeneralMailbox;
+import org.apache.james.mailboxmanager.mailbox.GeneralMailboxSession;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+import org.apache.james.mailboxmanager.mailbox.MailboxSession;
+import org.apache.james.services.User;
+
+
+/**
+ * <p>
+ * Central MailboxManager which creates, lists, provides, renames and
+ * deletes Mailboxes
+ * </p>
+ * <p>
+ * An important goal is to be JavaMail feature compatible. That means JavaMail
+ * could be used in both directions: As a backend for e.g. accessing a Maildir
+ * JavaMail store or as a frontend to access a JDBC MailboxManager
+ * through JavaMail. This should be possible by not too complicated wrapper
+ * classes. Due to the complexity of JavaMail it might be impossible to avoid
+ * some limitations.
+ * </p>
+ * <p>
+ * Internally MailboxManager deals with named repositories that could have
+ * different implementations. E.g. JDBC connections to different hosts or
+ * Maildir / Mbox like stores. This repositories are identified by its names and
+ * maybe are configured in config.xml. The names of the mailboxes have to be
+ * mapped to the corresponding repository name. For user mailboxes this could be
+ * done by a "User.getRepositoryName()" property. It is imaginable that
+ * repositories lookup further properties from the user object like a path name
+ * for a file based storage method. Until Milestone 6 there is only one named
+ * repository: "default".
+ * </p>
+ * <p>
+ * The only operation that requires dealing with the named repositories directly
+ * is the quota management. It is probably really difficult to implement a quota
+ * system that spans multiple repository implementations. That is why quotas are
+ * created for a specific repository. To be able to administer, repositories and
+ * theier belonging mailboxes can be listet.
+ * </p>
+ */
+
 public interface MailboxManager {
 
+    /**
+     * get a session mailbox 
+     * 
+     * @param nameSpaceName
+     * @param user
+     * @return
+     * @throws MailboxManagerException 
+     */
+    MailboxSession getMailboxSession(String mailboxName) throws MailboxManagerException;
+    
+    /**
+     * Supports 
+     * 
+     * @param mailboxName
+     * @return
+     * @throws MailboxManagerException
+     */
+    
+    GeneralMailboxSession getGeneralMailboxSession(String mailboxName) throws MailboxManagerException;
+    
+    ImapMailboxSession getImapMailboxSession(String mailboxName) throws MailboxManagerException;
+
+    /**
+     * The Namespaces a user has access to.
+     * @param forUser TODO
+     * @param user
+     * 
+     * @return
+     */
+    Namespaces getNamespaces(User forUser);
+
+    /**
+     * To get the Inbox you can just to a mailbox
+     * defaultNameSpace=ImapMailboxRepository.getPersonalDefaultNameSpace(user)
+     * inbox=defaultNameSpace.getName()+defaultNameSpace.getHierarchyDelimter()+"INBOX";
+     * TODO add a convinience method to get directly a session mailbox for a users inbox
+     * @param forUser TODO
+     * 
+     * @return
+     */
+    Namespace getPersonalDefaultNamespace(User forUser);
+    
+    
+
+    void createMailbox(String mailboxName) throws MailboxManagerException;
+
+    void deleteMailbox(String mailboxName) throws MailboxManagerException;
+
+    void renameMailbox(String from, String to) throws MailboxManagerException;
+
+    /**
+     * this is done by the MailboxRepository because maybe this operation could
+     * be optimized in the corresponding store.
+     * 
+     * @param from
+     * @param set
+     *            messages to copy
+     * @param to
+     *            name of the destination mailbox
+     */
+    void copyMessages(GeneralMailbox from, GeneralMessageSet set, String to) throws MailboxManagerException;
+
+    /**
+     * 
+     * @param base
+     *            hierarchy starting point like #mail.user1 to list mailboxes of
+     *            user1
+     * @param expression
+     *            allows the use of wildcards
+     * @param subscribed
+     *            if true, only list subscribed mailboxes (needs interaction
+     *            with the user-object)
+     * @param user
+     * @return
+     * @throws MailboxManagerException 
+     */
+
+    ListResult[] list(String base, String expression, boolean subscribed) throws MailboxManagerException;
+
+    /**
+     * could be implemented later. There could be enviroments where
+     * subscribtions are stored in the mailbox database. Another possibility is
+     * to manage subscribtions in the user repository, e.g. a ldap attribute,
+     * 
+     * @param mailboxName
+     * @param value
+     * @param user
+     */
+
+    void setSubscription(String mailboxName, boolean value) throws MailboxManagerException;
+
+    boolean existsMailbox(String mailboxName) throws MailboxManagerException;
+
+    void close();
+
 }
+

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java Tue Nov  7 09:51:49 2006
@@ -1,14 +1,56 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.manager;
 
 import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.mailbox.MailboxSession;
 import org.apache.james.services.User;
 
 public interface MailboxManagerProvider {
     
-    public MailboxManager getMailboxManagerInstance(User user, Class neededClass) throws MailboxManagerException;
+    public MailboxManager getMailboxManagerInstance(User user) throws MailboxManagerException;
+ 
+
+    /**
+     * <b>WARNING</b> this really deletes everything. Useful for testing
+     * 
+     * @throws MailboxManagerException
+     */
+    public void deleteEverything() throws MailboxManagerException;
     
-    public GeneralManager getGeneralManagerInstance(User user) throws MailboxManagerException;
+    MailboxSession getInboxSession(User user);
+
+    /** @param authUser the authorized User for checking credentials 
+        @param mailboxName a logical/hierarchical mailbox name **/ 
+
+    MailboxSession getMailboxSession(
+         User authUser, String mailboxName);
     
-    public void deleteEverything() throws MailboxManagerException;
+    /**
+     * removes all data (mailboxes, quota, acls...) that is associated 
+     * with this user.
+     * 
+     * @param authUser the authorized User for checking credentials 
+     * @param targetUser the user whos data will be deleted
+     */
+    
+    void deleteAllUserData(User authUser,User targetUser);
 
 }

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java Tue Nov  7 09:51:49 2006
@@ -46,7 +46,7 @@
 import org.apache.james.mailboxmanager.mailbox.FlaggedMailbox;
 import org.apache.james.mailboxmanager.mailbox.MailboxSession;
 import org.apache.james.mailboxmanager.mailbox.UidMailbox;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 import org.apache.james.services.User;
 import org.apache.james.userrepository.DefaultJamesUser;
@@ -66,7 +66,7 @@
      */
     private UidToKeyBidiMap uidToKeyBidiMap = null;
 
-    private GeneralManager mailboxManager;
+    private MailboxManager mailboxManager;
 
     private MailboxGateKeeper mailboxGateKeeper;
 
@@ -391,7 +391,7 @@
 
                 String inbox=ns.getName() + ns.getHierarchyDelimter()+ "INBOX";
                 mailbox = getMailboxManager()
-                        .getGenericImapMailboxSession(inbox);
+                        .getImapMailboxSession(inbox);
             }
             return mailbox;
         }
@@ -402,14 +402,14 @@
      * 
      */
     
-    protected GeneralManager getMailboxManager() throws MessagingException,
+    protected MailboxManager getMailboxManager() throws MessagingException,
             MailboxManagerException {
         if (mailboxManager == null) {
             if (user == null) {
                 throw new MessagingException("user is null");
             }
             mailboxManager = getMailboxManagerProvider()
-                    .getGeneralManagerInstance(user);
+                    .getMailboxManagerInstance(user);
         }
         return mailboxManager;
     }

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.torque;
 
 import java.io.ByteArrayOutputStream;
@@ -14,7 +33,6 @@
 import javax.mail.search.SearchTerm;
 
 import org.apache.commons.logging.Log;
-import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxListener;
 import org.apache.james.mailboxmanager.MailboxManagerException;
@@ -22,6 +40,7 @@
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.impl.MailboxEventDispatcher;
 import org.apache.james.mailboxmanager.impl.MessageResultImpl;
+import org.apache.james.mailboxmanager.mailbox.AbstractGeneralMailbox;
 import org.apache.james.mailboxmanager.mailbox.ImapMailbox;
 import org.apache.james.mailboxmanager.torque.om.MailboxRow;
 import org.apache.james.mailboxmanager.torque.om.MailboxRowPeer;
@@ -41,7 +60,7 @@
 import com.sun.mail.util.CRLFOutputStream;
 import com.workingdogs.village.DataSetException;
 
-public class TorqueMailbox implements ImapMailbox {
+public class TorqueMailbox extends AbstractGeneralMailbox implements ImapMailbox {
 
     private boolean open = true;
 
@@ -53,10 +72,8 @@
 
     private MailboxEventDispatcher eventDispatcher = new MailboxEventDispatcher();
     
-    protected Log log;
-
     TorqueMailbox(MailboxRow mailboxRow, UidChangeTracker tracker, Log log) {
-        this.log=log;
+        setLog(log);
         this.mailboxRow = mailboxRow;
         this.tracker = tracker;
         tracker.addMailboxListener(getEventDispatcher());
@@ -505,13 +522,6 @@
         return tracker;
     }
     
-    protected Log getLog() {
-        if (log==null) {
-            log=new SimpleLog("TorqueMailbox");
-        }
-        return log;
-    }
-
     protected MailboxRow getMailboxRow() {
         return mailboxRow;
     }

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.torque;
 
 import java.util.Iterator;
@@ -19,7 +38,7 @@
 import org.apache.james.mailboxmanager.mailbox.GeneralMailboxSession;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
 import org.apache.james.mailboxmanager.mailbox.MailboxSession;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.torque.om.MailboxRow;
 import org.apache.james.mailboxmanager.torque.om.MailboxRowPeer;
 import org.apache.james.mailboxmanager.tracking.MailboxCache;
@@ -30,7 +49,7 @@
 import org.apache.torque.util.CountHelper;
 import org.apache.torque.util.Criteria;
 
-public class TorqueMailboxManager implements GeneralManager {
+public class TorqueMailboxManager implements MailboxManager {
     
     public static final char HIERARCHY_DELIMITER='.';
     
@@ -49,17 +68,19 @@
         this.log=log;
     }
     
-    public MailboxSession getMailboxSession(String mailboxName, Class neededInterface, int[] setTypes,int resultTypes)
+    public MailboxSession getMailboxSession(String mailboxName)
     throws MailboxManagerException {
-        return getGenericImapMailboxSession(mailboxName);
+        return getImapMailboxSession(mailboxName);
     }
+    
+
 
-    public GeneralMailboxSession getGenericGeneralMailboxSession(String mailboxName)
+    public GeneralMailboxSession getGeneralMailboxSession(String mailboxName)
     throws MailboxManagerException {
-        return getGenericImapMailboxSession(mailboxName);
+        return getImapMailboxSession(mailboxName);
     }
     
-    public ImapMailboxSession getGenericImapMailboxSession(String mailboxName)
+    public ImapMailboxSession getImapMailboxSession(String mailboxName)
             throws MailboxManagerException {
         
         // prepare to auto-create users Inbox
@@ -202,7 +223,7 @@
     }
 
     public void copyMessages(GeneralMailbox from, GeneralMessageSet set, String to) throws MailboxManagerException {
-        GeneralMailboxSession toMailbox=(GeneralMailboxSession)getMailboxSession(to,GeneralMailboxSession.class, new int[0],MessageResult.NOTHING);
+        GeneralMailboxSession toMailbox=(GeneralMailboxSession)getGeneralMailboxSession(to);
         
         MessageResult[] mr=from.getMessages(set, MessageResult.MIME_MESSAGE | MessageResult.INTERNAL_DATE);
         for (int i = 0; i < mr.length; i++) {

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManagerProvider.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.torque;
 
 import java.io.File;
@@ -22,7 +41,7 @@
 import org.apache.commons.logging.impl.AvalonLogger;
 import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.mailbox.MailboxSession;
 import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 import org.apache.james.mailboxmanager.torque.om.MailboxRowPeer;
@@ -53,11 +72,8 @@
 
     private static final String[] tableNames= new String[] {MailboxRowPeer.TABLE_NAME,MessageRowPeer.TABLE_NAME,MessageHeaderPeer.TABLE_NAME,MessageBodyPeer.TABLE_NAME,MessageFlagsPeer.TABLE_NAME};
 
-    public MailboxManager getMailboxManagerInstance(User user,Class neededClass)
-            throws MailboxManagerException {
-     return getGeneralManagerInstance(user);
-    }
-    public GeneralManager getGeneralManagerInstance(User user)             throws MailboxManagerException {
+
+    public MailboxManager getMailboxManagerInstance(User user)         throws MailboxManagerException {
         if (!initialized)  {
             throw new MailboxManagerException("must be initialized first!");
         }
@@ -173,7 +189,7 @@
     }
 
     public void deleteEverything() throws MailboxManagerException {
-        ((TorqueMailboxManager) getMailboxManagerInstance(null,TorqueMailboxManager.class))
+        ((TorqueMailboxManager) getMailboxManagerInstance(null))
                 .deleteEverything();
         mailboxCache=null;
     }
@@ -205,6 +221,19 @@
     
     protected void setFileSystem(FileSystem system) {
         this.fileSystem = system;
+    }
+    public void deleteAllUserData(User authUser, User targetUser) {
+        // TODO Auto-generated method stub
+        
+    }
+    public MailboxSession getInboxSession(User user) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public MailboxSession getMailboxSession(User authUser, String mailboxName) {
+        // TODO Auto-generated method stub
+        return null;
     }
     
 

Modified: james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/java/org/apache/james/mailboxmanager/wrapper/NumberStableSessionWrapper.java Tue Nov  7 09:51:49 2006
@@ -1,9 +1,27 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.wrapper;
 
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
@@ -15,12 +33,12 @@
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.impl.MailboxEventDispatcher;
 import org.apache.james.mailboxmanager.impl.MessageResultImpl;
+import org.apache.james.mailboxmanager.mailbox.AbstractGeneralMailbox;
 import org.apache.james.mailboxmanager.mailbox.EventQueueingSessionMailbox;
 import org.apache.james.mailboxmanager.mailbox.EventTriggerMailbox;
 import org.apache.james.mailboxmanager.mailbox.GeneralMailbox;
-import org.apache.james.mailboxmanager.util.AbstractLogEnabled;
 
-public class NumberStableSessionWrapper extends AbstractLogEnabled implements EventQueueingSessionMailbox,
+public abstract class NumberStableSessionWrapper extends AbstractGeneralMailbox implements EventQueueingSessionMailbox,
         MailboxListener {
 
     protected GeneralMailbox mailbox;

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/dnsserver/DNSServerTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/dnsserver/DNSServerTest.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/dnsserver/DNSServerTest.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/dnsserver/DNSServerTest.java Tue Nov  7 09:51:49 2006
@@ -23,52 +23,71 @@
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.test.mock.avalon.MockLogger;
+import org.xbill.DNS.Cache;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.Lookup;
+import org.xbill.DNS.Message;
 import org.xbill.DNS.Name;
+import org.xbill.DNS.RRset;
 import org.xbill.DNS.Record;
 import org.xbill.DNS.Resolver;
+import org.xbill.DNS.SOARecord;
 import org.xbill.DNS.SetResponse;
-import org.xbill.DNS.TextParseException;
 import org.xbill.DNS.Zone;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.net.URL;
 import java.util.Collection;
 import java.util.Iterator;
-import java.net.URL;
 
 import junit.framework.TestCase;
 
 public class DNSServerTest extends TestCase {
 
     private TestableDNSServer dnsServer;
-
-    /**
-     * Please note that this is an hardcoded test that works because
-     * www.pippo.com. is an alias to pippo.com and pippo.com has
-     * "pippo.com.inbound.mxlogic.net." as its mx record.
-     * This is the first domain with a record proving a previous james bug.
-     * This test will be invalidated by any change in the pippo.com dns records
-     * 
-     * @param args
-     * @throws Exception
-     */
+    private Cache defaultCache;
+    private Resolver defaultResolver;
+    private Name[] defaultSearchPaths;
+    
+    public void testNoMX() throws Exception {
+        dnsServer.setResolver(null);
+        dnsServer.setCache(new ZoneCache("dnstest.com."));
+        //a.setSearchPath(new String[] { "searchdomain.com." });
+        Collection records = dnsServer.findMXRecords("nomx.dnstest.com.");
+        assertEquals(1, records.size());
+        assertEquals("nomx.dnstest.com.", records.iterator()
+                .next());
+    }
+    
+    public void testBadMX() throws Exception {
+        dnsServer.setResolver(null);
+        dnsServer.setCache(new ZoneCache("dnstest.com."));
+        //a.setSearchPath(new String[] { "searchdomain.com." });
+        Collection records = dnsServer.findMXRecords("badmx.dnstest.com.");
+        assertEquals(1, records.size());
+        assertEquals("badhost.dnstest.com.", records.iterator()
+                .next());
+        Iterator it = dnsServer.getSMTPHostAddresses("badmx.dnstest.com.");
+        assertFalse(it.hasNext());
+    }
+    
     public void testINARecords() throws Exception {
-        Zone z = loadZone("pippo.com.");
+        // Zone z = loadZone("pippo.com.");
         dnsServer.setResolver(null);
-        dnsServer.setLookupper(new ZoneLookupper(z));
+        dnsServer.setCache(new ZoneCache("pippo.com."));
+        // dnsServer.setLookupper(new ZoneLookupper(z));
         Collection records = dnsServer.findMXRecords("www.pippo.com.");
         assertEquals(1, records.size());
         assertEquals("pippo.com.inbound.mxlogic.net.", records.iterator()
                 .next());
     }
 
-    /**
-     * @throws Exception
-     */
     public void testMXCatches() throws Exception {
-        Zone z = loadZone("test-zone.com.");
+        // Zone z = loadZone("test-zone.com.");
         dnsServer.setResolver(null);
-        dnsServer.setLookupper(new ZoneLookupper(z));
+        dnsServer.setCache(new ZoneCache("test-zone.com."));
+        // dnsServer.setLookupper(new ZoneLookupper(z));
         Collection res = dnsServer.findMXRecords("test-zone.com.");
         try {
             res.add(new Object());
@@ -79,19 +98,11 @@
         assertEquals("mail.test-zone.com.",res.iterator().next());
     }
 
-    /**
-     * Please note that this is an hardcoded test that works because
-     * brandilyncollins.com. has an MX record that point to mxmail.register.com
-     * and this is a CNAME to the real address.
-     * This test will be invalidated by any change in the brandilyncollins.com dns records
-     * 
-     * @param args
-     * @throws Exception
-     */
     public void testCNAMEasMXrecords() throws Exception {
-        Zone z = loadZone("brandilyncollins.com.");
+        // Zone z = loadZone("brandilyncollins.com.");
         dnsServer.setResolver(null);
-        dnsServer.setLookupper(new ZoneLookupper(z));
+        dnsServer.setCache(new ZoneCache("brandilyncollins.com."));
+        // dnsServer.setLookupper(new ZoneLookupper(z));
         Iterator records = dnsServer.getSMTPHostAddresses("brandilyncollins.com.");
         assertEquals(true, records.hasNext());
     }
@@ -106,11 +117,22 @@
         ContainerUtil.enableLogging(dnsServer, new MockLogger());
         ContainerUtil.configure(dnsServer, c);
         ContainerUtil.initialize(dnsServer);
+        
+        
+        defaultCache = Lookup.getDefaultCache(DClass.IN);
+        defaultResolver = Lookup.getDefaultResolver();
+        defaultSearchPaths = Lookup.getDefaultSearchPath();
+        Lookup.setDefaultCache(null, DClass.IN);
+        Lookup.setDefaultResolver(null);
+        Lookup.setDefaultSearchPath(new Name[] {});
     }
 
     protected void tearDown() throws Exception {
-        dnsServer.setLookupper(null);
+        dnsServer.setCache(null);
         ContainerUtil.dispose(dnsServer);
+        Lookup.setDefaultCache(defaultCache, DClass.IN);
+        Lookup.setDefaultResolver(defaultResolver);
+        Lookup.setDefaultSearchPath(defaultSearchPaths);
     }
 
     private Zone loadZone(String zoneName) throws IOException {
@@ -122,57 +144,113 @@
         return zone;
     }
 
-    private class ZoneLookupper implements Lookupper {
-        private final Zone z;
+    private final class ZoneCache extends Cache {
 
-        private ZoneLookupper(Zone z) {
-            super();
-            this.z = z;
+        Zone z = null;
+        
+        public ZoneCache(String string) throws IOException {
+            z = loadZone(string);
         }
 
-        public SetResponse lookup(Name name, int type) {
-            SetResponse s = z.findRecords(name,type);
-            System.out.println("Zone Lookup: "+name+" "+type+" = "+s);
-            return s; 
+        public SetResponse addMessage(Message arg0) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
         }
-    }
 
-    private interface Lookupper {
-        SetResponse lookup(Name name, int type);
-    }
-    
-    private final class TestableDNSServer extends DNSServer {
-        
-        private Lookupper lookupper;
+        public synchronized void addNegative(Name arg0, int arg1, SOARecord arg2, int arg3) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
 
-        public void setLookupper(Lookupper l) {
-            this.lookupper = l;
+        public synchronized void addRecord(Record arg0, int arg1, Object arg2) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
         }
-        
-        public Record[] lookup(String name, int type) {
-            if (lookupper != null) {
-                try {
-                    SetResponse lookup = lookupper.lookup(Name.fromString(name), type);
-                    if (lookup != null && lookup.isSuccessful()) {
-                        return processSetResponse(lookup);
-                    } else {
-                        return null;
-                    }
-                } catch (TextParseException e) {
-                    e.printStackTrace();
-                    return null;
-                }
-            } else {
-                return super.lookup(name, type);
-            }
+
+        public synchronized void addRRset(RRset arg0, int arg1) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public synchronized void clearCache() {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public RRset[] findAnyRecords(Name arg0, int arg1) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public RRset[] findRecords(Name arg0, int arg1) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public void flushName(Name arg0) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public void flushSet(Name arg0, int arg1) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public int getDClass() {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public int getMaxCache() {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public int getMaxEntries() {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public int getMaxNCache() {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public int getSize() {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        protected synchronized SetResponse lookup(Name arg0, int arg1, int arg2) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public SetResponse lookupRecords(Name arg0, int arg1, int arg2) {
+            System.out.println("Cache.lookupRecords "+arg0+","+arg1+","+arg2);
+            return z.findRecords(arg0, arg1);
+            //return super.lookupRecords(arg0, arg1, arg2);
+        }
+
+        public void setCleanInterval(int arg0) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public void setMaxCache(int arg0) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public void setMaxEntries(int arg0) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+        }
+
+        public void setMaxNCache(int arg0) {
+            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
         }
+    }
 
+    private final class TestableDNSServer extends DNSServer {
+        
         public void setResolver(Resolver r) {
             resolver = r;
         }
 
         public Resolver getResolver() {
             return resolver;
+        }
+        
+        public void setCache(Cache c) {
+            cache = c;
+        }
+        
+        public Cache getCache() {
+            return cache;
         }
     }
 

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/handler/session/AbstractSessionTest.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.imapserver.handler.session;
 
 import java.io.BufferedReader;
@@ -36,12 +55,12 @@
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.mailbox.GeneralMailboxSession;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.jmock.MockObjectTestCase;
 
 public abstract class AbstractSessionTest extends MockObjectTestCase implements TestConstants {
     
-    GeneralManager mailboxManager;
+    MailboxManager mailboxManager;
     
     private ImapRequestHandler handler;
     private ImapSession session;
@@ -60,7 +79,7 @@
                 theConfigData.getUsersRepository(), new MockImapHandler(),
                 HOST_NAME, HOST_ADDRESS);
         handler = new ImapRequestHandler();
-        mailboxManager=theConfigData.getMailboxManagerProvider().getGeneralManagerInstance(new MockUser());
+        mailboxManager=theConfigData.getMailboxManagerProvider().getMailboxManagerInstance(new MockUser());
 
     }
     
@@ -249,7 +268,7 @@
     private ImapMailboxSession getImapMailboxSession(String mailboxName) throws MailboxManagerException {
         int[] neededSets = new int[] {GeneralMessageSet.TYPE_UID};
         int neededResults= MessageResult.UID + MessageResult.MIME_MESSAGE + MessageResult.FLAGS;
-        ImapMailboxSession mailboxSession= (ImapMailboxSession) mailboxManager.getMailboxSession(mailboxName, ImapMailboxSession.class, neededSets, neededResults);
+        ImapMailboxSession mailboxSession= mailboxManager.getImapMailboxSession(mailboxName);
         return mailboxSession;
     }
 }

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/util/ImapServerLauncher.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/util/ImapServerLauncher.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/util/ImapServerLauncher.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/imapserver/util/ImapServerLauncher.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.imapserver.util;
 
 import java.io.IOException;
@@ -11,7 +30,6 @@
 import org.apache.james.imapserver.mock.MockImapHandlerConfigurationData;
 import org.apache.james.imapserver.mock.MockWatchdog;
 import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
 import org.apache.james.test.mock.avalon.MockLogger;
 
 public class ImapServerLauncher  implements TestConstants 

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractImapMailboxSelfTestCase.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager;
 
 import java.util.Date;
@@ -11,11 +30,11 @@
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.impl.MailboxListenerCollector;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 
 public abstract class AbstractImapMailboxSelfTestCase extends TestCase {
     
-    protected GeneralManager mailboxManager;
+    protected MailboxManager mailboxManager;
     
     protected ImapMailboxSession mailbox;
     
@@ -26,7 +45,7 @@
     public void setUp() throws Exception {
         super.setUp();
         mailboxManager.createMailbox(INBOX);
-        mailbox=mailboxManager.getGenericImapMailboxSession(INBOX);
+        mailbox=mailboxManager.getImapMailboxSession(INBOX);
         collector=new MailboxListenerCollector();
         mailbox.addListener(collector, 0);
         assertNotNull(mailbox);

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractMailboxManagerSelfTestCase.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractMailboxManagerSelfTestCase.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractMailboxManagerSelfTestCase.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/AbstractMailboxManagerSelfTestCase.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager;
 
 import java.util.HashSet;
@@ -5,13 +24,13 @@
 import java.util.Set;
 
 import org.apache.james.mailboxmanager.mailbox.GeneralMailboxSession;
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 
 import junit.framework.TestCase;
 
 public abstract class AbstractMailboxManagerSelfTestCase extends TestCase {
     
-    protected GeneralManager mailboxManager;
+    protected MailboxManager mailboxManager;
     
     
     public void testCreateList() throws MailboxManagerException {
@@ -36,7 +55,7 @@
     
     public void testGetSessionMailbox() throws MailboxManagerException {
         mailboxManager.createMailbox("#users.joachim3.INBOX");
-        GeneralMailboxSession sessionMailbox=mailboxManager.getGenericGeneralMailboxSession("#users.joachim3.INBOX");
+        GeneralMailboxSession sessionMailbox=mailboxManager.getGeneralMailboxSession("#users.joachim3.INBOX");
         assertNotNull(sessionMailbox);
     }
     

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/AbstractMailboxRowTestCase.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/AbstractMailboxRowTestCase.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/AbstractMailboxRowTestCase.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/AbstractMailboxRowTestCase.java Tue Nov  7 09:51:49 2006
@@ -1,6 +1,25 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.torque;
 
-import org.apache.james.mailboxmanager.manager.GeneralManager;
+import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.mock.MockUser;
 import org.apache.james.mailboxmanager.mock.TorqueMailboxManagerProviderSingleton;
 import org.apache.james.mailboxmanager.torque.om.MailboxRowPeer;
@@ -9,7 +28,7 @@
 
 public abstract class AbstractMailboxRowTestCase extends AbstractTorqueTestCase {
 
-    GeneralManager mm;
+    MailboxManager mm;
     
     public AbstractMailboxRowTestCase() throws TorqueException {
         super();
@@ -17,7 +36,7 @@
     public void setUp() throws Exception {
         super.setUp();
         assertEquals(0,MailboxRowPeer.doSelect(new Criteria()).size());
-        mm=TorqueMailboxManagerProviderSingleton.getTorqueMailboxManagerProviderInstance().getGeneralManagerInstance(new MockUser());
+        mm=TorqueMailboxManagerProviderSingleton.getTorqueMailboxManagerProviderInstance().getMailboxManagerInstance(new MockUser());
     }
     public void tearDown() {
         

Modified: james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/TorqueImapMailboxSelfTestCase.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/TorqueImapMailboxSelfTestCase.java?view=diff&rev=472179&r1=472178&r2=472179
==============================================================================
--- james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/TorqueImapMailboxSelfTestCase.java (original)
+++ james/server/sandbox/mailbox-namespaces/src/test/org/apache/james/mailboxmanager/torque/TorqueImapMailboxSelfTestCase.java Tue Nov  7 09:51:49 2006
@@ -1,3 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
 package org.apache.james.mailboxmanager.torque;
 
 import javax.mail.MessagingException;
@@ -19,7 +38,7 @@
     public void setUp() throws Exception {
         MailboxManagerProvider mailboxManagerProvider=TorqueMailboxManagerProviderSingleton.getTorqueMailboxManagerProviderInstance();
         mailboxManagerProvider.deleteEverything();
-        mailboxManager = mailboxManagerProvider .getGeneralManagerInstance(new MockUser());
+        mailboxManager = mailboxManagerProvider .getMailboxManagerInstance(new MockUser());
         
         super.setUp();
     }



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