james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r515230 [3/4] - in /james/server/sandbox/seda-imap/src: java/org/apache/james/imapserver/ java/org/apache/james/imapserver/commands/ java/org/apache/james/imapserver/decode/ java/org/apache/james/imapserver/encode/ java/org/apache/james/ima...
Date Tue, 06 Mar 2007 17:59:12 GMT
Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/decode/UnsubscribeCommandParser.java (from r514102, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/decode/UnsubscribeCommandParser.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java&r1=514102&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/decode/UnsubscribeCommandParser.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/UnsubscribeCommandParser.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/decode/UnsubscribeCommandParser.java Tue Mar  6 09:59:02 2007
@@ -16,21 +16,32 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.decode;
 
 import org.apache.james.imapserver.ImapRequestLineReader;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
+import org.apache.james.imapserver.commands.ImapCommandFactory;
+import org.apache.james.imapserver.message.ImapCommandMessage;
 
-class UnsubscribeCommandParser extends AbstractImapCommandParser {
+class UnsubscribeCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
 
     public UnsubscribeCommandParser() {
-        super(new UnsubscribeCommand());
     }
 
-    protected AbstractImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+    /**
+     * @see org.apache.james.imapserver.decode.InitialisableCommandFactory#init(org.apache.james.imapserver.commands.ImapCommandFactory)
+     */
+    public void init(ImapCommandFactory factory)
+    {
+        final ImapCommand command = factory.getUnsubscribe();
+        setCommand(command);
+    }
+    
+    protected ImapCommandMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
         final String mailboxName = mailbox( request );
         endLine( request );
-        final UnsubscribeCommandMessage result = new UnsubscribeCommandMessage(command, mailboxName, tag);
+        final ImapCommandMessage result = getMessageFactory().createUnsubscribeMessage(command, mailboxName, tag);
         return result;
     }
     

Modified: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/encode/RecordingImapResponseWriter.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/encode/RecordingImapResponseWriter.java?view=diff&rev=515230&r1=515229&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/encode/RecordingImapResponseWriter.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/encode/RecordingImapResponseWriter.java Tue Mar  6 09:59:02 2007
@@ -25,8 +25,8 @@
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapResponseWriter;
 import org.apache.james.imapserver.ImapSession;
-import org.apache.james.imapserver.commands.ImapCommandMessage;
-import org.apache.james.imapserver.commands.ImapResponseMessage;
+import org.apache.james.imapserver.message.ImapCommandMessage;
+import org.apache.james.imapserver.message.ImapResponseMessage;
 
 public class RecordingImapResponseWriter implements ImapResponseMessage,
         ImapCommandMessage, ImapResponseWriter {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractCommandResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AbstractCommandResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractCommandResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AbstractCommandResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractCommandResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AbstractCommandResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractCommandResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -17,15 +17,16 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
-public abstract class AbstractCommandResponseMessage extends AbstractLogEnabled implements ImapResponseMessage {
+abstract class AbstractCommandResponseMessage extends AbstractLogEnabled implements ImapResponseMessage {
 
     private final ImapCommand command;
     private final String tag;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractImapCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AbstractImapCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractImapCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AbstractImapCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractImapCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AbstractImapCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AbstractImapCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,13 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 abstract class AbstractImapCommandMessage extends AbstractLogEnabled implements ImapCommandMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AppendCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AppendCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AppendCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AppendCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AppendCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AppendCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AppendCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import java.util.Date;
 
@@ -24,6 +24,7 @@
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AuthenticateCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AuthenticateCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AuthenticateCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AuthenticateCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AuthenticateCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/AuthenticateCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/AuthenticateCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class AuthenticateCommandMessage extends AbstractImapCommandMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BadResponseMessage.java (from r514102, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/BadResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BadResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/BadResponseMessage.java&r1=514102&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BadResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/BadResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BadResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
@@ -26,7 +26,7 @@
  * Carries the response to a request with bad syntax..
  * 
  */
-public class BadResponseMessage implements ImapCommandMessage,
+class BadResponseMessage implements ImapCommandMessage,
         ImapResponseMessage {
 
     private final String message;

Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BaseImapMessageFactory.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BaseImapMessageFactory.java?view=auto&rev=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BaseImapMessageFactory.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BaseImapMessageFactory.java Tue Mar  6 09:59:02 2007
@@ -0,0 +1,132 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/ 
+package org.apache.james.imapserver.message;
+
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.mail.internet.MimeMessage;
+import javax.mail.search.SearchTerm;
+
+import org.apache.james.imapserver.commands.ImapCommand;
+
+/**
+ * Naive, factory creates unpooled instances.
+ */
+public class BaseImapMessageFactory implements ImapMessageFactory {
+
+    public ImapCommandMessage createErrorMessage(String message, String tag) {
+        return new ErrorResponseMessage( message, tag );
+    }
+
+    public ImapCommandMessage createAppendMessage(ImapCommand command, String mailboxName, Flags flags, Date datetime, MimeMessage message, String tag) {
+        return new AppendCommandMessage(command, mailboxName, 
+                flags, datetime, message, tag);
+    }
+
+    public ImapCommandMessage createAuthenticateMessage(ImapCommand command, String authType, String tag) {
+        return new AuthenticateCommandMessage(command, authType, tag);
+    }
+
+    public ImapCommandMessage createCapabilityMessage(ImapCommand command, String tag) {
+        return new CapabilityCommandMessage(command, tag);
+    }
+
+    public ImapCommandMessage createCompleteMessage(ImapCommand command, boolean useUids, String tag) {
+        return new CompleteCommandMessage(command, useUids, tag);
+    }
+
+    public ImapCommandMessage createCloseMessage(ImapCommand command, String tag) {
+        return new CloseCommandMessage(command, tag);
+    }
+
+    public ImapCommandMessage createCopyMessage(ImapCommand command, IdRange[] idSet, String mailboxName, boolean useUids, String tag) {
+        return new CopyCommandMessage(command, idSet, mailboxName, useUids, tag);
+    }
+
+    public ImapCommandMessage createCreateMessage(ImapCommand command, String mailboxName, String tag) {
+        return new CreateCommandMessage(command, mailboxName, tag);
+    }
+
+    public ImapCommandMessage createDeleteMessage(ImapCommand command, String mailboxName, String tag) {
+        return new DeleteCommandMessage( command, mailboxName, tag );
+    }
+
+    public ImapCommandMessage createExamineMessage(ImapCommand command, String mailboxName, String tag) {
+        return new SelectCommandMessage(command, mailboxName, true, tag);
+    }
+
+    public ImapCommandMessage createExpungeMessage(ImapCommand command, String tag) {
+        return new ExpungeCommandMessage(command, tag);
+    }
+
+    public ImapCommandMessage createFetchMessage(ImapCommand command, boolean useUids, IdRange[] idSet, FetchRequest fetch, String tag) {
+        return new FetchCommandMessage(command, useUids, idSet, fetch, tag);
+    }
+
+    public ImapCommandMessage createListMessage(ImapCommand command, String referenceName, String mailboxPattern, String tag) {
+        return new ListCommandMessage(command, referenceName, mailboxPattern, tag);
+    }
+
+    public ImapCommandMessage createLoginMessage(ImapCommand command, String userid, String password, String tag) {
+        return new LoginCommandMessage(command, userid, password, tag);
+    }
+
+    public ImapCommandMessage createLogoutMessage(ImapCommand command, String tag) {
+        return new LogoutCommandMessage(command, tag);
+    }
+
+    public ImapCommandMessage createLsubMessage(ImapCommand command, String referenceName, String mailboxPattern, String tag) {
+        return new LsubListCommandMessage(command, referenceName, mailboxPattern, tag);
+    }
+
+    public ImapCommandMessage createRenameMessage(ImapCommand command, String existingName, String newName, String tag) {
+        return new RenameCommandMessage(command, existingName, newName, tag);
+    }
+
+    public ImapCommandMessage createSearchImapMessage(ImapCommand command, SearchTerm searchTerm, boolean useUids, String tag) {
+        return new SearchImapCommandMessage(command, searchTerm, useUids, tag);
+    }
+
+    public ImapCommandMessage createSelectMessage(ImapCommand command, String mailboxName, String tag) {
+        return  new SelectCommandMessage(command, mailboxName, false, tag);
+    }
+
+    public ImapCommandMessage createStatusMessage(ImapCommand command, String mailboxName, StatusDataItems statusDataItems, String tag) {
+        return new StatusCommandMessage(command, mailboxName, statusDataItems, tag);
+    }
+
+    public ImapCommandMessage createStoreMessage(ImapCommand command, IdRange[] idSet, StoreDirective directive, Flags flags, boolean useUids, String tag) {
+        return new StoreCommandMessage(command, idSet, directive, flags, useUids, tag);
+    }
+
+    public ImapCommandMessage createSubscribeMessage(ImapCommand command, String mailboxName, String tag) {
+        return new SubscribeCommandMessage(command, mailboxName, tag);
+    }
+
+    public ImapCommandMessage createUnsubscribeMessage(ImapCommand command, String mailboxName, String tag) {
+        return new UnsubscribeCommandMessage(command, mailboxName, tag);
+    }
+
+    public ImapCommandMessage createBadRequestMessage(String message) {
+        return new BadResponseMessage(message);
+    }  
+    
+    
+}

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BodyFetchElement.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/BodyFetchElement.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BodyFetchElement.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/BodyFetchElement.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BodyFetchElement.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/BodyFetchElement.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/BodyFetchElement.java Tue Mar  6 09:59:02 2007
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
-class BodyFetchElement
+public class BodyFetchElement
 {
     private String name;
     private String sectionIdentifier;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CapabilityCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CapabilityCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CapabilityCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class CapabilityCommandMessage extends AbstractImapCommandMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityReponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CapabilityReponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityReponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CapabilityReponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityReponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CapabilityReponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CapabilityReponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,10 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
+import org.apache.james.imapserver.ImapConstants;
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class CapabilityReponseMessage extends AbstractCommandResponseMessage {
@@ -29,7 +31,7 @@
     }
 
     void doEncode(ImapResponse response, ImapSession session, ImapCommand command, String tag) throws MailboxException {
-        response.untaggedResponse( CapabilityCommand.CAPABILITY_RESPONSE );
+        response.untaggedResponse( ImapConstants.CAPABILITY_RESPONSE );
         session.unsolicitedResponses( response, false);
         response.commandComplete( command , tag );            
     }

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CloseCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CloseCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CloseCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CloseResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CloseResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CloseResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CloseResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class CloseResponseMessage extends AbstractCommandResponseMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandCompleteResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CommandCompleteResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandCompleteResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CommandCompleteResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandCompleteResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CommandCompleteResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandCompleteResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -17,13 +17,14 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
-public class CommandCompleteResponseMessage extends AbstractCommandResponseMessage implements ImapResponseMessage {
+class CommandCompleteResponseMessage extends AbstractCommandResponseMessage implements ImapResponseMessage {
 
     /**
      * Creates a command completed response message that

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandFailedResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CommandFailedResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandFailedResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CommandFailedResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandFailedResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CommandFailedResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CommandFailedResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -17,10 +17,11 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 
 class CommandFailedResponseMessage implements ImapResponseMessage {
 

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CompleteCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CompleteCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CompleteCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CompleteCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CompleteCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CompleteCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CompleteCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class CompleteCommandMessage extends AbstractImapCommandMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CopyCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CopyCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CopyCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CopyCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CopyCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CopyCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CopyCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.MailboxManagerException;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CreateCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CreateCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CreateCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CreateCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CreateCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/CreateCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/CreateCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/DeleteCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/DeleteCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/DeleteCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/DeleteCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/DeleteCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/DeleteCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/DeleteCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,16 +16,18 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 
 class DeleteCommandMessage extends AbstractImapCommandMessage {
     private final String mailboxName;
+    
     public DeleteCommandMessage(final ImapCommand command, final String mailboxName, final String tag) {
         super(tag, command);
         this.mailboxName = mailboxName;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ErrorResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ErrorResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ErrorResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ErrorResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ErrorResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ErrorResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ErrorResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
@@ -26,7 +26,7 @@
  * Carries an error response.
  * 
  */
-public class ErrorResponseMessage implements ImapResponseMessage, ImapCommandMessage {
+class ErrorResponseMessage implements ImapResponseMessage, ImapCommandMessage {
 
     private final String message;
     private final String tag;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ExpungeCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ExpungeCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ExpungeCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ExpungeCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ExpungeCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ExpungeCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ExpungeCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -32,8 +32,10 @@
 
 import org.apache.james.core.MimeMessageWrapper;
 import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapConstants;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.imapserver.store.MessageFlags;
 import org.apache.james.imapserver.store.SimpleMessageAttributes;
@@ -58,7 +60,7 @@
             this.idSet = idSet;
             this.fetch = fetch;
             if (useUids) {
-                fetch.uid = true;
+                fetch.setUid(true);
             }
         }
 
@@ -111,13 +113,13 @@
                 StringBuffer response = new StringBuffer();
 
                 // FLAGS response
-                if (fetch.flags || ensureFlagsResponse) {
+                if (fetch.isFlags() || ensureFlagsResponse) {
                     response.append(" FLAGS ");
                     response.append(MessageFlags.format(result.getFlags()));
                 }
 
                 // INTERNALDATE response
-                if (fetch.internalDate) {
+                if (fetch.isInternalDate()) {
                     response.append(" INTERNALDATE \"");
                     // TODO format properly
                     response.append(RFC822DateFormat.toString(result
@@ -127,7 +129,7 @@
                 }
 
                 // RFC822.SIZE response
-                if (fetch.size) {
+                if (fetch.isSize()) {
                     response.append(" RFC822.SIZE ");
                     response.append(result.getSize());
                 }
@@ -136,25 +138,25 @@
                         .getMimeMessage(), getLogger());
 
                 // ENVELOPE response
-                if (fetch.envelope) {
+                if (fetch.isEnvelope()) {
                     response.append(" ENVELOPE ");
                     response.append(attrs.getEnvelope());
                 }
 
                 // BODY response
-                if (fetch.body) {
+                if (fetch.isBody()) {
                     response.append(" BODY ");
                     response.append(attrs.getBodyStructure(false));
                 }
 
                 // BODYSTRUCTURE response
-                if (fetch.bodyStructure) {
+                if (fetch.isBodyStructure()) {
                     response.append(" BODYSTRUCTURE ");
                     response.append(attrs.getBodyStructure(true));
                 }
 
                 // UID response
-                if (fetch.uid) {
+                if (fetch.isUid()) {
                     response.append(" UID ");
                     response.append(result.getUid());
                 }
@@ -164,9 +166,9 @@
                 for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
                     BodyFetchElement fetchElement = (BodyFetchElement) iterator
                             .next();
-                    response.append(FetchCommand.SP);
+                    response.append(ImapConstants.SP);
                     response.append(fetchElement.getResponseName());
-                    response.append(FetchCommand.SP);
+                    response.append(ImapConstants.SP);
 
                     // Various mechanisms for returning message body.
                     String sectionSpecifier = fetchElement.getParameters();

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchRequest.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchRequest.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchRequest.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchRequest.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchRequest.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchRequest.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchRequest.java Tue Mar  6 09:59:02 2007
@@ -16,21 +16,22 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
-class FetchRequest
+
+public class FetchRequest
 {
-    boolean flags;
-    boolean uid;
-    boolean internalDate;
-    boolean size;
-    boolean envelope;
-    boolean body;
-    boolean bodyStructure;
+    private boolean flags;
+    private boolean uid;
+    private boolean internalDate;
+    private boolean size;
+    private boolean envelope;
+    private boolean body;
+    private boolean bodyStructure;
     
     private boolean setSeen = false;
     
@@ -38,6 +39,62 @@
     
     public Collection getBodyElements() {
         return bodyElements;
+    }
+
+    public boolean isBody() {
+        return body;
+    }
+
+    public void setBody(boolean body) {
+        this.body = body;
+    }
+
+    public boolean isBodyStructure() {
+        return bodyStructure;
+    }
+
+    public void setBodyStructure(boolean bodyStructure) {
+        this.bodyStructure = bodyStructure;
+    }
+
+    public boolean isEnvelope() {
+        return envelope;
+    }
+
+    public void setEnvelope(boolean envelope) {
+        this.envelope = envelope;
+    }
+
+    public boolean isFlags() {
+        return flags;
+    }
+
+    public void setFlags(boolean flags) {
+        this.flags = flags;
+    }
+
+    public boolean isInternalDate() {
+        return internalDate;
+    }
+
+    public void setInternalDate(boolean internalDate) {
+        this.internalDate = internalDate;
+    }
+
+    public boolean isSize() {
+        return size;
+    }
+
+    public void setSize(boolean size) {
+        this.size = size;
+    }
+
+    public boolean isUid() {
+        return uid;
+    }
+
+    public void setUid(boolean uid) {
+        this.uid = uid;
     }
 
     public boolean isSetSeen() {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FetchResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FetchResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -24,6 +24,7 @@
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class FetchResponseMessage extends AbstractCommandResponseMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FixedLengthInputStream.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FixedLengthInputStream.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FixedLengthInputStream.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FixedLengthInputStream.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FixedLengthInputStream.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/FixedLengthInputStream.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/FixedLengthInputStream.java Tue Mar  6 09:59:02 2007
@@ -1,4 +1,4 @@
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import java.io.FilterInputStream;
 import java.io.IOException;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdRange.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/IdRange.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdRange.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/IdRange.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdRange.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/IdRange.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdRange.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 /**
  * Represents a range of UID values.

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdSet.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/IdSet.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdSet.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/IdSet.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdSet.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/IdSet.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/IdSet.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 /**
  * @version $Revision: 109034 $

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ImapCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ImapCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ImapCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapSession;
 

Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapMessageFactory.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapMessageFactory.java?view=auto&rev=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapMessageFactory.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapMessageFactory.java Tue Mar  6 09:59:02 2007
@@ -0,0 +1,90 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/ 
+package org.apache.james.imapserver.message;
+
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.mail.internet.MimeMessage;
+import javax.mail.search.SearchTerm;
+
+import org.apache.james.imapserver.commands.ImapCommand;
+
+/**
+ * Creates messages.
+ * Implementations may support message pooling but this is not required.
+ */
+public interface ImapMessageFactory {
+
+    public ImapCommandMessage createErrorMessage(String message, String tag);
+    
+    public ImapCommandMessage createBadRequestMessage(final String message);
+    
+    public ImapCommandMessage createAppendMessage(ImapCommand command, String mailboxName, Flags flags, 
+            Date datetime, MimeMessage message, String tag); 
+    
+    public ImapCommandMessage  createAuthenticateMessage(final ImapCommand command, 
+            final String authType, final String tag);
+        
+    public ImapCommandMessage createCapabilityMessage(final ImapCommand command, final String tag);
+
+    public ImapCommandMessage  createCompleteMessage(final ImapCommand command, final boolean useUids, final String tag);
+
+    public ImapCommandMessage createCloseMessage(final ImapCommand command, final String tag);
+
+    public ImapCommandMessage createCopyMessage(final ImapCommand command, final IdRange[] idSet, final String mailboxName, 
+            final boolean useUids, final String tag);
+    
+    public ImapCommandMessage createCreateMessage(final ImapCommand command, final String mailboxName, final String tag);
+
+    public ImapCommandMessage createDeleteMessage(final ImapCommand command, final String mailboxName, final String tag);
+    
+    public ImapCommandMessage createExamineMessage(final ImapCommand command, final String mailboxName, final String tag);
+
+    public ImapCommandMessage createExpungeMessage(final ImapCommand command, final String tag);
+
+    public ImapCommandMessage createFetchMessage(final ImapCommand command, final boolean useUids, final IdRange[] idSet, 
+            final FetchRequest fetch, String tag);
+    
+    public ImapCommandMessage createListMessage(final ImapCommand command, final String referenceName, final String mailboxPattern,
+            final String tag);
+    
+    public ImapCommandMessage createLoginMessage(final ImapCommand command, final String userid, final String password, String tag);
+
+    public ImapCommandMessage createLogoutMessage(final ImapCommand command, final String tag);
+
+    public ImapCommandMessage createLsubMessage(ImapCommand command, String referenceName, String mailboxPattern, String tag);
+
+    public ImapCommandMessage createRenameMessage(final ImapCommand command, final String existingName, final String newName, 
+            final String tag);
+    
+    public ImapCommandMessage createSearchImapMessage(final ImapCommand command, final SearchTerm searchTerm, final boolean useUids,
+            final String tag);
+    
+    public ImapCommandMessage createSelectMessage(final ImapCommand command, final String mailboxName, final String tag);
+
+    public ImapCommandMessage createStatusMessage(final ImapCommand command, final String mailboxName, final StatusDataItems statusDataItems, final String tag) ;
+
+    public ImapCommandMessage createStoreMessage(final ImapCommand command, final IdRange[] idSet, final StoreDirective directive, final Flags flags, 
+         final boolean useUids, final String tag); 
+    
+    public ImapCommandMessage createSubscribeMessage(final ImapCommand command, final String mailboxName, final String tag); 
+
+    public ImapCommandMessage createUnsubscribeMessage(final ImapCommand command, final String mailboxName, final String tag);
+}

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ImapResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ImapResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ImapResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ImapResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ListCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ListCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ListCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,13 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapConstants;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.ListResult;
 import org.apache.james.mailboxmanager.MailboxManagerException;
@@ -46,7 +48,7 @@
 
         ListResult[] listResults;
 
-        String personalNamespace = ListCommand.USER_NAMESPACE + ListCommand.HIERARCHY_DELIMITER_CHAR +
+        String personalNamespace = ImapConstants.USER_NAMESPACE + ImapConstants.HIERARCHY_DELIMITER_CHAR +
         session.getUser().getUserName();
 
         if ( mailboxPattern.length() == 0 ) {
@@ -54,12 +56,12 @@
             // and root name of the referenceName argument
 
             String referenceRoot;
-            if ( referenceName.startsWith( ListCommand.NAMESPACE_PREFIX ) )
+            if ( referenceName.startsWith( ImapConstants.NAMESPACE_PREFIX ) )
             {
                 // A qualified reference name - get the first element,
                 // and don't remove the user prefix
                 removeUserPrefix = false;
-                int firstDelimiter = referenceName.indexOf( ListCommand.HIERARCHY_DELIMITER_CHAR );
+                int firstDelimiter = referenceName.indexOf( ImapConstants.HIERARCHY_DELIMITER_CHAR );
                 if ( firstDelimiter == -1 ) {
                     referenceRoot = referenceName;
                 }
@@ -76,18 +78,18 @@
 
             // Get the mailbox for the reference name.
             listResults = new ListResult[1];
-            listResults[0]=new ListResultImpl(referenceRoot,ListCommand.HIERARCHY_DELIMITER);
+            listResults[0]=new ListResultImpl(referenceRoot,ImapConstants.HIERARCHY_DELIMITER);
         }
         else {
 
             // If the mailboxPattern is fully qualified, ignore the
             // reference name.
-            if ( mailboxPattern.charAt( 0 ) == ListCommand.NAMESPACE_PREFIX_CHAR ) {
+            if ( mailboxPattern.charAt( 0 ) == ImapConstants.NAMESPACE_PREFIX_CHAR ) {
                 referenceName="";
             }
 
             // If the search pattern is relative, need to remove user prefix from results.
-            removeUserPrefix = ( (referenceName+mailboxPattern).charAt(0) != ListCommand.NAMESPACE_PREFIX_CHAR );
+            removeUserPrefix = ( (referenceName+mailboxPattern).charAt(0) != ImapConstants.NAMESPACE_PREFIX_CHAR );
 
             if (removeUserPrefix) {
                 referenceName=personalNamespace+"."+referenceName;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ListResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ListResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/ListResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/ListResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -24,6 +24,7 @@
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class ListResponseMessage extends AbstractCommandResponseMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LoginCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LoginCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LoginCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LoginCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LoginCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LoginCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LoginCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.services.User;
 

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LogoutCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LogoutCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LogoutCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class LogoutCommandMessage extends AbstractImapCommandMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LogoutResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LogoutResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LogoutResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LogoutResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,20 +16,25 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
+import org.apache.james.imapserver.ImapConstants;
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class LogoutResponseMessage extends AbstractCommandResponseMessage implements ImapCommandMessage {
 
+
+    public static final String BYE_MESSAGE = ImapConstants.VERSION + ImapConstants.SP + "Server logging out";
+    
     public LogoutResponseMessage(final ImapCommand command, final String tag) {
         super(command, tag);
     }
 
     void doEncode(ImapResponse response, ImapSession session, ImapCommand command, String tag) throws MailboxException {
-        response.byeResponse( LogoutCommand.BYE_MESSAGE );
+        response.byeResponse( BYE_MESSAGE );
         response.commandComplete( command, tag );
         // TODO: think about how this will work with SEDA
         session.closeConnection();            

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LsubListCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LsubListCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LsubListCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LsubListCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LsubListCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/LsubListCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/LsubListCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,9 +16,10 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.ListResult;
 

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/MsnRange.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/MsnRange.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/MsnRange.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/MsnRange.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/MsnRange.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/MsnRange.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/MsnRange.java Tue Mar  6 09:59:02 2007
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 /**
  * Represents a range of Message Sequence Numbers.

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/RenameCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/RenameCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/RenameCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/RenameCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/RenameCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 

Added: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchImapCommandMessage.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchImapCommandMessage.java?view=auto&rev=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchImapCommandMessage.java (added)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchImapCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -0,0 +1,77 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.imapserver.message;
+
+import javax.mail.search.SearchTerm;
+
+import org.apache.james.imapserver.AuthorizationException;
+import org.apache.james.imapserver.ImapConstants;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.MessageResult;
+import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+class SearchImapCommandMessage extends AbstractImapCommandMessage {
+    private final SearchTerm searchTerm;
+    private final boolean useUids;
+
+    public SearchImapCommandMessage(final ImapCommand command, final SearchTerm searchTerm, final boolean useUids,
+            final String tag) {
+        super(tag, command);
+        this.searchTerm = searchTerm;
+        this.useUids = useUids;
+    }
+
+    protected ImapResponseMessage doProcess(ImapSession session, String tag, ImapCommand command) throws MailboxException, AuthorizationException, ProtocolException {
+        ImapMailboxSession mailbox = session.getSelected().getMailbox();
+        final int resultCode;
+        if (useUids) {
+            resultCode= MessageResult.UID;
+        } else {
+            resultCode= MessageResult.MSN;
+        }
+        MessageResult[] messageResults;
+        try {
+            messageResults = mailbox.search(GeneralMessageSetImpl.all(),searchTerm, resultCode);
+        } catch (MailboxManagerException e) {
+          throw new MailboxException(e);
+        }
+        // TODO: probably more efficient to stream data
+        // TODO: directly to response
+        StringBuffer idList = new StringBuffer();
+        for (int i = 0; i < messageResults.length; i++) {
+            if ( i > 0 ) {
+                idList.append( ImapConstants.SP );
+            }
+            if ( useUids ) {
+                idList.append( messageResults[i].getUid());
+            } else {
+                idList.append( messageResults[i].getMsn());
+            }
+        }
+        final SearchResponseMessage result = 
+            new SearchResponseMessage(command, idList.toString(), 
+                    useUids, tag);
+        return result;
+    }
+}

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SearchResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SearchResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 
 class SearchResponseMessage extends AbstractCommandResponseMessage {

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectCommandMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectCommandMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectCommandMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectCommandMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectCommandMessage.java Tue Mar  6 09:59:02 2007
@@ -16,13 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import javax.mail.Flags;
 
 import org.apache.james.imapserver.AuthorizationException;
 import org.apache.james.imapserver.ImapSession;
 import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;

Copied: james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectResponseMessage.java (from r514100, james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectResponseMessage.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectResponseMessage.java?view=diff&rev=515230&p1=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectResponseMessage.java&r1=514100&p2=james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectResponseMessage.java&r2=515230
==============================================================================
--- james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/commands/SelectResponseMessage.java (original)
+++ james/server/sandbox/seda-imap/src/java/org/apache/james/imapserver/message/SelectResponseMessage.java Tue Mar  6 09:59:02 2007
@@ -16,12 +16,13 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imapserver.commands;
+package org.apache.james.imapserver.message;
 
 import javax.mail.Flags;
 
 import org.apache.james.imapserver.ImapResponse;
 import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.commands.ImapCommand;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MessageResult;
 



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