james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r756619 - in /james/protocols/imap/trunk: message/src/main/java/org/apache/james/imap/encode/ message/src/main/java/org/apache/james/imap/encode/base/ message/src/test/java/org/apache/james/imap/encode/ seda/src/main/java/org/apache/james/i...
Date Fri, 20 Mar 2009 16:59:38 GMT
Author: rdonkin
Date: Fri Mar 20 16:59:36 2009
New Revision: 756619

URL: http://svn.apache.org/viewvc?rev=756619&view=rev
Log:
Use session log, which means allowing access to session from encoders. IMAP-75 https://issues.apache.org/jira/browse/IMAP-75

Added:
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FakeImapSession.java   (with props)
Modified:
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/CapabilityResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExpungeResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FlagsResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/LSubResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ListResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/RecentResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/STATUSResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/EndImapEncoder.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/LSubResponseEncoderTest.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ListResponseEncoderTest.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/STATUSResponseEncoderTest.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/StatusResponseEncoderTest.java
    james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/CapabilityResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/CapabilityResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/CapabilityResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/CapabilityResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -21,6 +21,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.CapabilityResponse;
 
@@ -36,7 +37,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         final CapabilityResponse response = (CapabilityResponse) acceptableMessage;
         composer.capabilities(response.getCapabilities());
     }

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.ExistsResponse;
 
@@ -36,7 +37,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         final ExistsResponse existsResponse = (ExistsResponse) acceptableMessage;
         final int numberOfMessages = existsResponse.getNumberOfMessages();
         composer.existsResponse(numberOfMessages);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExpungeResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExpungeResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExpungeResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExpungeResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.ExpungeResponse;
 
@@ -36,7 +37,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         final ExpungeResponse expungeResponse = (ExpungeResponse) acceptableMessage;
         final int messageSequenceNumber = expungeResponse
                 .getMessageSequenceNumber();

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -33,6 +33,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.FetchResponse;
 import org.apache.james.imap.message.response.FetchResponse.Structure;
@@ -48,7 +49,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         if (acceptableMessage instanceof FetchResponse) {
             final FetchResponse fetchResponse = (FetchResponse) acceptableMessage;
             final long messageNumber = fetchResponse.getMessageNumber();
@@ -57,33 +58,33 @@
             encodeInternalDate(composer, fetchResponse);
             encodeSize(composer, fetchResponse);
             encodeEnvelope(composer, fetchResponse);
-            encodeBody(composer, fetchResponse.getBody());
-            encodeBodyStructure(composer, fetchResponse.getBodyStructure());
+            encodeBody(composer, fetchResponse.getBody(), session);
+            encodeBodyStructure(composer, fetchResponse.getBodyStructure(), session);
             encodeUid(composer, fetchResponse);
             encodeBodyElements(composer, fetchResponse.getElements());
             composer.closeFetchResponse();
         }
     }
 
-    private void encodeBody(ImapResponseComposer composer, Structure body)
+    private void encodeBody(ImapResponseComposer composer, Structure body, ImapSession session)
             throws IOException {
         if (body != null) {
             composer.message(ImapConstants.FETCH_BODY);
-            encodeStructure(composer, body, false, false);
+            encodeStructure(composer, body, false, false, session);
         }
     }
 
     private void encodeBodyStructure(ImapResponseComposer composer,
-            Structure bodyStructure) throws IOException {
+            Structure bodyStructure, ImapSession session) throws IOException {
         if (bodyStructure != null) {
             composer.message(ImapConstants.FETCH_BODY_STRUCTURE);
-            encodeStructure(composer, bodyStructure, true, false);
+            encodeStructure(composer, bodyStructure, true, false, session);
         }
     }
 
     private void encodeStructure(final ImapResponseComposer composer,
             final Structure structure, final boolean includeExtensions,
-            final boolean isInnerPart) throws IOException {
+            final boolean isInnerPart, ImapSession session) throws IOException {
 
         final String mediaType;
         final String subType;
@@ -96,19 +97,19 @@
             subType = structure.getSubType();
         }
         encodeStructure(composer, structure, includeExtensions, mediaType,
-                subType, isInnerPart);
+                subType, isInnerPart, session);
     }
 
     private void encodeStructure(final ImapResponseComposer composer,
             final Structure structure, final boolean includeExtensions,
-            final String mediaType, final String subType, boolean isInnerPart)
+            final String mediaType, final String subType, boolean isInnerPart, ImapSession session)
             throws IOException {
         if (isInnerPart) {
             composer.skipNextSpace();
         }
         if (ImapConstants.MIME_TYPE_MULTIPART.equalsIgnoreCase(mediaType)) {
 
-            encodeMultipart(composer, structure, subType, includeExtensions);
+            encodeMultipart(composer, structure, subType, includeExtensions, session);
 
         } else {
             if (ImapConstants.MIME_TYPE_MESSAGE.equalsIgnoreCase(mediaType)
@@ -116,17 +117,17 @@
                             .equalsIgnoreCase(subType)) {
 
                 encodeRfc822Message(composer, structure, mediaType, subType,
-                        includeExtensions);
+                        includeExtensions, session);
             } else {
                 encodeBasic(composer, structure, includeExtensions, mediaType,
-                        subType);
+                        subType, session);
             }
         }
     }
 
     private void encodeBasic(final ImapResponseComposer composer,
             final Structure structure, final boolean includeExtensions,
-            final String mediaType, final String subType) throws IOException {
+            final String mediaType, final String subType, ImapSession session) throws IOException {
         if (ImapConstants.MIME_TYPE_TEXT.equalsIgnoreCase(mediaType)) {
 
             final long lines = structure.getLines();
@@ -137,24 +138,24 @@
             encodeBodyFields(composer, structure, mediaType, subType);
         }
         if (includeExtensions) {
-            encodeOnePartBodyExtensions(composer, structure);
+            encodeOnePartBodyExtensions(composer, structure, session);
         }
         composer.closeParen();
     }
 
     private void encodeOnePartBodyExtensions(
-            final ImapResponseComposer composer, final Structure structure)
+            final ImapResponseComposer composer, final Structure structure, ImapSession session)
             throws IOException {
         final String md5 = structure.getMD5();
         final List<String> languages = structure.getLanguages();
         final String location = structure.getLocation();
         composer.nillableQuote(md5);
-        bodyFldDsp(structure, composer).nillableQuotes(languages)
+        bodyFldDsp(structure, composer, session).nillableQuotes(languages)
                 .nillableQuote(location);
     }
 
     private ImapResponseComposer bodyFldDsp(final Structure structure,
-            final ImapResponseComposer composer) throws IOException {
+            final ImapResponseComposer composer, ImapSession session) throws IOException {
         final String disposition = structure.getDisposition();
         if (disposition == null) {
             composer.nil();
@@ -162,14 +163,14 @@
             composer.openParen();
             composer.quote(disposition);
             final Map<String, String> params = structure.getDispositionParams();
-            bodyFldParam(params, composer);
+            bodyFldParam(params, composer, session);
             composer.closeParen();
         }
         return composer;
     }
 
     private void bodyFldParam(final Map<String,String> params,
-            final ImapResponseComposer composer) throws IOException {
+            final ImapResponseComposer composer, ImapSession session) throws IOException {
         if (params == null || params.isEmpty()) {
             composer.nil();
         } else {
@@ -180,7 +181,7 @@
                 final String name = iter.next();
                 final String value = params.get(name);
                 if (value == null) {
-                    final Log logger = getLog();
+                    final Log logger = session.getLog();
                     logger.warn("Disposition parameter name has no value.");
                     if (logger.isDebugEnabled()) {
                         logger.debug("Disposition parameter " + name
@@ -211,19 +212,19 @@
 
     private void encodeMultipart(ImapResponseComposer composer,
             Structure structure, final String subType,
-            final boolean includeExtensions) throws IOException {
+            final boolean includeExtensions, ImapSession session) throws IOException {
         composer.openParen();
 
         for (Iterator<Structure> it = structure.parts(); it.hasNext();) {
             final Structure part = it.next();
-            encodeStructure(composer, part, includeExtensions, true);
+            encodeStructure(composer, part, includeExtensions, true, session);
         }
 
         composer.quoteUpperCaseAscii(subType);
         if (includeExtensions) {
             final List<String> languages = structure.getLanguages();
             composer.nillableQuotes(structure.getParameters());
-            bodyFldDsp(structure, composer).nillableQuotes(languages)
+            bodyFldDsp(structure, composer, session).nillableQuotes(languages)
                     .nillableQuote(structure.getLocation());
         }
         composer.closeParen();
@@ -231,18 +232,18 @@
 
     private void encodeRfc822Message(ImapResponseComposer composer,
             Structure structure, final String mediaType, final String subType,
-            final boolean includeExtensions) throws IOException {
+            final boolean includeExtensions, ImapSession session) throws IOException {
         final long lines = structure.getLines();
         final FetchResponse.Envelope envelope = structure.getEnvelope();
         final FetchResponse.Structure embeddedStructure = structure.getBody();
 
         encodeBodyFields(composer, structure, mediaType, subType);
         encodeEnvelope(composer, envelope, false);
-        encodeStructure(composer, embeddedStructure, includeExtensions, false);
+        encodeStructure(composer, embeddedStructure, includeExtensions, false, session);
         composer.message(lines);
 
         if (includeExtensions) {
-            encodeOnePartBodyExtensions(composer, structure);
+            encodeOnePartBodyExtensions(composer, structure, session);
         }
         composer.closeParen();
     }

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FlagsResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FlagsResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FlagsResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/FlagsResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -24,6 +24,7 @@
 import javax.mail.Flags;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.FlagsResponse;
 
@@ -38,7 +39,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         final FlagsResponse flagsResponse = (FlagsResponse) acceptableMessage;
         final Flags flags = flagsResponse.getFlags();
         composer.flagsResponse(flags);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 
 /**
  * TODO: correct this API
@@ -35,9 +36,9 @@
      *            <code>ImapMessage</code>, not null
      * @param composer
      *            <code>ImapResponseComposer</code>, not null
-     * @throws IOException
-     *             TODO
+     * @param session TODO
+     * @throws IOException when message encoding fails
      */
-    void encode(ImapMessage message, ImapResponseComposer composer)
+    void encode(ImapMessage message, ImapResponseComposer composer, ImapSession session)
             throws IOException;
 }

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/LSubResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/LSubResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/LSubResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/LSubResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.AbstractListingResponse;
 import org.apache.james.imap.message.response.LSubResponse;
@@ -36,7 +37,7 @@
     }
 
     protected void doEncode(final ImapMessage acceptableMessage,
-            final ImapResponseComposer composer) throws IOException {
+            final ImapResponseComposer composer, ImapSession session) throws IOException {
         final AbstractListingResponse response = (AbstractListingResponse) acceptableMessage;
         ListingEncodingUtils.encodeListingResponse(
                 ImapConstants.LSUB_RESPONSE_NAME, composer, response);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ListResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ListResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ListResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ListResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.AbstractListingResponse;
 import org.apache.james.imap.message.response.ListResponse;
@@ -36,7 +37,7 @@
     }
 
     protected void doEncode(final ImapMessage acceptableMessage,
-            final ImapResponseComposer composer) throws IOException {
+            final ImapResponseComposer composer, ImapSession session) throws IOException {
         final AbstractListingResponse response = (AbstractListingResponse) acceptableMessage;
         ListingEncodingUtils.encodeListingResponse(
                 ImapConstants.LIST_RESPONSE_NAME, composer, response);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/RecentResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/RecentResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/RecentResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/RecentResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.RecentResponse;
 
@@ -36,7 +37,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException { // TODO
+            ImapResponseComposer composer, ImapSession session) throws IOException { // TODO
         // Auto-generated
         // method stub
         final RecentResponse recentResponse = (RecentResponse) acceptableMessage;

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/STATUSResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/STATUSResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/STATUSResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/STATUSResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.STATUSResponse;
 
@@ -35,7 +36,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         STATUSResponse response = (STATUSResponse) acceptableMessage;
         composer.statusResponse(response.getMessages(), response.getRecent(),
                 response.getUidNext(), response.getUidValidity(), response

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/SearchResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -21,6 +21,7 @@
 import java.io.IOException;
 
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 import org.apache.james.imap.message.response.SearchResponse;
 
@@ -34,7 +35,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         SearchResponse response = (SearchResponse) acceptableMessage;
         final long[] ids = response.getIds();
         composer.searchResponse(ids);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java Fri Mar 20 16:59:36 2009
@@ -28,6 +28,7 @@
 import org.apache.james.imap.api.message.response.StatusResponse;
 import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode;
 import org.apache.james.imap.api.message.response.StatusResponse.Type;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
 
 public class StatusResponseEncoder extends AbstractChainedImapEncoder {
@@ -37,7 +38,7 @@
     }
 
     protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException {
+            ImapResponseComposer composer, ImapSession session) throws IOException {
         StatusResponse response = (StatusResponse) acceptableMessage;
         final Type serverResponseType = response.getServerResponseType();
         final String type = asString(serverResponseType);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java Fri Mar 20 16:59:36 2009
@@ -21,14 +21,12 @@
 
 import java.io.IOException;
 
-import org.apache.commons.logging.Log;
-import org.apache.james.imap.api.AbstractLogEnabled;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.ImapEncoder;
 import org.apache.james.imap.encode.ImapResponseComposer;
 
-abstract public class AbstractChainedImapEncoder extends AbstractLogEnabled
-        implements ImapEncoder {
+abstract public class AbstractChainedImapEncoder implements ImapEncoder {
 
     private final ImapEncoder next;
 
@@ -37,24 +35,19 @@
         this.next = next;
     }
 
-    public void setLog(Log logger) {
-        super.setLog(logger);
-        setupLogger(next);
-    }
-
-    public void encode(ImapMessage message, ImapResponseComposer composer)
+    public void encode(ImapMessage message, ImapResponseComposer composer, ImapSession session)
             throws IOException {
         final boolean isAcceptable = isAcceptable(message);
         if (isAcceptable) {
-            doEncode(message, composer);
+            doEncode(message, composer, session);
         } else {
-            chainEncode(message, composer);
+            chainEncode(message, composer, session);
         }
     }
 
     protected void chainEncode(ImapMessage message,
-            ImapResponseComposer composer) throws IOException {
-        next.encode(message, composer);
+            ImapResponseComposer composer, ImapSession session) throws IOException {
+        next.encode(message, composer, session);
     }
 
     /**
@@ -74,7 +67,8 @@
      *            <code>ImapMessage</code>, not null
      * @param composer
      *            <code>ImapResponseComposer</code>, not null
+     * @param session TODO
      */
     abstract protected void doEncode(ImapMessage acceptableMessage,
-            ImapResponseComposer composer) throws IOException;
+            ImapResponseComposer composer, ImapSession session) throws IOException;
 }

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/EndImapEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/EndImapEncoder.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/EndImapEncoder.java (original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/EndImapEncoder.java Fri Mar 20 16:59:36 2009
@@ -24,14 +24,15 @@
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.AbstractLogEnabled;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.ImapEncoder;
 import org.apache.james.imap.encode.ImapResponseComposer;
 
-public class EndImapEncoder extends AbstractLogEnabled implements ImapEncoder {
+public class EndImapEncoder implements ImapEncoder {
 
-    public void encode(ImapMessage message, ImapResponseComposer composer)
+    public void encode(ImapMessage message, ImapResponseComposer composer, ImapSession session)
             throws IOException {
-        final Log logger = getLog();
+        final Log logger = session.getLog();
         logger.warn("Unknown message");
         if (logger.isDebugEnabled()) {
             logger.debug("Chain end reached for " + message);

Added: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FakeImapSession.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FakeImapSession.java?rev=756619&view=auto
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FakeImapSession.java (added)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FakeImapSession.java Fri Mar 20 16:59:36 2009
@@ -0,0 +1,96 @@
+/****************************************************************
+ * 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.imap.encode;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.james.imap.api.ImapSessionState;
+import org.apache.james.imap.api.process.ImapSession;
+import org.apache.james.imap.api.process.SelectedMailbox;
+
+public class FakeImapSession implements ImapSession {
+    
+    private static final Log LOG = LogFactory.getLog(FakeImapSession.class);
+    
+    private ImapSessionState state = ImapSessionState.NON_AUTHENTICATED;
+
+    private SelectedMailbox selectedMailbox = null;
+
+    private final Map<String, Object> attributesByKey;
+
+    public FakeImapSession() {
+        this.attributesByKey = new ConcurrentHashMap<String, Object>();
+    }
+
+    public void logout() {
+        closeMailbox();
+        state = ImapSessionState.LOGOUT;
+    }
+
+    public void authenticated() {
+        this.state = ImapSessionState.AUTHENTICATED;
+    }
+
+    public void deselect() {
+        this.state = ImapSessionState.AUTHENTICATED;
+        closeMailbox();
+    }
+
+    public void selected(SelectedMailbox mailbox) {
+        this.state = ImapSessionState.SELECTED;
+        closeMailbox();
+        this.selectedMailbox = mailbox;
+    }
+
+    public SelectedMailbox getSelected() {
+        return this.selectedMailbox;
+    }
+
+    public ImapSessionState getState() {
+        return this.state;
+    }
+
+    public void closeMailbox() {
+        if (selectedMailbox != null) {
+            selectedMailbox.deselect();
+            selectedMailbox = null;
+        }
+    }
+
+    public Object getAttribute(String key) {
+        final Object result = attributesByKey.get(key);
+        return result;
+    }
+
+    public void setAttribute(String key, Object value) {
+        if (value == null) {
+            attributesByKey.remove(key);
+        } else {
+            attributesByKey.put(key, value);
+        }
+    }
+
+    public Log getLog() {
+        return LOG;
+    }
+
+}

Propchange: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FakeImapSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java Fri Mar 20 16:59:36 2009
@@ -164,7 +164,7 @@
             oneOf(composer).endEnvelope(null, null); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeDate() throws Exception {
@@ -178,7 +178,7 @@
             oneOf(composer).endEnvelope(null, null); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeSubject() throws Exception {
@@ -192,7 +192,7 @@
             oneOf(composer).endEnvelope(null, null); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeInReplyTo() throws Exception {
@@ -206,7 +206,7 @@
             oneOf(composer).endEnvelope(with(equal(inReplyTo)), with(aNull(String.class))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeMessageId() throws Exception {
@@ -220,7 +220,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeOneFromAddress() throws Exception {
@@ -241,7 +241,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeManyFromAddress() throws Exception {
@@ -267,7 +267,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeOneSenderAddress() throws Exception {
@@ -289,7 +289,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeManySenderAddress() throws Exception {
@@ -316,7 +316,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
     
 
@@ -339,7 +339,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeManyReplyToAddress() throws Exception {
@@ -366,7 +366,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeOneToAddress() throws Exception {
@@ -388,7 +388,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeManyToAddress() throws Exception {
@@ -415,7 +415,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeOneCcAddress() throws Exception {
@@ -437,7 +437,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeManyCcAddress() throws Exception {
@@ -464,7 +464,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeOneBccAddress() throws Exception {
@@ -485,7 +485,7 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldComposeManyBccAddress() throws Exception {
@@ -511,6 +511,6 @@
             oneOf(composer).endEnvelope(with(aNull(String.class)), with(equal(messageId))); inSequence(composition);
             oneOf(composer).closeFetchResponse();inSequence(composition);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 }

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java Fri Mar 20 16:59:36 2009
@@ -75,7 +75,7 @@
             oneOf(composer).flags(with(equal(flags))); inSequence(sequence);
             oneOf(composer).closeFetchResponse(); inSequence(sequence);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldEncodeUidResponse() throws Exception {
@@ -88,7 +88,7 @@
             oneOf(composer).message(with(equal(72L))); inSequence(sequence);
             oneOf(composer).closeFetchResponse(); inSequence(sequence);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 
     public void testShouldEncodeAllResponse() throws Exception {
@@ -102,6 +102,6 @@
             oneOf(composer).message(with(equal(72L))); inSequence(sequence);
             oneOf(composer).closeFetchResponse(); inSequence(sequence);
         }});
-        encoder.doEncode(message, composer);
+        encoder.doEncode(message, composer, new FakeImapSession());
     }
 }

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/LSubResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/LSubResponseEncoderTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/LSubResponseEncoderTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/LSubResponseEncoderTest.java Fri Mar 20 16:59:36 2009
@@ -63,21 +63,21 @@
         checking(new Expectations() {{
             oneOf(composer).listResponse(with(same("LSUB")),with(aNull(List.class)), with(same(".")), with(same("INBOX.name")));
         }});
-        encoder.encode(new LSubResponse("INBOX.name", ".", false), composer);
+        encoder.encode(new LSubResponse("INBOX.name", ".", false), composer, new FakeImapSession());
     }
 
     public void testDelimiter() throws Exception {
         checking(new Expectations() {{
             oneOf(composer).listResponse(with(same("LSUB")),with(aNull(List.class)), with(same("@")), with(same("INBOX.name")));
         }});
-        encoder.encode(new LSubResponse("INBOX.name", "@", false), composer);
+        encoder.encode(new LSubResponse("INBOX.name", "@", false), composer, new FakeImapSession());
     }
 
     public void testNoDelimiter() throws Exception {
         checking(new Expectations() {{
             oneOf(composer).listResponse(with(same("LSUB")),with(aNull(List.class)), with(aNull(String.class)), with(same("INBOX.name")));
         }});
-        encoder.encode(new LSubResponse("INBOX.name", null, false), composer);
+        encoder.encode(new LSubResponse("INBOX.name", null, false), composer, new FakeImapSession());
     }
 
     public void testNoSelect() throws Exception {
@@ -85,6 +85,6 @@
         checking(new Expectations() {{
             oneOf(composer).listResponse(with(same("LSUB")),with(equal(Arrays.asList(values))), with(equal(".")), with(same("INBOX.name")));
         }});
-        encoder.encode(new LSubResponse("INBOX.name", ".", true), composer);
+        encoder.encode(new LSubResponse("INBOX.name", ".", true), composer, new FakeImapSession());
     }
 }

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ListResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ListResponseEncoderTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ListResponseEncoderTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ListResponseEncoderTest.java Fri Mar 20 16:59:36 2009
@@ -61,6 +61,6 @@
         checking(new Expectations() {{
             oneOf(composer).searchResponse(with(same(IDS)));
         }});
-        encoder.encode(response, composer);
+        encoder.encode(response, composer, new FakeImapSession());
     }
 }

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/STATUSResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/STATUSResponseEncoderTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/STATUSResponseEncoderTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/STATUSResponseEncoderTest.java Fri Mar 20 16:59:36 2009
@@ -72,6 +72,6 @@
         }});
 
         encoder.encode(new STATUSResponse(messages, recent, uidNext,
-                uidValidity, unseen, mailbox), composer);
+                uidValidity, unseen, mailbox), composer, new FakeImapSession());
     }
 }

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/SearchResponseEncoderTest.java Fri Mar 20 16:59:36 2009
@@ -67,7 +67,7 @@
                             with(same(".")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(false, false, false, false, ".", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(false, false, false, false, ".", "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testDelimiter() throws Exception {
@@ -78,7 +78,7 @@
                             with(same("@")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(false, false, false, false, "@", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(false, false, false, false, "@", "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testNoDelimiter() throws Exception {
@@ -89,7 +89,7 @@
                             with(aNull(String.class)), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(false, false, false, false, null, "INBOX.name"), composer);
+        encoder.encode(new ListResponse(false, false, false, false, null, "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testAllAttributes() throws Exception {
@@ -104,7 +104,7 @@
                             with(same(".")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(true, true, true, true, ".", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(true, true, true, true, ".", "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testNoInferiors() throws Exception {
@@ -116,7 +116,7 @@
                             with(same(".")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(true, false, false, false, ".", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(true, false, false, false, ".", "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testNoSelect() throws Exception {
@@ -128,7 +128,7 @@
                             with(same(".")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(false, true, false, false, ".", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(false, true, false, false, ".", "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testMarked() throws Exception {
@@ -140,7 +140,7 @@
                             with(same(".")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(false, false, true, false, ".", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(false, false, true, false, ".", "INBOX.name"), composer, new FakeImapSession());
     }
 
     public void testUnmarked() throws Exception {
@@ -152,6 +152,6 @@
                             with(same(".")), 
                             with(same("INBOX.name")));
         }});
-        encoder.encode(new ListResponse(false, false, false, true, ".", "INBOX.name"), composer);
+        encoder.encode(new ListResponse(false, false, false, true, ".", "INBOX.name"), composer, new FakeImapSession());
     }
 }

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/StatusResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/StatusResponseEncoderTest.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/StatusResponseEncoderTest.java (original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/StatusResponseEncoderTest.java Fri Mar 20 16:59:36 2009
@@ -289,7 +289,7 @@
     }
 
     private void compose() throws Exception {
-        encoder.doEncode(mockStatusResponse, response);
+        encoder.doEncode(mockStatusResponse, response, new FakeImapSession());
     }
 
     private void configure(final StatusResponse.Type type,

Modified: james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java?rev=756619&r1=756618&r2=756619&view=diff
==============================================================================
--- james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java (original)
+++ james/protocols/imap/trunk/seda/src/main/java/org/apache/james/imap/main/ImapRequestHandler.java Fri Mar 20 16:59:36 2009
@@ -70,8 +70,6 @@
      */
     public void setLog(Log logger) {
         super.setLog(logger);
-        setupLogger(decoder);
-        setupLogger(processor);
     }
 
     /**
@@ -177,7 +175,7 @@
             ImapResponseComposer response, ImapSession session) {
         ImapMessage message = decoder.decode(request, session);
         final ResponseEncoder responseEncoder = new ResponseEncoder(encoder,
-                response);
+                response, session);
         processor.process(message, responseEncoder, session);
         final boolean result;
         final IOException failure = responseEncoder.getFailure();
@@ -196,21 +194,23 @@
 
     private static final class ResponseEncoder implements Responder {
         private final ImapEncoder encoder;
-
+        private final ImapSession session;
         private final ImapResponseComposer composer;
 
         private IOException failure;
+        
 
         public ResponseEncoder(final ImapEncoder encoder,
-                final ImapResponseComposer composer) {
+                final ImapResponseComposer composer, final ImapSession session) {
             super();
             this.encoder = encoder;
             this.composer = composer;
+            this.session = session;
         }
 
         public void respond(final ImapResponseMessage message) {
             try {
-                encoder.encode(message, composer);
+                encoder.encode(message, composer, session);
             } catch (IOException failure) {
                 this.failure = failure;
             }



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