You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by pp...@apache.org on 2012/04/17 23:04:03 UTC

svn commit: r1327280 [1/3] - in /james: app/trunk/ mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/ protocols/trunk/ protocols/trunk/imap/ protocols/trunk/imap/src/main/java/org/apache/james/imap/api/ protocols/trunk/imap/src/main/java/o...

Author: ppalaga
Date: Tue Apr 17 21:04:01 2012
New Revision: 1327280

URL: http://svn.apache.org/viewvc?rev=1327280&view=rev
Log:
PROTOCOLS-73 Move imap code into protocols

Added:
    james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java
      - copied, changed from r1326941, james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/FetchGroupImpl.java
    james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/PartContentDescriptorImpl.java
      - copied, changed from r1326941, james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/PartContentDescriptorImpl.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/DeleteACLRequest.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/ListRightsRequest.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/MyRightsRequest.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/SetACLRequest.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/DeleteACLProcessorTest.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/ListRightsProcessorTest.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/SetACLProcessorTest.java
Removed:
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/FetchGroupImpl.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/PartContentDescriptorImpl.java
Modified:
    james/app/trunk/pom.xml
    james/protocols/trunk/imap/pom.xml
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/process/ImapSession.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/EncoderUtils.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultLocalizer.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/AbstractListingResponse.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/EmptyContent.java
    james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/decode/main/OutputStreamImapResponseWriter.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/encode/base/ByteImapResponseWriter.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/GetACLProcessorTest.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/StatusResponseTypeMatcher.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
    james/protocols/trunk/imap/src/test/java/org/apache/james/protocols/imap/utils/DecoderUtilsTest.java
    james/protocols/trunk/pom.xml
    james/server/trunk/mailets/pom.xml
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/matchers/AbstractStorageQuota.java
    james/server/trunk/pom.xml
    james/server/trunk/protocols-imap4/pom.xml
    james/server/trunk/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
    james/server/trunk/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapRequestLineReader.java
    james/server/trunk/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyStreamImapRequestLineReader.java

Modified: james/app/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/app/trunk/pom.xml?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/app/trunk/pom.xml (original)
+++ james/app/trunk/pom.xml Tue Apr 17 21:04:01 2012
@@ -24,7 +24,7 @@
     <parent>
       <groupId>org.apache.james</groupId>
         <artifactId>james-server</artifactId>
-        <version>3.0-beta4</version>
+        <version>3.0-beta5-SNAPSHOT</version>
         <relativePath />
     </parent>
 
@@ -270,7 +270,6 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-protocols-imap4</artifactId>
         <scope>runtime</scope>
-        <version>${james.server.version}</version>
     </dependency>
     <dependency>
         <groupId>org.apache.james</groupId>
@@ -415,11 +414,20 @@
         <scope>runtime</scope>
         <version>${james.server.version}</version>
     </dependency>
+
+<!-- 
     <dependency>
         <groupId>org.apache.james</groupId>
         <artifactId>apache-james-imap-processor</artifactId>
         <scope>runtime</scope>
     </dependency>
+ -->
+    <dependency>
+        <groupId>org.apache.james.protocols</groupId>
+        <artifactId>protocols-imap</artifactId>
+        <scope>runtime</scope>
+        <version>${protocols.version}</version>
+    </dependency>
     </dependencies>
 
     <build>

Copied: james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java (from r1326941, james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/FetchGroupImpl.java)
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java?p2=james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java&p1=james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/FetchGroupImpl.java&r1=1326941&r2=1327280&rev=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/FetchGroupImpl.java (original)
+++ james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/FetchGroupImpl.java Tue Apr 17 21:04:01 2012
@@ -17,13 +17,12 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imap.processor.base;
+package org.apache.james.mailbox.model;
 
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
-import org.apache.james.mailbox.model.MessageResult;
 import org.apache.james.mailbox.model.MessageResult.MimePath;
 
 /**

Copied: james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/PartContentDescriptorImpl.java (from r1326941, james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/PartContentDescriptorImpl.java)
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/PartContentDescriptorImpl.java?p2=james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/PartContentDescriptorImpl.java&p1=james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/PartContentDescriptorImpl.java&r1=1326941&r2=1327280&rev=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/PartContentDescriptorImpl.java (original)
+++ james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/PartContentDescriptorImpl.java Tue Apr 17 21:04:01 2012
@@ -17,11 +17,12 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imap.processor.base;
+package org.apache.james.mailbox.model;
 
 import org.apache.james.mailbox.model.MessageResult.FetchGroup.PartContentDescriptor;
 import org.apache.james.mailbox.model.MessageResult.MimePath;
 
+
 public class PartContentDescriptorImpl implements PartContentDescriptor {
 
     private int content = 0;

Modified: james/protocols/trunk/imap/pom.xml
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/pom.xml?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/pom.xml (original)
+++ james/protocols/trunk/imap/pom.xml Tue Apr 17 21:04:01 2012
@@ -71,6 +71,10 @@
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
         </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
        
         <dependency>
             <groupId>com.beetstra.jutf7</groupId>

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java Tue Apr 17 21:04:01 2012
@@ -235,6 +235,10 @@ public interface ImapConstants {
 
     public static final String ACL_RESPONSE_NAME = "ACL";
 
+    public static final String LISTRIGHTS_RESPONSE_NAME = "LISTRIGHTS";
+    
+    public static final String MYRIGHTS_RESPONSE_NAME = "MYRIGHTS";
+
     public static final String NAME_ATTRIBUTE_NOINFERIORS = "\\Noinferiors";
 
     public static final String NAME_ATTRIBUTE_NOSELECT = "\\Noselect";

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java Tue Apr 17 21:04:01 2012
@@ -156,7 +156,12 @@ public class HumanReadableText {
     public static final HumanReadableText QRESYNC_CLOSED = new HumanReadableText("org.apache.james.imap.QRESYNC_CLOSED", "");
     public static final HumanReadableText QRESYNC_VANISHED_WITHOUT_CHANGEDSINCE = new HumanReadableText("org.apache.james.imap.QRESYNC_VANISHED_WITHOUT_CHANGEDSINCE", "VANISHED used without CHANGEDSINCE");
 
-    
+    public static final String UNSUFFICIENT_RIGHTS_DEFAULT_VALUE = "You need the {0} right to perform command {1} on mailbox {2}.";
+    public static final String UNSUFFICIENT_RIGHTS_KEY = "org.apache.james.imap.UNSUFFICIENT_RIGHTS";
+
+    public static final String UNSUPPORTED_RIGHT_KEY = "org.apache.james.imap.UNSUPPORTED_RIGHT";
+    public static final String UNSUPPORTED_RIGHT_DEFAULT_VALUE = "The {0} right is not supported.";
+
     private final String defaultValue;
 
     private final String key;

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java Tue Apr 17 21:04:01 2012
@@ -194,18 +194,10 @@ public final class IdRange implements It
             this.current = from;
         }
         
-        /*
-         * (non-Javadoc)
-         * @see java.util.Iterator#hasNext()
-         */
         public boolean hasNext() {
             return current <= to;
         }
 
-        /*
-         * (non-Javadoc)
-         * @see java.util.Iterator#next()
-         */
         public Long next() {
             if (hasNext()) {
                 return current++;
@@ -214,20 +206,12 @@ public final class IdRange implements It
             }
         }
 
-        /*
-         * (non-Javadoc)
-         * @see java.util.Iterator#remove()
-         */
         public void remove() {
             throw new UnsupportedOperationException("Read-Only");
         }
         
     }
 
-    /*
-     * (non-Javadoc)
-     * @see java.lang.Comparable#compareTo(java.lang.Object)
-     */
     public int compareTo(IdRange range2) {
         // Correctly sort and respect "*" and "*:*" ranges. See IMAP-289
         if (getLowVal() == Long.MAX_VALUE && getHighVal() == Long.MAX_VALUE && range2.getLowVal() == Long.MAX_VALUE && range2.getHighVal() == Long.MAX_VALUE) {

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/process/ImapSession.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/process/ImapSession.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/process/ImapSession.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/api/process/ImapSession.java Tue Apr 17 21:04:01 2012
@@ -149,6 +149,19 @@ public interface ImapSession {
     public boolean startCompression();
 
     /**
+     * Push in a new {@link ImapLineHandler} which is called for the next line received
+     * 
+     * @param lineHandler
+     */
+    public void pushLineHandler(ImapLineHandler lineHandler);
+
+    /**
+     * Pop the current {@link ImapLineHandler}
+     * 
+     */
+    public void popLineHandler();
+    
+    /**
      * Return true if multiple namespaces are supported
      * 
      * @return multipleNamespaces
@@ -162,20 +175,5 @@ public interface ImapSession {
      * @return plainDisallowed
      */
     public boolean isPlainAuthDisallowed();
-    
-    /**
-     * Push in a new {@link ImapLineHandler} which is called for the next line received
-     * 
-     * @param lineHandler
-     */
-    public void pushLineHandler(ImapLineHandler lineHandler);
-
-    /**
-     * Pop the current {@link ImapLineHandler}
-     * 
-     */
-    public void popLineHandler();
-    
-
 
 }

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java Tue Apr 17 21:04:01 2012
@@ -190,7 +190,7 @@ public abstract class ImapRequestLineRea
      * Reads an argument of type "atom" from the request.
      */
     public String atom() throws DecodingException {
-        return consumeWord(new ATOM_CHARValidator());
+        return consumeWord(new ATOM_CHARValidator(), true);
     }
 
     /**

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java Tue Apr 17 21:04:01 2012
@@ -84,10 +84,6 @@ public abstract class AbstractSelectionC
                 request.consumeWord(new CharacterValidator() {
                     int pos = 0;
 
-                    /*
-                     * (non-Javadoc)
-                     * @see org.apache.james.imap.decode.ImapRequestLineReader.CharacterValidator#isValid(char)
-                     */
                     public boolean isValid(char chr) {
                         if (pos >= QRESYNC.length) {
                             return false;

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,50 @@
+/****************************************************************
+ * 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.decode.parser;
+
+import org.apache.james.imap.api.ImapCommand;
+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.decode.ImapRequestLineReader;
+import org.apache.james.imap.decode.base.AbstractImapCommandParser;
+import org.apache.james.imap.message.request.DeleteACLRequest;
+import org.apache.james.protocols.imap.DecodingException;
+
+/**
+ * DELETEACL Parser
+ * 
+ * @author Peter Palaga
+ */
+public class DeleteACLCommandParser extends AbstractImapCommandParser {
+
+    public DeleteACLCommandParser() {
+        super(ImapCommand.authenticatedStateCommand(ImapConstants.DELETEACL_COMMAND_NAME));
+    }
+
+    @Override
+    protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, ImapSession session) throws DecodingException {
+        final String mailboxName = request.mailbox();
+        final String identifier = request.astring();
+        request.eol();
+        return new DeleteACLRequest(tag, command, mailboxName, identifier);
+    }
+
+}

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java Tue Apr 17 21:04:01 2012
@@ -78,12 +78,6 @@ public class FetchCommandParser extends 
                     // Now check for the CHANGEDSINCE option which is part of CONDSTORE
                     request.consumeWord(new CharacterValidator() {
                         int pos = 0;
-                        
-
-                        /*
-                         * (non-Javadoc)
-                         * @see org.apache.james.imap.decode.ImapRequestLineReader.CharacterValidator#isValid(char)
-                         */
                         public boolean isValid(char chr) {
                             if (pos > CHANGEDSINCE.length) {
                                 return false;
@@ -100,11 +94,6 @@ public class FetchCommandParser extends 
                     // Check for the VANISHED option which is part of QRESYNC
                     request.consumeWord(new CharacterValidator() {
                         int pos = 0;
-                        
-                        /*
-                         * (non-Javadoc)
-                         * @see org.apache.james.imap.decode.ImapRequestLineReader.CharacterValidator#isValid(char)
-                         */
                         public boolean isValid(char chr) {
                             if (pos > VANISHED.length) {
                                 return false;

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java Tue Apr 17 21:04:01 2012
@@ -74,10 +74,10 @@ public class ImapParserFactory implement
 
         // RFC4314 GETACL, SETACL, DELETEACL, LISTRIGHTS, MYRIGHTS
         _imapCommands.put(ImapConstants.GETACL_COMMAND_NAME, GetACLCommandParser.class );
-        // _imapCommands.put( "SETACL", SetAclCommand.class );
-        // _imapCommands.put( "DELETEACL", DeleteAclCommand.class );
-        // _imapCommands.put( "LISTRIGHTS", ListRightsCommand.class );
-        // _imapCommands.put( "MYRIGHTS", MyRightsCommand.class );
+        _imapCommands.put(ImapConstants.SETACL_COMMAND_NAME, SetACLCommandParser.class );
+        _imapCommands.put(ImapConstants.DELETEACL_COMMAND_NAME, DeleteACLCommandParser.class );
+        _imapCommands.put(ImapConstants.LISTRIGHTS_COMMAND_NAME, ListRightsCommandParser.class );
+        _imapCommands.put(ImapConstants.MYRIGHTS_COMMAND_NAME, MyRightsCommandParser.class );
 
         // Commands only valid in SELECTED state.
         // CHECK, CLOSE, EXPUNGE, SEARCH, FETCH, STORE, COPY, UID and IDLE

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,50 @@
+/****************************************************************
+ * 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.decode.parser;
+
+import org.apache.james.imap.api.ImapCommand;
+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.decode.ImapRequestLineReader;
+import org.apache.james.imap.decode.base.AbstractImapCommandParser;
+import org.apache.james.imap.message.request.ListRightsRequest;
+import org.apache.james.protocols.imap.DecodingException;
+
+/**
+ * LISTRIGHTS Parser
+ * 
+ * @author Peter Palaga
+ */
+public class ListRightsCommandParser extends AbstractImapCommandParser {
+
+    public ListRightsCommandParser() {
+        super(ImapCommand.authenticatedStateCommand(ImapConstants.LISTRIGHTS_COMMAND_NAME));
+    }
+
+    @Override
+    protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, ImapSession session) throws DecodingException {
+        final String mailboxName = request.mailbox();
+        final String identifier = request.astring();
+        request.eol();
+        return new ListRightsRequest(tag, command, mailboxName, identifier);
+    }
+
+}

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.decode.parser;
+
+import org.apache.james.imap.api.ImapCommand;
+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.decode.ImapRequestLineReader;
+import org.apache.james.imap.decode.base.AbstractImapCommandParser;
+import org.apache.james.imap.message.request.MyRightsRequest;
+import org.apache.james.protocols.imap.DecodingException;
+
+/**
+ * MYRIGHTS Parser
+ * 
+ * @author Peter Palaga
+ */
+public class MyRightsCommandParser extends AbstractImapCommandParser {
+
+    public MyRightsCommandParser() {
+        super(ImapCommand.authenticatedStateCommand(ImapConstants.MYRIGHTS_COMMAND_NAME));
+    }
+
+    @Override
+    protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, ImapSession session) throws DecodingException {
+        final String mailboxName = request.mailbox();
+        request.eol();
+        return new MyRightsRequest(tag, command, mailboxName);
+    }
+
+}

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.decode.parser;
+
+import org.apache.james.imap.api.ImapCommand;
+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.decode.ImapRequestLineReader;
+import org.apache.james.imap.decode.base.AbstractImapCommandParser;
+import org.apache.james.imap.message.request.SetACLRequest;
+import org.apache.james.protocols.imap.DecodingException;
+
+/**
+ * SETACL Parser
+ * 
+ * @author Peter Palaga
+ */
+public class SetACLCommandParser extends AbstractImapCommandParser {
+
+    public SetACLCommandParser() {
+        super(ImapCommand.authenticatedStateCommand(ImapConstants.SETACL_COMMAND_NAME));
+    }
+
+    @Override
+    protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, ImapSession session) throws DecodingException {
+        final String mailboxName = request.mailbox();
+        final String identifier = request.astring();
+        final String rights = request.astring();
+        request.eol();
+        return new SetACLRequest(tag, command, mailboxName, identifier, rights);
+    }
+
+}

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java Tue Apr 17 21:04:01 2012
@@ -57,7 +57,7 @@ public class ACLResponseEncoder extends 
         composer.commandName(ImapConstants.ACL_RESPONSE_NAME);
         
         String mailboxName = aclResponse.getMailboxName();
-        composer.quote(mailboxName == null ? "" : mailboxName);
+        composer.mailbox(mailboxName == null ? "" : mailboxName);
         
         if (entries != null) {
             for (Entry<MailboxACLEntryKey, MailboxACLRights> entry : entries.entrySet()) {

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/EncoderUtils.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/EncoderUtils.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/EncoderUtils.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/EncoderUtils.java Tue Apr 17 21:04:01 2012
@@ -19,12 +19,12 @@
 
 package org.apache.james.imap.encode;
 
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
 
+import org.apache.commons.lang.time.FastDateFormat;
+
 /**
  * Utility methods for IMAP encoding.
  */
@@ -38,8 +38,7 @@ public class EncoderUtils {
      * @return encoded IMAP <code>date-time</code>, not null
      */
     public static String encodeDateTime(final Date date) {
-        final DateFormat format = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z", Locale.US);
-        format.setTimeZone(TimeZone.getTimeZone("GMT"));
+        final FastDateFormat format = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss Z", TimeZone.getTimeZone("GMT"), Locale.US);
         final String result = format.format(date);
         return result;
     }

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java Tue Apr 17 21:04:01 2012
@@ -24,6 +24,7 @@ import java.io.IOException;
 import javax.mail.Flags;
 
 import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.display.CharsetUtil;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.message.response.Literal;
 
@@ -48,7 +49,6 @@ public interface ImapResponseComposer {
      */
     public ImapResponseComposer flags(Flags flags) throws IOException;
 
-
     /**
      * Composes a <code>NIL</code>.
      * 
@@ -57,7 +57,8 @@ public interface ImapResponseComposer {
     public ImapResponseComposer nil() throws IOException;
 
     /**
-     * Compose a response which contains the {@link ImapCommand} to which the response belongs
+     * Compose a response which contains the {@link ImapCommand} to which the
+     * response belongs
      * 
      * @param command
      * @param message
@@ -66,7 +67,6 @@ public interface ImapResponseComposer {
      */
     public ImapResponseComposer commandResponse(ImapCommand command, String message) throws IOException;
 
-  
     /**
      * Writes the message provided to the client, prepended with the request
      * tag.
@@ -85,9 +85,8 @@ public interface ImapResponseComposer {
      */
     public ImapResponseComposer untaggedResponse(String message) throws IOException;
 
-
     /**
-     * Write a '*' 
+     * Write a '*'
      * 
      * @return composer
      * @throws IOException
@@ -121,6 +120,17 @@ public interface ImapResponseComposer {
     public ImapResponseComposer message(final long number) throws IOException;
 
     /**
+     * First encodes the given {@code mailboxName} using
+     * {@link CharsetUtil#encodeModifiedUTF7(String)} and then quotes the result
+     * with {@link #quote(String)}.
+     * 
+     * @param mailboxName
+     * @return
+     * @throws IOException
+     */
+    public ImapResponseComposer mailbox(final String mailboxName) throws IOException;
+
+    /**
      * Write the given sequence-set
      * 
      * @param ranges
@@ -130,7 +140,8 @@ public interface ImapResponseComposer {
     public ImapResponseComposer sequenceSet(final IdRange[] ranges) throws IOException;
 
     /**
-     * Write a CRLF and flush the composer which will write the content of it to the socket
+     * Write a CRLF and flush the composer which will write the content of it to
+     * the socket
      * 
      * @return composer
      * @throws IOException
@@ -156,8 +167,8 @@ public interface ImapResponseComposer {
     public ImapResponseComposer quote(String message) throws IOException;
 
     /**
-     * Compose a {@link Literal} and write it to the socket. Everything which was buffered before will
-     * get written too
+     * Compose a {@link Literal} and write it to the socket. Everything which
+     * was buffered before will get written too
      * 
      * @param literal
      * @return self
@@ -165,7 +176,6 @@ public interface ImapResponseComposer {
      */
     public ImapResponseComposer literal(Literal literal) throws IOException;
 
-    
     /**
      * Write a '('
      * 
@@ -206,7 +216,6 @@ public interface ImapResponseComposer {
      */
     public ImapResponseComposer quoteUpperCaseAscii(final String message) throws IOException;
 
-
     /**
      * Tell the {@link ImapResponseComposer} to skip the next written space
      * 
@@ -215,7 +224,6 @@ public interface ImapResponseComposer {
      */
     public ImapResponseComposer skipNextSpace() throws IOException;
 
-
     /**
      * Writes a continuation response.
      * 
@@ -223,7 +231,6 @@ public interface ImapResponseComposer {
      *            message for display, not null
      */
     public ImapResponseComposer continuationResponse(String message) throws IOException;
-    
 
     /**
      * Write a '}'

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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.io.IOException;
+
+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.ListRightsResponse;
+import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+
+/**
+ * ACL Response Encoder.
+ * 
+ * @author Peter Palaga
+ */
+public class ListRightsResponseEncoder extends AbstractChainedImapEncoder {
+
+    public ListRightsResponseEncoder(ImapEncoder next) {
+        super(next);
+    }
+
+    /** 
+     * @see
+     * org.apache.james.imap.encode.base.AbstractChainedImapEncoder#doEncode
+     * (org.apache.james.imap.api.ImapMessage,
+     * org.apache.james.imap.encode.ImapResponseComposer,
+     * org.apache.james.imap.api.process.ImapSession)
+     */
+    protected void doEncode(ImapMessage acceptableMessage, ImapResponseComposer composer, ImapSession session) throws IOException {
+        final ListRightsResponse listRightsResponse = (ListRightsResponse) acceptableMessage;
+        composer.untagged();
+        composer.commandName(ImapConstants.LISTRIGHTS_RESPONSE_NAME);
+        
+        String mailboxName = listRightsResponse.getMailboxName();
+        composer.mailbox(mailboxName == null ? "" : mailboxName);
+        
+        String identifier = listRightsResponse.getIdentifier();
+        composer.quote(identifier);
+        
+        MailboxACLRights[] rights = listRightsResponse.getRights();
+        
+        for (MailboxACLRights entry : rights) {
+            composer.quote(entry.serialize());
+       }
+        composer.end();
+    }
+
+    /** 
+     * @see
+     * org.apache.james.imap.encode.base.AbstractChainedImapEncoder#isAcceptable
+     * (org.apache.james.imap.api.ImapMessage)
+     */
+    public boolean isAcceptable(ImapMessage message) {
+        return message instanceof ListRightsResponse;
+    }
+}

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java Tue Apr 17 21:04:01 2012
@@ -55,7 +55,7 @@ public class ListingEncodingUtils {
         } else {
         	composer.quote(Character.toString(hierarchyDelimiter));
         }
-        composer.quote(name);
+        composer.mailbox(name);
 
         composer.end();
     }

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,71 @@
+/****************************************************************
+ * 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.io.IOException;
+
+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.MyRightsResponse;
+import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+
+/**
+ * MYRIGHTS Response Encoder.
+ * 
+ * @author Peter Palaga
+ */
+public class MyRightsResponseEncoder extends AbstractChainedImapEncoder {
+
+    public MyRightsResponseEncoder(ImapEncoder next) {
+        super(next);
+    }
+
+    /** 
+     * @see
+     * org.apache.james.imap.encode.base.AbstractChainedImapEncoder#doEncode
+     * (org.apache.james.imap.api.ImapMessage,
+     * org.apache.james.imap.encode.ImapResponseComposer,
+     * org.apache.james.imap.api.process.ImapSession)
+     */
+    protected void doEncode(ImapMessage acceptableMessage, ImapResponseComposer composer, ImapSession session) throws IOException {
+        final MyRightsResponse aclResponse = (MyRightsResponse) acceptableMessage;
+        final MailboxACLRights myRights = aclResponse.getMyRights();
+        composer.untagged();
+        composer.commandName(ImapConstants.MYRIGHTS_RESPONSE_NAME);
+        
+        String mailboxName = aclResponse.getMailboxName();
+        composer.mailbox(mailboxName == null ? "" : mailboxName);
+        composer.quote(myRights == null ? "" : myRights.serialize());
+        composer.end();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.james.imap.encode.base.AbstractChainedImapEncoder#isAcceptable
+     * (org.apache.james.imap.api.ImapMessage)
+     */
+    public boolean isAcceptable(ImapMessage message) {
+        return message instanceof MyRightsResponse;
+    }
+}

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java Tue Apr 17 21:04:01 2012
@@ -26,6 +26,7 @@ import javax.mail.Flags;
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
+import org.apache.james.imap.api.display.CharsetUtil;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.encode.ImapResponseComposer;
 import org.apache.james.imap.encode.ImapResponseWriter;
@@ -278,6 +279,14 @@ public class ImapResponseComposerImpl im
         writeASCII(Long.toString(number));
         return this;
     }
+    
+    /**
+     * @see org.apache.james.imap.encode.ImapResponseComposer#mailbox(java.lang.String)
+     */
+    public ImapResponseComposer mailbox(final String mailboxName) throws IOException {
+        quote(CharsetUtil.encodeModifiedUTF7(mailboxName));
+        return this;
+    }
 
     /**
      * @see

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java Tue Apr 17 21:04:01 2012
@@ -34,6 +34,8 @@ import org.apache.james.imap.encode.Imap
 import org.apache.james.imap.encode.ImapEncoderFactory;
 import org.apache.james.imap.encode.LSubResponseEncoder;
 import org.apache.james.imap.encode.ListResponseEncoder;
+import org.apache.james.imap.encode.ListRightsResponseEncoder;
+import org.apache.james.imap.encode.MyRightsResponseEncoder;
 import org.apache.james.imap.encode.NamespaceResponseEncoder;
 import org.apache.james.imap.encode.RecentResponseEncoder;
 import org.apache.james.imap.encode.MailboxStatusResponseEncoder;
@@ -61,7 +63,9 @@ public class DefaultImapEncoderFactory i
     public static final ImapEncoder createDefaultEncoder(final Localizer localizer, final boolean neverAddBodyStructureExtensions) {
         final EndImapEncoder endImapEncoder = new EndImapEncoder();
         
-        final ACLResponseEncoder aclResponseEncoder = new ACLResponseEncoder(endImapEncoder); 
+        final MyRightsResponseEncoder myRightsResponseEncoder = new MyRightsResponseEncoder(endImapEncoder); 
+        final ListRightsResponseEncoder listRightsResponseEncoder = new ListRightsResponseEncoder(myRightsResponseEncoder); 
+        final ACLResponseEncoder aclResponseEncoder = new ACLResponseEncoder(listRightsResponseEncoder); 
         final NamespaceResponseEncoder namespaceEncoder = new NamespaceResponseEncoder(aclResponseEncoder);
         final StatusResponseEncoder statusResponseEncoder = new StatusResponseEncoder(namespaceEncoder, localizer);
         final RecentResponseEncoder recentResponseEncoder = new RecentResponseEncoder(statusResponseEncoder);

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultLocalizer.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultLocalizer.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultLocalizer.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/encode/main/DefaultLocalizer.java Tue Apr 17 21:04:01 2012
@@ -19,6 +19,9 @@
 
 package org.apache.james.imap.encode.main;
 
+import java.text.MessageFormat;
+import java.util.Locale;
+
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.display.Locales;
 import org.apache.james.imap.api.display.Localizer;
@@ -33,11 +36,21 @@ public class DefaultLocalizer implements
      * @see Localizer#localize(HumanReadableText, Locales)
      */
     public String localize(HumanReadableText text, Locales locales) {
-        final String result;
+        
+        String result;
         if (text == null) {
             result = null;
         } else {
+            //FIXME implement the locale selection
+            final Locale chosenLocale = Locale.US;
+            //FIXME implement the localized value lookup depending on chosenLocale
             result = text.getDefaultValue();
+            
+            Object[] params = text.getParameters();
+            if (params != null && params.length > 0) {
+                MessageFormat messageFormat = new MessageFormat(result, chosenLocale);
+                result = messageFormat.format(params);
+            }
         }
         return result;
     }

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/DeleteACLRequest.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/DeleteACLRequest.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/DeleteACLRequest.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/DeleteACLRequest.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.message.request;
+
+import org.apache.james.imap.api.ImapCommand;
+
+/**
+ * DELETEACL Request.
+ * 
+ * @author Peter Palaga
+ */
+public class DeleteACLRequest extends AbstractImapRequest {
+    private final String identifier;
+    private final String mailboxName;
+
+    public DeleteACLRequest(String tag, ImapCommand command, String mailboxName, String identifier) {
+        super(tag, command);
+        this.mailboxName = mailboxName;
+        this.identifier = identifier;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public String getMailboxName() {
+        return mailboxName;
+    }
+
+}

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/ListRightsRequest.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/ListRightsRequest.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/ListRightsRequest.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/ListRightsRequest.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.message.request;
+
+import org.apache.james.imap.api.ImapCommand;
+
+/**
+ * LISTRIGHTS Request.
+ * 
+ * @author Peter Palaga
+ */
+public class ListRightsRequest extends AbstractImapRequest {
+    private final String identifier;
+    private final String mailboxName;
+
+    public ListRightsRequest(String tag, ImapCommand command, String mailboxName, String identifier) {
+        super(tag, command);
+        this.mailboxName = mailboxName;
+        this.identifier = identifier;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public String getMailboxName() {
+        return mailboxName;
+    }
+
+}

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/MyRightsRequest.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/MyRightsRequest.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/MyRightsRequest.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/MyRightsRequest.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,41 @@
+/****************************************************************
+ * 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.message.request;
+
+import org.apache.james.imap.api.ImapCommand;
+
+/**
+ * MYRIGHTS Request.
+ * 
+ * @author Peter Palaga
+ */
+public class MyRightsRequest extends AbstractImapRequest {
+    private final String mailboxName;
+
+    public MyRightsRequest(String tag, ImapCommand command, String mailboxName) {
+        super(tag, command);
+        this.mailboxName = mailboxName;
+    }
+
+    public String getMailboxName() {
+        return mailboxName;
+    }
+
+}

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/SetACLRequest.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/SetACLRequest.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/SetACLRequest.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/request/SetACLRequest.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,53 @@
+/****************************************************************
+ * 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.message.request;
+
+import org.apache.james.imap.api.ImapCommand;
+
+/**
+ * SETACL Request.
+ * 
+ * @author Peter Palaga
+ */
+public class SetACLRequest extends AbstractImapRequest {
+    private final String identifier;
+    private final String mailboxName;
+    private final String rights;
+
+    public SetACLRequest(String tag, ImapCommand command, String mailboxName, String identifier, String rights) {
+        super(tag, command);
+        this.mailboxName = mailboxName;
+        this.identifier = identifier;
+        this.rights = rights;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public String getMailboxName() {
+        return mailboxName;
+    }
+
+    public String getRights() {
+        return rights;
+    }
+
+}

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java Tue Apr 17 21:04:01 2012
@@ -22,7 +22,6 @@ package org.apache.james.imap.message.re
 import java.util.Map.Entry;
 
 import org.apache.james.imap.api.ImapConstants;
-import org.apache.james.imap.api.display.CharsetUtil;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
 import org.apache.james.mailbox.model.MailboxACL;
 import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey;
@@ -39,8 +38,7 @@ public final class ACLResponse implement
 
     public ACLResponse(String mailboxName, MailboxACL acl) {
         super();
-        //FIXME encodeModifiedUTF7 invocations should probably be moved to org.apache.james.imap.encode.ImapResponseComposer analogically to org.apache.james.imap.decode.ImapRequestLineReader.mailbox() 
-        this.mailboxName = CharsetUtil.encodeModifiedUTF7(mailboxName);
+        this.mailboxName = mailboxName;
         this.acl = acl;
     }
 
@@ -48,8 +46,8 @@ public final class ACLResponse implement
     public boolean equals(Object o) {
         if (o instanceof ACLResponse) {
             ACLResponse other = (ACLResponse) o;
-            return this.acl == other.acl || (this.acl != null && this.acl.equals(other.acl))
-                    && this.mailboxName == other.mailboxName || (this.mailboxName != null && this.mailboxName.equals(other.mailboxName))
+            return (this.acl == other.acl || (this.acl != null && this.acl.equals(other.acl)))
+                    && (this.mailboxName == other.mailboxName || (this.mailboxName != null && this.mailboxName.equals(other.mailboxName)))
                     ;
         }
         return false;

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/AbstractListingResponse.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/AbstractListingResponse.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/AbstractListingResponse.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/AbstractListingResponse.java Tue Apr 17 21:04:01 2012
@@ -19,7 +19,6 @@
 
 package org.apache.james.imap.message.response;
 
-import org.apache.james.imap.api.display.CharsetUtil;
 import org.apache.james.imap.api.process.MailboxType;
 
 /**
@@ -53,7 +52,7 @@ public abstract class AbstractListingRes
         this.unmarked = unmarked;
         this.children = hasChildren;
         this.noChildren = hasNoChildren;
-        this.name = CharsetUtil.encodeModifiedUTF7(name);
+        this.name = name;
         this.hierarchyDelimiter = hierarchyDelimiter;
         this.type = type;
     }

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,88 @@
+/****************************************************************
+ * 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.message.response;
+
+import java.util.Arrays;
+
+import org.apache.james.imap.api.ImapConstants;
+import org.apache.james.imap.api.message.response.ImapResponseMessage;
+import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+
+/**
+ * LISTRIGHTS Response.
+ * 
+ * @author Peter Palaga
+ */
+public final class ListRightsResponse implements ImapResponseMessage {
+
+    private final String identifier;
+    private final String mailboxName;
+    private final MailboxACLRights[] rights;
+
+    public ListRightsResponse(String mailboxName, String identifier, MailboxACLRights[] rights) {
+        super();
+        this.mailboxName = mailboxName;
+        this.identifier = identifier;
+        this.rights = rights;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof ListRightsResponse) {
+            ListRightsResponse other = (ListRightsResponse) o;
+            return (this.mailboxName == other.mailboxName || (this.mailboxName != null && this.mailboxName.equals(other.mailboxName))) && (this.identifier == other.identifier || (this.identifier != null && this.identifier.equals(other.identifier))) && Arrays.equals(this.rights, other.rights);
+        }
+        return false;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public String getMailboxName() {
+        return mailboxName;
+    }
+
+    public MailboxACLRights[] getRights() {
+        return rights;
+    }
+
+    @Override
+    public int hashCode() {
+        final int PRIME = 31;
+        int hashCode = (mailboxName == null ? 0 : mailboxName.hashCode());
+        hashCode = PRIME * hashCode + (identifier == null ? 0 : identifier.hashCode());
+        hashCode = PRIME * hashCode + (rights == null ? 0 : Arrays.hashCode(rights));
+
+        return hashCode;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder result = new StringBuilder().append(ImapConstants.LISTRIGHTS_RESPONSE_NAME).append(' ').append(mailboxName).append(' ').append(identifier);
+
+        for (MailboxACLRights optionalRightsGroup : rights) {
+            result.append(' ').append(optionalRightsGroup.toString());
+        }
+
+        return result.toString();
+    };
+
+}

Added: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java?rev=1327280&view=auto
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java (added)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java Tue Apr 17 21:04:01 2012
@@ -0,0 +1,78 @@
+/****************************************************************
+ * 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.message.response;
+
+import org.apache.james.imap.api.ImapConstants;
+import org.apache.james.imap.api.message.response.ImapResponseMessage;
+import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights;
+
+/**
+ * MYRIGHTS Response.
+ * 
+ * @author Peter Palaga
+ */
+public final class MyRightsResponse implements ImapResponseMessage {
+    private final String mailboxName;
+    private final MailboxACLRights myRights;
+
+    public MyRightsResponse(String mailboxName, MailboxACLRights myRights) {
+        super();
+        this.mailboxName = mailboxName;
+        this.myRights = myRights;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof MyRightsResponse) {
+            MyRightsResponse other = (MyRightsResponse) o;
+            return (this.myRights == other.myRights || (this.myRights != null && this.myRights.equals(other.myRights)))
+                    && (this.mailboxName == other.mailboxName || (this.mailboxName != null && this.mailboxName.equals(other.mailboxName)))
+                    ;
+        }
+        return false;
+    }
+
+    public String getMailboxName() {
+        return mailboxName;
+    }
+
+    public MailboxACLRights getMyRights() {
+        return myRights;
+    }
+
+    @Override
+    public int hashCode() {
+        final int PRIME = 31;
+        return PRIME * myRights.hashCode() + mailboxName.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder result = new StringBuilder()
+        .append(ImapConstants.ACL_RESPONSE_NAME)
+        .append(' ')
+        .append(mailboxName)
+        .append(' ')
+        .append(myRights.toString());
+        
+        return result.toString();
+    };
+
+}

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java Tue Apr 17 21:04:01 2012
@@ -46,7 +46,6 @@ import org.apache.james.imap.message.res
 import org.apache.james.imap.message.response.RecentResponse;
 import org.apache.james.imap.message.response.VanishedResponse;
 import org.apache.james.imap.processor.base.AbstractChainedProcessor;
-import org.apache.james.imap.processor.base.FetchGroupImpl;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
@@ -54,6 +53,7 @@ import org.apache.james.mailbox.MessageM
 import org.apache.james.mailbox.MessageManager.MetaData.FetchGroup;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MessageRangeException;
+import org.apache.james.mailbox.model.FetchGroupImpl;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageRange;

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java Tue Apr 17 21:04:01 2012
@@ -435,24 +435,21 @@ abstract class AbstractSelectionProcesso
         }
     }
 
-    /*
-     * (non-Javadoc)
+    /**
      * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
      */
     public List<String> getImplementedCapabilities(ImapSession session) {        
         return CAPS;
     }
 
-    /*
-     * (non-Javadoc)
+    /**
      * @see org.apache.james.imap.processor.PermitEnableCapabilityProcessor#getPermitEnableCapabilities(org.apache.james.imap.api.process.ImapSession)
      */
     public List<String> getPermitEnableCapabilities(ImapSession session) {
         return CAPS;
     }
 
-    /*
-     * (non-Javadoc)
+    /**
      * @see org.apache.james.imap.processor.PermitEnableCapabilityProcessor#enable(org.apache.james.imap.api.ImapMessage, org.apache.james.imap.api.process.ImapProcessor.Responder, org.apache.james.imap.api.process.ImapSession, java.lang.String)
      */
     public void enable(ImapMessage message, Responder responder, ImapSession session, String capability) throws EnableException {

Modified: james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java?rev=1327280&r1=1327279&r2=1327280&view=diff
==============================================================================
--- james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java (original)
+++ james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java Tue Apr 17 21:04:01 2012
@@ -86,8 +86,12 @@ public class DefaultProcessorChain {
         final CompressProcessor compressProcessor = new CompressProcessor(unselectProcessor, statusResponseFactory);
         
         final GetACLProcessor getACLProcessor = new GetACLProcessor(compressProcessor, mailboxManager, statusResponseFactory);
+        final SetACLProcessor setACLProcessor = new SetACLProcessor(getACLProcessor, mailboxManager, statusResponseFactory);
+        final DeleteACLProcessor deleteACLProcessor = new DeleteACLProcessor(setACLProcessor, mailboxManager, statusResponseFactory);
+        final ListRightsProcessor listRightsProcessor = new ListRightsProcessor(deleteACLProcessor, mailboxManager, statusResponseFactory);
+        final MyRightsProcessor myRightsProcessor = new MyRightsProcessor(listRightsProcessor, mailboxManager, statusResponseFactory);
         
-        final EnableProcessor enableProcessor = new EnableProcessor(getACLProcessor, mailboxManager, statusResponseFactory);
+        final EnableProcessor enableProcessor = new EnableProcessor(myRightsProcessor, mailboxManager, statusResponseFactory);
         
         // add for QRESYNC
         enableProcessor.addProcessor(selectProcessor);



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