james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r545282 [1/2] - in /james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src: main/java/org/apache/james/api/imap/ main/java/org/apache/james/experimental/imapserver/ main/java/org/apache/james/experimental/imapserver/proc...
Date Thu, 07 Jun 2007 19:52:32 GMT
Author: rdonkin
Date: Thu Jun  7 12:52:29 2007
New Revision: 545282

URL: http://svn.apache.org/viewvc?view=rev&rev=545282
Log:
Decoupled ImapSession interface from mailbox.

Added:
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapProcessor.java
      - copied, changed from r544873, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/ImapProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapSession.java
      - copied, changed from r544933, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/SelectedImapMailbox.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapSessionUtils.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/SelectedMailboxSessionImpl.java
Removed:
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/SelectedMailboxSession.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/ImapProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractUnsolicitedResponsesAwareProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/MockImapSession.java
Modified:
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractChainedImapProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractImapRequestProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractMailboxAwareProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapResponseMessageProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/UnknownRequestImapProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AppendProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AuthenticateProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CapabilityProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CheckProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CloseProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CopyProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CreateProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/DeleteProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExamineProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExpungeProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ListProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LogoutProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LsubProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/NoopProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/RenameProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SearchProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SelectProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/StatusProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/StoreProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SubscribeProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/UnsubscribeProcessor.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/main/DefaultImapProcessorFactory.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/AbstractCommandTest.java
    james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/session/AbstractSessionTest.java

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapProcessor.java (from r544873, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/ImapProcessor.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapProcessor.java?view=diff&rev=545282&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/ImapProcessor.java&r1=544873&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapProcessor.java&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/ImapProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapProcessor.java Thu Jun  7 12:52:29 2007
@@ -17,11 +17,10 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.experimental.imapserver.processor;
+package org.apache.james.api.imap;
 
 import org.apache.james.api.imap.ImapMessage;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
-import org.apache.james.experimental.imapserver.ImapSession;
 
 /**
  * <p>

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapSession.java (from r544933, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapSession.java?view=diff&rev=545282&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java&r1=544933&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapSession.java&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/ImapSession.java Thu Jun  7 12:52:29 2007
@@ -17,13 +17,12 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.experimental.imapserver;
+package org.apache.james.api.imap;
 
 import java.util.List;
 
 import org.apache.james.api.imap.ImapSessionState;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.services.User;
 
 
@@ -32,6 +31,9 @@
  * which commences when a client first establishes a connection to the Imap
  * server, and continues until that connection is closed.
  *
+ * TODO: {@link #logout()}, {@link #closeConnection(String)}, 
+ * {@link #closeMailbox()} and {@link #deselect()} are too closely related
+ * in function to justify separate API methods
  * @version $Revision: 109034 $
  */
 public interface ImapSession
@@ -51,6 +53,10 @@
      */
     void logout();
 
+    /**
+     * TODO: this method is not clearly 
+     * @param byeMessage
+     */
     void closeConnection(String byeMessage);
 
     /**
@@ -90,7 +96,7 @@
      * @param readOnly If <code>true</code>, the selection is set to be read only.
      * @throws MailboxManagerException 
      */
-    void selected( ImapMailboxSession mailbox, boolean readOnly ) throws MailboxManagerException;
+    void selected( SelectedImapMailbox mailbox );
 
     /**
      * Moves the session out of {@link ImapSessionState#SELECTED} state and back into
@@ -103,13 +109,12 @@
      * session is not in {@link ImapSessionState#SELECTED} state.
      * @return the currently selected mailbox.
      */
-    SelectedMailboxSession getSelected();
+    SelectedImapMailbox getSelected();
 
     /**
-     * closes the Mailbox if needed
-     * @throws MailboxManagerException 
+     * Closes the Mailbox
      */
-    void closeMailbox() throws MailboxManagerException;
+    void closeMailbox();
 
     /**
      * Gets an attribute of this session by name.

Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/SelectedImapMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/SelectedImapMailbox.java?view=auto&rev=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/SelectedImapMailbox.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/api/imap/SelectedImapMailbox.java Thu Jun  7 12:52:29 2007
@@ -0,0 +1,31 @@
+/****************************************************************
+ * 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.api.imap;
+
+import java.util.List;
+
+public interface SelectedImapMailbox {
+
+    public abstract void deselect();
+
+    public abstract List unsolicitedResponses(boolean omitExpunged,
+            boolean useUid);
+
+}
\ No newline at end of file

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java Thu Jun  7 12:52:29 2007
@@ -27,6 +27,7 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.Constants;
 import org.apache.james.api.imap.ImapConstants;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.core.AbstractJamesHandler;
 import org.apache.james.experimental.imapserver.encode.writer.OutputStreamImapResponseWriter;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java Thu Jun  7 12:52:29 2007
@@ -25,11 +25,12 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ImapSessionState;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.encode.writer.OutputStreamImapResponseWriter;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.imapserver.codec.decode.ImapDecoder;
 import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
 import org.apache.james.imapserver.codec.encode.ImapEncoder;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java Thu Jun  7 12:52:29 2007
@@ -26,9 +26,9 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.commons.collections.ListUtils;
 import org.apache.james.api.imap.ImapConstants;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ImapSessionState;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+import org.apache.james.api.imap.SelectedImapMailbox;
 import org.apache.james.services.User;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
@@ -40,7 +40,7 @@
 {
     private ImapSessionState state = ImapSessionState.NON_AUTHENTICATED;
     private User user = null;
-    private SelectedMailboxSession selectedMailbox = null;
+    private SelectedImapMailbox selectedMailbox = null;
 
     private final String clientHostName;
     private final String clientAddress;
@@ -65,7 +65,7 @@
 
     public List unsolicitedResponses(boolean omitExpunged, boolean useUid) {
         final List results;
-        final SelectedMailboxSession selected = getSelected();
+        final SelectedImapMailbox selected = getSelected();
         if (selected == null) {
             results = ListUtils.EMPTY_LIST;
         } else {
@@ -112,16 +112,15 @@
         closeMailbox();
     }
 
-    public void selected( ImapMailboxSession mailbox, boolean readOnly ) throws MailboxManagerException
+    public void selected( SelectedImapMailbox mailbox )
     {
-        SelectedMailboxSession sessionMailbox = new SelectedMailboxSession(mailbox, this);
-        setupLogger(sessionMailbox);
+        setupLogger(mailbox);
         this.state = ImapSessionState.SELECTED;
         closeMailbox();
-        this.selectedMailbox = sessionMailbox;
+        this.selectedMailbox = mailbox;
     }
 
-    public SelectedMailboxSession getSelected()
+    public SelectedImapMailbox getSelected()
     {
         return this.selectedMailbox;
     }
@@ -133,11 +132,7 @@
 
     public void closeMailbox() {
         if (selectedMailbox != null) {
-            try {
-                selectedMailbox.close();
-            } catch (MailboxManagerException e) {
-                getLogger().error("error closing Mailbox", e);
-            }
+            selectedMailbox.deselect();
             selectedMailbox=null;
         }
         

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractChainedImapProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractChainedImapProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractChainedImapProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractChainedImapProcessor.java Thu Jun  7 12:52:29 2007
@@ -3,9 +3,9 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 
 abstract public class AbstractChainedImapProcessor extends AbstractLogEnabled
         implements ImapProcessor {

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractImapRequestProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractImapRequestProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractImapRequestProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractImapRequestProcessor.java Thu Jun  7 12:52:29 2007
@@ -22,12 +22,12 @@
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandFailedResponse;
 import org.apache.james.imap.message.response.imap4rev1.legacy.ErrorResponse;
 import org.apache.james.imapserver.store.MailboxException;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractMailboxAwareProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractMailboxAwareProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractMailboxAwareProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/AbstractMailboxAwareProcessor.java Thu Jun  7 12:52:29 2007
@@ -18,21 +18,17 @@
  ****************************************************************/
 package org.apache.james.experimental.imapserver.processor.base;
 
-import java.util.List;
-
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import org.apache.james.imap.message.response.base.AbstractImapResponse;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 import org.apache.james.services.User;
 
-abstract public class AbstractMailboxAwareProcessor extends AbstractUnsolicitedResponsesAwareProcessor {
+abstract public class AbstractMailboxAwareProcessor extends AbstractImapRequestProcessor{
 
     // TODO: move into ImapConstants
-    public static final String MAILBOX_ATTRIBUTE_SESSION_KEY 
-        = "org.apache.james.api.imap.MAILBOX_ATTRIBUTE_SESSION_KEY";
+
     
     private final MailboxManagerProvider mailboxManagerProvider;
     
@@ -53,7 +49,7 @@
     public MailboxManager getMailboxManager( final ImapSession session ) throws MailboxManagerException {
         // TODO: removed badly implemented and ineffective check that mailbox user matches current user
         // TODO: add check into user login methods
-        MailboxManager result = (MailboxManager) session.getAttribute( MAILBOX_ATTRIBUTE_SESSION_KEY );
+        MailboxManager result = (MailboxManager) session.getAttribute( ImapSessionUtils.MAILBOX_MANAGER_ATTRIBUTE_SESSION_KEY );
         if (result == null) {
             // TODO: handle null user
             final User user = session.getUser();
@@ -64,9 +60,10 @@
             // TODO: so caching is required
             // TODO: caching in the session seems like the wrong design decision, though
             // TODO: the mailbox provider should perform any caching that is required
-            session.setAttribute( MAILBOX_ATTRIBUTE_SESSION_KEY, result );
+            session.setAttribute( ImapSessionUtils.MAILBOX_MANAGER_ATTRIBUTE_SESSION_KEY, result );
         }
         return result;
     }
     
+
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapResponseMessageProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapResponseMessageProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapResponseMessageProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapResponseMessageProcessor.java Thu Jun  7 12:52:29 2007
@@ -1,9 +1,9 @@
 package org.apache.james.experimental.imapserver.processor.base;
 
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 
 public class ImapResponseMessageProcessor extends AbstractChainedImapProcessor {
 

Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapSessionUtils.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapSessionUtils.java?view=auto&rev=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapSessionUtils.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/ImapSessionUtils.java Thu Jun  7 12:52:29 2007
@@ -0,0 +1,46 @@
+/****************************************************************
+ * 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.experimental.imapserver.processor.base;
+
+import java.util.List;
+
+import org.apache.james.api.imap.ImapSession;
+import org.apache.james.imap.message.response.base.AbstractImapResponse;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+public class ImapSessionUtils {
+    
+    public static final String MAILBOX_MANAGER_ATTRIBUTE_SESSION_KEY 
+        = "org.apache.james.api.imap.MAILBOX_MANAGER_ATTRIBUTE_SESSION_KEY";
+    public static final String SELECTED_MAILBOX_ATTRIBUTE_SESSION_KEY 
+        = "org.apache.james.api.imap.SELECTED_MAILBOX_ATTRIBUTE_SESSION_KEY";
+    
+    public static void addUnsolicitedResponses(AbstractImapResponse response, ImapSession session, boolean useUids) {
+        List unsolicitedResponses = session.unsolicitedResponses(useUids);
+        response.addUnsolicitedResponses(unsolicitedResponses);
+    }
+    
+    public static ImapMailboxSession getMailbox( final ImapSession session ) {
+        ImapMailboxSession result 
+            = (ImapMailboxSession) session.getAttribute(SELECTED_MAILBOX_ATTRIBUTE_SESSION_KEY);
+        return result;
+    }
+
+}

Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/SelectedMailboxSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/SelectedMailboxSessionImpl.java?view=auto&rev=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/SelectedMailboxSessionImpl.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/SelectedMailboxSessionImpl.java Thu Jun  7 12:52:29 2007
@@ -0,0 +1,219 @@
+/****************************************************************
+ * 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.experimental.imapserver.processor.base;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.mail.Flags;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.james.api.imap.ImapSession;
+import org.apache.james.api.imap.SelectedImapMailbox;
+import org.apache.james.api.imap.message.MessageFlags;
+import org.apache.james.imap.message.response.imap4rev1.ExistsResponse;
+import org.apache.james.imap.message.response.imap4rev1.ExpungeResponse;
+import org.apache.james.imap.message.response.imap4rev1.FetchResponse;
+import org.apache.james.imap.message.response.imap4rev1.RecentResponse;
+import org.apache.james.imap.message.response.imap4rev1.status.UntaggedNoResponse;
+import org.apache.james.mailboxmanager.MailboxListener;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.MessageResult;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+public class SelectedMailboxSessionImpl extends AbstractLogEnabled implements MailboxListener, SelectedImapMailbox {
+
+    private ImapSession _session;
+    private boolean _sizeChanged;
+    private List expungedMsn = new ArrayList();
+    private ImapMailboxSession mailbox;
+
+    public SelectedMailboxSessionImpl(ImapMailboxSession mailbox, ImapSession session) throws MailboxManagerException {
+        this.mailbox = mailbox;
+        _session = session;
+        // TODO make this a weak reference (or make sure deselect() is *always* called).
+        mailbox.addListener(this,MessageResult.MSN | MessageResult.UID);
+    }
+
+    /**
+     * @see org.apache.james.api.imap.SelectedImapMailbox#deselect()
+     */
+    public void deselect() {
+        mailbox.removeListener(this);
+        try {
+            mailbox.close();
+        } catch (MailboxManagerException e) {
+            final Logger logger = getLogger();
+            logger.warn("Cannot close selected mailbox" + e.getMessage());
+            logger.debug("Failed to close selected mailbox. Deselection will continue.", e);
+        }
+        mailbox = null;
+    }
+
+
+    public void mailboxDeleted() {
+        try {
+            _session.closeConnection("Mailbox " + mailbox.getName() + " has been deleted");
+        } catch (MailboxManagerException e) {
+            getLogger().error("error closing connection", e);
+        }
+    }
+
+
+    public boolean isSizeChanged() {
+        return _sizeChanged;
+    }
+
+    public void setSizeChanged(boolean sizeChanged) {
+        _sizeChanged = sizeChanged;
+    }
+
+    public void create() {
+        throw new RuntimeException("should not create a selected mailbox");
+        
+    }
+
+    public void expunged(MessageResult mr) {
+        expungedMsn.add(new Integer(mr.getSize()));
+    }
+
+    public void added(MessageResult mr) {
+       _sizeChanged = true;
+    }
+
+    public void flagsUpdated(MessageResult mr,MailboxListener silentListener) {
+    }
+
+    public ImapMailboxSession getMailbox() {
+        return mailbox;
+    }
+
+    public void mailboxRenamed(String origName, String newName) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void mailboxRenamed(String newName) {
+        // TODO Auto-generated method stub
+        
+    }
+    
+
+    /**
+     * @see org.apache.james.api.imap.SelectedImapMailbox#unsolicitedResponses(boolean, boolean)
+     */
+    public List unsolicitedResponses(boolean omitExpunged, boolean useUid) {
+        final List results = new ArrayList();
+        final ImapMailboxSession mailbox = getMailbox();
+        // New message response
+        if (isSizeChanged()) {
+            setSizeChanged(false);
+            addExistsResponses(results, mailbox);
+            addRecentResponses(results, mailbox);
+        }
+
+        // Message updates
+        // TODO: slow to check flags every time
+        // TODO: add conditional to selected mailbox
+        addFlagsResponses(results, useUid, mailbox);
+
+        // Expunged messages
+        if (!omitExpunged) {
+            // TODO: slow to check flags every time
+            // TODO: add conditional to selected mailbox
+            addExpungedResponses(results, mailbox);
+        }
+        
+        return results;
+    }
+
+    private void addExpungedResponses(List responses, final ImapMailboxSession mailbox) {
+        try {
+            MessageResult[] expunged = mailbox.getExpungedEvents(true);
+            for (int i = 0; i < expunged.length; i++) {
+                MessageResult mr = expunged[i];
+                final int msn = mr.getMsn();
+                // TODO: use factory
+                ExpungeResponse response = new ExpungeResponse(msn);
+                responses.add(response);
+            }
+        } catch (MailboxManagerException e) {
+            final String message = "Failed to retrieve expunged count data";
+            handleResponseException(responses, e, message);
+        }
+    }
+
+    private void addFlagsResponses(final List responses, boolean useUid, final ImapMailboxSession mailbox) {
+        try {
+            MessageResult[] flagUpdates = mailbox.getFlagEvents(true);
+                for (int i = 0; i < flagUpdates.length; i++) {
+                MessageResult mr = flagUpdates[i];
+                int msn = mr.getMsn();
+                Flags updatedFlags = mr.getFlags();
+                StringBuffer out = new StringBuffer("FLAGS ");
+                out.append(MessageFlags.format(updatedFlags));
+                if (useUid) {
+                    out.append(" UID ");
+                    out.append(mr.getUid());
+                }
+                // TODO: use CharSequence instead (avoid unnecessary string creation)
+                FetchResponse response = new FetchResponse(msn, out.toString());
+                responses.add(response);
+            }
+        } catch (MailboxManagerException e) {
+            final String message = "Failed to retrieve flags data";
+            handleResponseException(responses, e, message);
+        }
+    }
+
+    private void addRecentResponses(final List responses, final ImapMailboxSession mailbox) {
+        try {
+            final int recentCount = mailbox.getRecentCount(true);
+            // TODO: use factory
+            RecentResponse response = new RecentResponse(recentCount);
+            responses.add(response);
+        } catch (MailboxManagerException e) {
+            final String message = "Failed to retrieve recent count data";
+            handleResponseException(responses, e, message);
+        }
+    }
+
+    private void handleResponseException(final List responses, MailboxManagerException e, final String message) {
+        getLogger().info(message);
+        getLogger().debug(message, e);
+        // TODO: consider whether error message should be passed to the user
+        UntaggedNoResponse response = new UntaggedNoResponse(message, null);
+        responses.add(response);
+    }
+
+    private void addExistsResponses(final List responses, final ImapMailboxSession mailbox) {
+            try {
+                final int messageCount = mailbox.getMessageCount();
+                // TODO: use factory
+                ExistsResponse response = new ExistsResponse(messageCount);
+                responses.add(response);
+            } catch (MailboxManagerException e) {
+                final String message = "Failed to retrieve exists count data";
+                handleResponseException(responses, e, message);
+            }
+    }
+
+}

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/UnknownRequestImapProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/UnknownRequestImapProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/UnknownRequestImapProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/base/UnknownRequestImapProcessor.java Thu Jun  7 12:52:29 2007
@@ -3,10 +3,10 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.imap.message.response.imap4rev1.legacy.BadResponse;
 
 public class UnknownRequestImapProcessor extends AbstractLogEnabled implements ImapProcessor {

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,13 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapConstants;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.response.imap4rev1.legacy.ListResponse;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.ListResult;
@@ -139,7 +140,7 @@
 
             result.addMessageData( message.toString() );
         }
-        addUnsolicitedResponses( result, session, false );
+        ImapSessionUtils.addUnsolicitedResponses( result, session, false );
         return result;
     }
     

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java Thu Jun  7 12:52:29 2007
@@ -22,12 +22,15 @@
 import javax.mail.Flags;
 
 import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.SelectedImapMailbox;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
+import org.apache.james.experimental.imapserver.processor.base.SelectedMailboxSessionImpl;
 import org.apache.james.imap.message.response.imap4rev1.legacy.ExamineAndSelectResponse;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
@@ -51,7 +54,7 @@
         try {
             String fullMailboxName=buildFullName(session, mailboxName);
             selectMailbox(fullMailboxName, session, isExamine);
-            ImapMailboxSession mailbox = session.getSelected().getMailbox();
+            ImapMailboxSession mailbox = ImapSessionUtils.getMailbox(session);
             final Flags permanentFlags = mailbox.getPermanentFlags();
             final boolean writeable = mailbox.isWriteable();
             final boolean resetRecent = !isExamine;
@@ -81,8 +84,10 @@
         if ( !mailbox.isSelectable() ) {
             throw new MailboxException( "Nonselectable mailbox." );
         }
-
-        session.selected( mailbox, readOnly );
+        
+        SelectedImapMailbox sessionMailbox = new SelectedMailboxSessionImpl(mailbox, session);
+        session.selected( sessionMailbox);
+        session.setAttribute( ImapSessionUtils.SELECTED_MAILBOX_ATTRIBUTE_SESSION_KEY, mailbox );
         return readOnly;
     }
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AppendProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AppendProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AppendProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AppendProcessor.java Thu Jun  7 12:52:29 2007
@@ -25,13 +25,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.AppendRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -95,7 +96,7 @@
             throw new MailboxException(e);
         }
         final CommandCompleteResponse result = new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
     }
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AuthenticateProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AuthenticateProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AuthenticateProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AuthenticateProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
 import org.apache.james.imap.message.request.imap4rev1.AuthenticateRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandFailedResponse;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CapabilityProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CapabilityProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CapabilityProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CapabilityProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,19 +21,20 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import org.apache.james.experimental.imapserver.processor.base.AbstractUnsolicitedResponsesAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.CapabilityRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CapabilityResponse;
 import org.apache.james.imapserver.store.MailboxException;
 
 
-public class CapabilityProcessor extends AbstractUnsolicitedResponsesAwareProcessor {
+public class CapabilityProcessor extends AbstractImapRequestProcessor {
 	
     //TODO: capability text should be injected
     
@@ -59,7 +60,7 @@
 	private ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
         // TODO: accurately report the capabilities of the server
 		final CapabilityResponse result = new CapabilityResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);;
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);;
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CheckProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CheckProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CheckProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CheckProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,19 +21,20 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import org.apache.james.experimental.imapserver.processor.base.AbstractUnsolicitedResponsesAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.CheckRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
 
 
-public class CheckProcessor extends AbstractUnsolicitedResponsesAwareProcessor {
+public class CheckProcessor extends AbstractImapRequestProcessor {
 	
 	public CheckProcessor(final ImapProcessor next) {
         super(next);
@@ -56,7 +57,7 @@
 	
 	private ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
         final CommandCompleteResponse result = new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CloseProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CloseProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CloseProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CloseProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,13 +21,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import org.apache.james.experimental.imapserver.processor.base.AbstractUnsolicitedResponsesAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.CloseRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CloseResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -37,7 +38,7 @@
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
 
 
-public class CloseProcessor extends AbstractUnsolicitedResponsesAwareProcessor {
+public class CloseProcessor extends AbstractImapRequestProcessor {
 	
 	public CloseProcessor(final ImapProcessor next) {
         super(next);
@@ -59,8 +60,8 @@
 	}
 	
 	private ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
-        ImapMailboxSession mailbox = session.getSelected().getMailbox();
-        if ( session.getSelected().getMailbox().isWriteable() ) {
+        ImapMailboxSession mailbox = ImapSessionUtils.getMailbox(session);
+        if ( mailbox.isWriteable() ) {
             try {
                 mailbox.expunge(GeneralMessageSetImpl.all(),MessageResult.NOTHING);
             } catch (MailboxManagerException e) {
@@ -73,7 +74,7 @@
         //TODO: doesn't seem to match the implementation
         //TODO: check that implementation is correct
         //          Don't send unsolicited responses on close.
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CopyProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CopyProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CopyProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,14 +21,15 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.IdRange;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.CopyRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -67,7 +68,7 @@
 	
 	private ImapResponseMessage doProcess(String mailboxName, IdRange[] idSet, boolean useUids,
 			ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
-        ImapMailboxSession currentMailbox = session.getSelected().getMailbox();
+        ImapMailboxSession currentMailbox = ImapSessionUtils.getMailbox(session);
         try {
             String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager(session);
@@ -85,7 +86,7 @@
         } 
         final CommandCompleteResponse result = 
             new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, useUids);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, useUids);
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CreateProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CreateProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CreateProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/CreateProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,13 +21,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.CreateRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -71,7 +72,7 @@
            throw new MailboxException(e);
         }
         final CommandCompleteResponse result = new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/DeleteProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/DeleteProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/DeleteProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/DeleteProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,13 +21,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.DeleteRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -64,7 +65,7 @@
         try {
             final String fullMailboxName = buildFullName(session, mailboxName);
             if (session.getSelected() != null) {
-                if (session.getSelected().getMailbox().getName().equals(
+                if (ImapSessionUtils.getMailbox(session).getName().equals(
                         fullMailboxName)) {
                     session.deselect();
                 }
@@ -77,7 +78,7 @@
 
         final CommandCompleteResponse result = 
             new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExamineProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExamineProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExamineProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExamineProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.imap.message.request.imap4rev1.ExamineRequest;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExpungeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExpungeProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExpungeProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ExpungeProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,13 +21,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import org.apache.james.experimental.imapserver.processor.base.AbstractUnsolicitedResponsesAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.ExpungeRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandFailedResponse;
@@ -39,7 +40,7 @@
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 
 
-public class ExpungeProcessor extends AbstractUnsolicitedResponsesAwareProcessor {
+public class ExpungeProcessor extends AbstractImapRequestProcessor {
 	
 	public ExpungeProcessor(final ImapProcessor next, 
             final MailboxManagerProvider mailboxManagerProvider) {
@@ -63,14 +64,14 @@
 	
 	private ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
         ImapResponseMessage result;
-        ImapMailboxSession mailbox = session.getSelected().getMailbox();
+        ImapMailboxSession mailbox = ImapSessionUtils.getMailbox(session);
         if (!mailbox.isWriteable()) {
             result = new CommandFailedResponse(command, "Mailbox selected read only.", tag );
         } else {
             try {
                 mailbox.expunge(GeneralMessageSetImpl.all(),MessageResult.NOTHING);
                 CommandCompleteResponse commandCompleteResponse = new CommandCompleteResponse(command, tag);
-                addUnsolicitedResponses(commandCompleteResponse, session, false);
+                ImapSessionUtils.addUnsolicitedResponses(commandCompleteResponse, session, false);
                 result = commandCompleteResponse;
             } catch (MailboxManagerException e) {
                 throw new MailboxException(e);

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java Thu Jun  7 12:52:29 2007
@@ -34,6 +34,8 @@
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.BodyFetchElement;
 import org.apache.james.api.imap.message.FetchData;
@@ -43,9 +45,8 @@
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.core.MimeMessageWrapper;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.FetchRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.FetchResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -94,7 +95,7 @@
         int resultToFetch = MessageResult.FLAGS | MessageResult.MIME_MESSAGE
                 | MessageResult.INTERNAL_DATE | MessageResult.MSN
                 | MessageResult.SIZE;
-        ImapMailboxSession mailbox = session.getSelected().getMailbox();
+        ImapMailboxSession mailbox = ImapSessionUtils.getMailbox(session);
         for (int i = 0; i < idSet.length; i++) {
             GeneralMessageSet messageSet=GeneralMessageSetImpl.range(idSet[i].getLowVal(),idSet[i].getHighVal(),useUids);
             MessageResult[] fetchResults;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java Thu Jun  7 12:52:29 2007
@@ -1,6 +1,6 @@
 package org.apache.james.experimental.imapserver.processor.imap4rev1;
 
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
+import org.apache.james.api.imap.ImapProcessor;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 import org.apache.james.services.UsersRepository;
 

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ListProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ListProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/ListProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.imap.message.request.imap4rev1.ListRequest;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.ListResult;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
 import org.apache.james.imap.message.request.imap4rev1.LoginRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LogoutProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LogoutProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LogoutProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LogoutProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
 import org.apache.james.imap.message.request.imap4rev1.LogoutRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.LogoutResponse;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LsubProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LsubProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LsubProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LsubProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,12 +21,12 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.imap.message.request.imap4rev1.LsubRequest;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.ListResult;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/NoopProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/NoopProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/NoopProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/NoopProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,19 +21,20 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import org.apache.james.experimental.imapserver.processor.base.AbstractUnsolicitedResponsesAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.NoopRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
 
 
-public class NoopProcessor extends AbstractUnsolicitedResponsesAwareProcessor {
+public class NoopProcessor extends AbstractImapRequestProcessor {
 	
 	public NoopProcessor(final ImapProcessor next) {
         super(next);
@@ -59,7 +60,7 @@
         // TODO: untagged responses?
         // TODO: NOOP is used to check for new mail: need to return untagged responses
         final CommandCompleteResponse result = new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
 	}
 }

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/RenameProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/RenameProcessor.java?view=diff&rev=545282&r1=545281&r2=545282
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/RenameProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/RenameProcessor.java Thu Jun  7 12:52:29 2007
@@ -21,13 +21,14 @@
 
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ImapProcessor;
+import org.apache.james.api.imap.ImapSession;
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.api.imap.message.request.ImapRequest;
 import org.apache.james.api.imap.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapSession;
-import org.apache.james.experimental.imapserver.processor.ImapProcessor;
 import org.apache.james.experimental.imapserver.processor.base.AbstractMailboxAwareProcessor;
+import org.apache.james.experimental.imapserver.processor.base.ImapSessionUtils;
 import org.apache.james.imap.message.request.imap4rev1.RenameRequest;
 import org.apache.james.imap.message.response.imap4rev1.legacy.CommandCompleteResponse;
 import org.apache.james.imapserver.store.MailboxException;
@@ -72,7 +73,7 @@
         }
 
         final CommandCompleteResponse result = new CommandCompleteResponse(command, tag);
-        addUnsolicitedResponses(result, session, false);
+        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
         return result;
 	}
 }



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