james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r541968 [2/2] - in /james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src: main/java/org/apache/james/api/ main/java/org/apache/james/api/imap/ main/java/org/apache/james/experimental/imapserver/ main/java/org/apache/ja...
Date Sun, 27 May 2007 09:11:13 GMT
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/DeleteCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DeleteCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/DeleteCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DeleteCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/DeleteCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DeleteCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/DeleteCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 import org.apache.james.experimental.imapserver.message.ImapMessageFactory;
 

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExamineCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ExamineCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExamineCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ExamineCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExamineCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ExamineCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExamineCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class ExamineCommandParser extends AbstractImapCommandParser  implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExpungeCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ExpungeCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExpungeCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ExpungeCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExpungeCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ExpungeCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExpungeCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 import org.apache.james.experimental.imapserver.message.ImapMessageFactory;
 

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/FetchCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/FetchCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/FetchCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/FetchCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/FetchCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/FetchCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/FetchCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,13 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
 import org.apache.james.experimental.imapserver.message.BodyFetchElement;
 import org.apache.james.experimental.imapserver.message.FetchData;
 import org.apache.james.experimental.imapserver.message.IdRange;

Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/Imap4Rev1CommandParserFactory.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/Imap4Rev1CommandParserFactory.java?view=auto&rev=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/Imap4Rev1CommandParserFactory.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/Imap4Rev1CommandParserFactory.java Sun May 27 02:11:09 2007
@@ -0,0 +1,151 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.james.api.imap.ImapConstants;
+import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.DelegatingImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.ImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.MessagingImapCommandParser;
+import org.apache.james.experimental.imapserver.message.ImapMessageFactory;
+
+/**
+ * A factory for ImapCommand instances, provided based on the command name.
+ * Command instances are created on demand, when first accessed.
+ *
+ * @version $Revision: 109034 $
+ */
+public class Imap4Rev1CommandParserFactory extends AbstractLogEnabled
+{
+    private Map _imapCommands;
+    private final ImapMessageFactory messageFactory;
+    private final Imap4Rev1CommandFactory commandFactory;
+    
+    public Imap4Rev1CommandParserFactory(final ImapMessageFactory messageFactory, final Imap4Rev1CommandFactory commandFactory)
+    {
+        this.messageFactory = messageFactory;
+        this.commandFactory = commandFactory;
+        _imapCommands = new HashMap();
+
+        // Commands valid in any state
+        // CAPABILITY, NOOP, and LOGOUT
+        _imapCommands.put( ImapConstants.CAPABILITY_COMMAND_NAME, CapabilityCommandParser.class );
+        _imapCommands.put( ImapConstants.NOOP_COMMAND_NAME, NoopCommandParser.class );
+        _imapCommands.put( ImapConstants.LOGOUT_COMMAND_NAME, LogoutCommandParser.class );
+
+        // Commands valid in NON_AUTHENTICATED state.
+        // AUTHENTICATE and LOGIN
+        _imapCommands.put( ImapConstants.AUTHENTICATE_COMMAND_NAME, AuthenticateCommandParser.class );
+        _imapCommands.put( ImapConstants.LOGIN_COMMAND_NAME, LoginCommandParser.class );
+
+        // Commands valid in AUTHENTICATED or SELECTED state.
+        // RFC2060: SELECT, EXAMINE, CREATE, DELETE, RENAME, SUBSCRIBE, UNSUBSCRIBE, LIST, LSUB, STATUS, and APPEND
+        _imapCommands.put( ImapConstants.SELECT_COMMAND_NAME, SelectCommandParser.class );
+        _imapCommands.put( ImapConstants.EXAMINE_COMMAND_NAME, ExamineCommandParser.class );
+        _imapCommands.put( ImapConstants.CREATE_COMMAND_NAME, CreateCommandParser.class );
+        _imapCommands.put( ImapConstants.DELETE_COMMAND_NAME, DeleteCommandParser.class );
+        _imapCommands.put( ImapConstants.RENAME_COMMAND_NAME, RenameCommandParser.class );
+        _imapCommands.put( ImapConstants.SUBSCRIBE_COMMAND_NAME, SubscribeCommandParser.class );
+        _imapCommands.put( ImapConstants.UNSUBSCRIBE_COMMAND_NAME, UnsubscribeCommandParser.class );
+        _imapCommands.put( ImapConstants.LIST_COMMAND_NAME, ListCommandParser.class );
+        _imapCommands.put( ImapConstants.LSUB_COMMAND_NAME, LsubCommandParser.class );
+        _imapCommands.put( ImapConstants.STATUS_COMMAND_NAME, StatusCommandParser.class );
+        _imapCommands.put( ImapConstants.APPEND_COMMAND_NAME, AppendCommandParser.class );
+
+//        // RFC2342 NAMESPACE
+//        _imapCommands.put( "NAMESPACE", NamespaceCommand.class );
+
+        // RFC2086 GETACL, SETACL, DELETEACL, LISTRIGHTS, MYRIGHTS
+//        _imapCommands.put( "GETACL", GetAclCommand.class );
+//        _imapCommands.put( "SETACL", SetAclCommand.class );
+//        _imapCommands.put( "DELETEACL", DeleteAclCommand.class );
+//        _imapCommands.put( "LISTRIGHTS", ListRightsCommand.class );
+//        _imapCommands.put( "MYRIGHTS", MyRightsCommand.class );
+
+
+        // Commands only valid in SELECTED state.
+        // CHECK, CLOSE, EXPUNGE, SEARCH, FETCH, STORE, COPY, and UID
+        _imapCommands.put( ImapConstants.CHECK_COMMAND_NAME, CheckCommandParser.class );
+        _imapCommands.put( ImapConstants.CLOSE_COMMAND_NAME, CloseCommandParser.class );
+        _imapCommands.put( ImapConstants.EXPUNGE_COMMAND_NAME, ExpungeCommandParser.class );
+        _imapCommands.put( ImapConstants.COPY_COMMAND_NAME, CopyCommandParser.class );
+        _imapCommands.put( ImapConstants.SEARCH_COMMAND_NAME, SearchCommandParser.class );
+        _imapCommands.put( ImapConstants.FETCH_COMMAND_NAME, FetchCommandParser.class );
+        _imapCommands.put( ImapConstants.STORE_COMMAND_NAME, StoreCommandParser.class );
+        _imapCommands.put( ImapConstants.UID_COMMAND_NAME, UidCommandParser.class );
+    }
+
+    public ImapCommandParser getParser( String commandName )
+    {
+        Class cmdClass = ( Class ) _imapCommands.get( commandName.toUpperCase() );
+
+        if ( cmdClass == null ) {
+            return null;
+        }
+        else {
+            return createCommand( cmdClass );
+        }
+    }
+
+    private ImapCommandParser createCommand( Class commandClass )
+    {
+        final Logger logger = getLogger(); 
+        try {
+            ImapCommandParser cmd = ( ImapCommandParser ) commandClass.newInstance();
+            initialiseParser(commandClass, logger, cmd);
+            return cmd;
+        }
+        catch ( Exception e ) {
+            if (logger.isWarnEnabled()) {
+                logger.warn("Create command instance failed: ", e);
+            }
+            // TODO: would probably be better to manage this in protocol
+            // TODO: this runtime will produce a nasty disconnect for the client
+            throw new CascadingRuntimeException( "Could not create command instance: " + commandClass.getName(), e );
+        }
+    }
+
+    protected void initialiseParser(Class commandClass, final Logger logger, ImapCommandParser cmd) {
+        setupLogger(cmd);
+        if (logger.isDebugEnabled()) {
+            logger.debug("Created command " + commandClass); 
+        }
+        
+        if ( cmd instanceof DelegatingImapCommandParser ) {
+            ( ( DelegatingImapCommandParser) cmd ).setParserFactory( this );
+        }
+        
+        if (cmd instanceof MessagingImapCommandParser) {
+            ((MessagingImapCommandParser) cmd).setMessageFactory(messageFactory);
+        }
+        
+        if (cmd instanceof InitialisableCommandFactory) {
+            ((InitialisableCommandFactory) cmd).init(commandFactory);
+        }
+    }
+
+}

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ListCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ListCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ListCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ListCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ListCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ListCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ListCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,15 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser.ATOM_CHARValidator;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 import org.apache.james.experimental.imapserver.message.ImapMessageFactory;
 class ListCommandParser extends AbstractUidCommandParser  implements InitialisableCommandFactory

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LoginCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LoginCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LoginCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LoginCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LoginCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LoginCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LoginCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class LoginCommandParser extends AbstractImapCommandParser  implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LogoutCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LogoutCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LogoutCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LogoutCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LogoutCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LogoutCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LogoutCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class LogoutCommandParser extends AbstractImapCommandParser  implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LsubCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LsubCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LsubCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LsubCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LsubCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/LsubCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LsubCommandParser.java Sun May 27 02:11:09 2007
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class LsubCommandParser extends ListCommandParser  implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/NoopCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/NoopCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/NoopCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/NoopCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/NoopCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/NoopCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/NoopCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class NoopCommandParser extends AbstractImapCommandParser  implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/RenameCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/RenameCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/RenameCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/RenameCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/RenameCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/RenameCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/RenameCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class RenameCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SearchCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SearchCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SearchCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SearchCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SearchCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SearchCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SearchCommandParser.java Sun May 27 02:11:09 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import javax.mail.Message;
 import javax.mail.search.SearchTerm;
@@ -25,6 +25,7 @@
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class SearchCommandParser extends AbstractUidCommandParser implements InitialisableCommandFactory

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SelectCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SelectCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SelectCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SelectCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SelectCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SelectCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SelectCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class SelectCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StatusCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/StatusCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StatusCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/StatusCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StatusCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/StatusCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StatusCommandParser.java Sun May 27 02:11:09 2007
@@ -16,13 +16,17 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser.CharacterValidator;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser.NoopCharValidator;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 import org.apache.james.experimental.imapserver.message.ImapMessageFactory;
 import org.apache.james.experimental.imapserver.message.StatusDataItems;

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StoreCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/StoreCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StoreCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/StoreCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StoreCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/StoreCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StoreCommandParser.java Sun May 27 02:11:09 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import javax.mail.Flags;
 
@@ -24,6 +24,9 @@
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser.NoopCharValidator;
 import org.apache.james.experimental.imapserver.message.IdRange;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 import org.apache.james.experimental.imapserver.message.StoreDirective;

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SubscribeCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SubscribeCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SubscribeCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SubscribeCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SubscribeCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/SubscribeCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SubscribeCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class SubscribeCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UidCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/UidCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UidCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/UidCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UidCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/UidCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UidCommandParser.java Sun May 27 02:11:09 2007
@@ -16,16 +16,20 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.DelegatingImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.ImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class UidCommandParser extends AbstractImapCommandParser implements DelegatingImapCommandParser,InitialisableCommandFactory {
-    private ImapCommandParserFactory parserFactory;
+    private Imap4Rev1CommandParserFactory parserFactory;
 
     public UidCommandParser() {
     }
@@ -42,14 +46,14 @@
     /**
      * @see org.apache.james.experimental.imapserver.decode.DelegatingImapCommandParser#getParserFactory()
      */
-    public ImapCommandParserFactory getParserFactory() {
+    public Imap4Rev1CommandParserFactory getParserFactory() {
         return parserFactory;
     }
 
     /**
-     * @see org.apache.james.experimental.imapserver.decode.DelegatingImapCommandParser#setParserFactory(org.apache.james.experimental.imapserver.decode.ImapCommandParserFactory)
+     * @see org.apache.james.experimental.imapserver.decode.DelegatingImapCommandParser#setParserFactory(org.apache.james.experimental.imapserver.decode.imap4rev1.Imap4Rev1CommandParserFactory)
      */
-    public void setParserFactory( ImapCommandParserFactory imapCommandFactory )
+    public void setParserFactory( Imap4Rev1CommandParserFactory imapCommandFactory )
     {
         this.parserFactory = imapCommandFactory;
     }

Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UnsubscribeCommandParser.java (from r541965, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/UnsubscribeCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UnsubscribeCommandParser.java?view=diff&rev=541968&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/UnsubscribeCommandParser.java&r1=541965&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UnsubscribeCommandParser.java&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/UnsubscribeCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UnsubscribeCommandParser.java Sun May 27 02:11:09 2007
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.experimental.imapserver.decode.imap4rev1;
 
 import org.apache.james.experimental.imapserver.ImapRequestLineReader;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;
 import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.InitialisableCommandFactory;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
 import org.apache.james.experimental.imapserver.message.ImapMessage;
 
 class UnsubscribeCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {

Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/main/DefaultImapDecoder.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/main/DefaultImapDecoder.java?view=auto&rev=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/main/DefaultImapDecoder.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/main/DefaultImapDecoder.java Sun May 27 02:11:09 2007
@@ -0,0 +1,98 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/ 
+package org.apache.james.experimental.imapserver.decode.main;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.james.experimental.imapserver.ImapDecoder;
+import org.apache.james.experimental.imapserver.ImapRequestLineReader;
+import org.apache.james.experimental.imapserver.ProtocolException;
+import org.apache.james.experimental.imapserver.commands.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.commands.imap4rev1.StandardImap4Rev1CommandFactory;
+import org.apache.james.experimental.imapserver.decode.ImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.base.AbstractImapCommandParser;
+import org.apache.james.experimental.imapserver.decode.imap4rev1.Imap4Rev1CommandParserFactory;
+import org.apache.james.experimental.imapserver.message.BaseImapMessageFactory;
+import org.apache.james.experimental.imapserver.message.ImapMessage;
+import org.apache.james.experimental.imapserver.message.ImapMessageFactory;
+
+public class DefaultImapDecoder extends AbstractLogEnabled implements ImapDecoder {
+
+    private static final String INVALID_COMMAND = "Invalid command.";
+    // TODO: inject dependency
+    private final ImapMessageFactory messageFactory = new BaseImapMessageFactory();
+    private final Imap4Rev1CommandFactory commandFactory = new StandardImap4Rev1CommandFactory();
+    private final Imap4Rev1CommandParserFactory imapCommands = new Imap4Rev1CommandParserFactory(messageFactory, commandFactory);
+    private static final String REQUEST_SYNTAX = "Protocol Error: Was expecting <tag SPACE command [arguments]>";
+
+    /**
+     * @see org.apache.avalon.framework.logger.AbstractLogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)
+     */
+    public void enableLogging(Logger logger) { 
+        super.enableLogging(logger);
+        setupLogger(imapCommands);
+    }
+    
+    public ImapMessage decode(ImapRequestLineReader request) {
+        ImapMessage message;
+        final Logger logger = getLogger(); 
+        
+        try {
+            final String tag = AbstractImapCommandParser.tag( request );    
+            message = decodeCommandTagged(request, logger, tag);
+        }
+        catch ( ProtocolException e ) {
+            logger.debug("error parsing request", e);
+            message = messageFactory.createBadRequestMessage( REQUEST_SYNTAX );
+        }
+        return message;
+    }
+
+    private ImapMessage decodeCommandTagged(final ImapRequestLineReader request, final Logger logger, final String tag) {
+        ImapMessage message;
+        if (logger.isDebugEnabled()) { 
+            logger.debug( "Got <tag>: " + tag );
+        }
+        try {
+            final String commandName = AbstractImapCommandParser.atom( request );
+            message = decodeCommandNamed(request, tag, commandName, logger);
+        }
+        catch ( ProtocolException e ) {
+            logger.debug("Error during initial request parsing", e);            
+            message = messageFactory.createErrorMessage(REQUEST_SYNTAX , tag);
+        }
+        return message;
+    }
+
+    private ImapMessage decodeCommandNamed(final ImapRequestLineReader request, 
+            final String tag, String commandName, final Logger logger) {
+        ImapMessage message;
+        if (logger.isDebugEnabled()) { 
+            logger.debug( "Got <command>: " + commandName); 
+        }
+        final ImapCommandParser command = imapCommands.getParser( commandName );
+        if ( command == null ) {
+            logger.info("Missing command implementation.");
+            message = messageFactory.createErrorMessage(INVALID_COMMAND, tag);
+        } else {
+            message = command.parse( request, tag );
+        }
+        return message;
+    }
+}

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/encode/OutputStreamImapResponseWriter.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/encode/OutputStreamImapResponseWriter.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/encode/OutputStreamImapResponseWriter.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/encode/OutputStreamImapResponseWriter.java Sun May 27 02:11:09 2007
@@ -23,7 +23,7 @@
 import java.io.PrintWriter;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponseWriter;
 import org.apache.james.util.InternetPrintWriter;
 

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/CapabilityResponse.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/CapabilityResponse.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/CapabilityResponse.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/CapabilityResponse.java Sun May 27 02:11:09 2007
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.experimental.imapserver.message.response.imap4rev1;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponse;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/LogoutResponse.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/LogoutResponse.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/LogoutResponse.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/message/response/imap4rev1/LogoutResponse.java Sun May 27 02:11:09 2007
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.experimental.imapserver.message.response.imap4rev1;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponse;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/AbstractListingProcessor.java Sun May 27 02:11:09 2007
@@ -19,8 +19,8 @@
 
 package org.apache.james.experimental.imapserver.processor.imap4rev1;
 
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/FetchProcessor.java Sun May 27 02:11:09 2007
@@ -31,9 +31,9 @@
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.core.MimeMessageWrapper;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SearchProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SearchProcessor.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SearchProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/SearchProcessor.java Sun May 27 02:11:09 2007
@@ -21,8 +21,8 @@
 
 import javax.mail.search.SearchTerm;
 
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/StatusProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/StatusProcessor.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/StatusProcessor.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/StatusProcessor.java Sun May 27 02:11:09 2007
@@ -20,8 +20,8 @@
 package org.apache.james.experimental.imapserver.processor.imap4rev1;
 
 import org.apache.avalon.framework.logger.Logger;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.AuthorizationException;
-import org.apache.james.experimental.imapserver.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.ProtocolException;
 import org.apache.james.experimental.imapserver.commands.ImapCommand;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/ImapResponseTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/ImapResponseTest.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/ImapResponseTest.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/ImapResponseTest.java Sun May 27 02:11:09 2007
@@ -23,7 +23,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponse;
 import org.apache.james.experimental.imapserver.commands.MockCommand;
 import org.apache.james.imapserver.store.MessageFlags;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/TestConstants.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/TestConstants.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/TestConstants.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/TestConstants.java Sun May 27 02:11:09 2007
@@ -1,6 +1,6 @@
 package org.apache.james.experimental.imapserver;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 
 public interface TestConstants
 {

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/BadResponseMessageTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/BadResponseMessageTest.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/BadResponseMessageTest.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/BadResponseMessageTest.java Sun May 27 02:11:09 2007
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.experimental.imapserver.message;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponse;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.MockImapResponseWriter;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/CommandFailedResponseMessageTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/CommandFailedResponseMessageTest.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/CommandFailedResponseMessageTest.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/CommandFailedResponseMessageTest.java Sun May 27 02:11:09 2007
@@ -19,7 +19,7 @@
 
 package org.apache.james.experimental.imapserver.message;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponse;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.MockImapResponseWriter;

Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/ErrorResponseMessageTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/ErrorResponseMessageTest.java?view=diff&rev=541968&r1=541967&r2=541968
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/ErrorResponseMessageTest.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/message/ErrorResponseMessageTest.java Sun May 27 02:11:09 2007
@@ -19,7 +19,7 @@
 
 package org.apache.james.experimental.imapserver.message;
 
-import org.apache.james.experimental.imapserver.ImapConstants;
+import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.experimental.imapserver.ImapResponse;
 import org.apache.james.experimental.imapserver.MockImapResponseWriter;
 import org.apache.james.experimental.imapserver.message.response.imap4rev1.ErrorResponse;



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