You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2007/05/27 19:24:31 UTC
svn commit: r542006 [1/2] - in
/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james:
experimental/imapserver/ experimental/imapserver/decode/
experimental/imapserver/decode/base/ experimental/imapserver...
Author: rdonkin
Date: Sun May 27 10:24:28 2007
New Revision: 542006
URL: http://svn.apache.org/viewvc?view=rev&rev=542006
Log:
Move decoder into final package.
Added:
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/DelegatingImapCommandParser.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DelegatingImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParser.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParserFactory.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParserFactory.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapDecoder.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapDecoder.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapRequestLineReader.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapRequestLineReader.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/InitialisableCommandFactory.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/InitialisableCommandFactory.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/MessagingImapCommandParser.java
- copied, changed from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/MessagingImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/base/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java
- copied, changed from r542000, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/base/AbstractImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AbstractUidCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AppendCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AuthenticateCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CapabilityCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CheckCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CloseCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CopyCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CreateCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/DeleteCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExamineCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExpungeCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/FetchCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/Imap4Rev1CommandParserFactory.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ListCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/LoginCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/LogoutCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/LsubCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/NoopCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/RenameCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/SearchCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/SelectCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StatusCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/StoreCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/SubscribeCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/UidCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/UnsubscribeCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/main/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/main/DefaultImapDecoder.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/decode/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/decode/imap4rev1/
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/decode/main/
Removed:
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DelegatingImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParserFactory.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapDecoder.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapRequestLineReader.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/InitialisableCommandFactory.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/MessagingImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/base/AbstractImapCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/AbstractUidCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/AppendCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/AuthenticateCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/CapabilityCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/CheckCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/CloseCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/CopyCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/CreateCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/DeleteCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExamineCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ExpungeCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/FetchCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/Imap4Rev1CommandParserFactory.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/ListCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LoginCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LogoutCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/LsubCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/NoopCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/RenameCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SearchCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SelectCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StatusCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/StoreCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/SubscribeCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UidCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/imap4rev1/UnsubscribeCommandParser.java
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/main/DefaultImapDecoder.java
Modified:
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
Modified: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java?view=diff&rev=542006&r1=542005&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java Sun May 27 10:24:28 2007
@@ -26,21 +26,36 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.james.api.imap.ImapMessage;
import org.apache.james.api.imap.ProtocolException;
-import org.apache.james.experimental.imapserver.decode.ImapDecoder;
-import org.apache.james.experimental.imapserver.decode.ImapRequestLineReader;
-import org.apache.james.experimental.imapserver.decode.main.DefaultImapDecoder;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
import org.apache.james.experimental.imapserver.encode.OutputStreamImapResponseWriter;
+import org.apache.james.experimental.imapserver.message.BaseImapMessageFactory;
import org.apache.james.experimental.imapserver.message.ImapResponseMessage;
import org.apache.james.experimental.imapserver.processor.ImapProcessor;
import org.apache.james.experimental.imapserver.processor.main.DefaultImapProcessorFactory;
+import org.apache.james.imap.command.imap4rev1.StandardImap4Rev1CommandFactory;
+import org.apache.james.imapserver.codec.decode.ImapCommandParserFactory;
+import org.apache.james.imapserver.codec.decode.ImapDecoder;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.imap4rev1.Imap4Rev1CommandParserFactory;
+import org.apache.james.imapserver.codec.decode.main.DefaultImapDecoder;
/**
* @version $Revision: 109034 $
*/
public final class ImapRequestHandler extends AbstractLogEnabled {
+ // TODO: inject dependency
+ private static final ImapDecoder createDecoder() {
+ final Imap4Rev1MessageFactory messageFactory = new BaseImapMessageFactory();
+ final Imap4Rev1CommandFactory commandFactory = new StandardImap4Rev1CommandFactory();
+ final ImapCommandParserFactory imapCommands = new Imap4Rev1CommandParserFactory(messageFactory, commandFactory);
+ final ImapDecoder result = new DefaultImapDecoder(messageFactory, imapCommands);
+ return result;
+ }
+
// TODO: inject depedency
- private final ImapDecoder decoder = new DefaultImapDecoder();
+ private final ImapDecoder decoder = createDecoder();
private final ImapProcessor processor = DefaultImapProcessorFactory.createDefaultProcessor();
/**
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/DelegatingImapCommandParser.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DelegatingImapCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/DelegatingImapCommandParser.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DelegatingImapCommandParser.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/DelegatingImapCommandParser.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/DelegatingImapCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/DelegatingImapCommandParser.java Sun May 27 10:24:28 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.imapserver.codec.decode;
public interface DelegatingImapCommandParser {
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParser.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParser.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParser.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParser.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParser.java Sun May 27 10:24:28 2007
@@ -17,7 +17,7 @@
* under the License. *
****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.imapserver.codec.decode;
import org.apache.james.api.imap.ImapMessage;
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParserFactory.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParserFactory.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParserFactory.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParserFactory.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParserFactory.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapCommandParserFactory.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapCommandParserFactory.java Sun May 27 10:24:28 2007
@@ -17,7 +17,7 @@
* under the License. *
****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.imapserver.codec.decode;
public interface ImapCommandParserFactory {
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapDecoder.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapDecoder.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapDecoder.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapDecoder.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapDecoder.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapDecoder.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapDecoder.java Sun May 27 10:24:28 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.imapserver.codec.decode;
import org.apache.james.api.imap.ImapMessage;
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapRequestLineReader.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapRequestLineReader.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapRequestLineReader.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapRequestLineReader.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapRequestLineReader.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/ImapRequestLineReader.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/ImapRequestLineReader.java Sun May 27 10:24:28 2007
@@ -17,7 +17,7 @@
* under the License. *
****************************************************************/
-package org.apache.james.experimental.imapserver.decode;
+package org.apache.james.imapserver.codec.decode;
import java.io.IOException;
import java.io.InputStream;
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/InitialisableCommandFactory.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/InitialisableCommandFactory.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/InitialisableCommandFactory.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/InitialisableCommandFactory.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/InitialisableCommandFactory.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/InitialisableCommandFactory.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/InitialisableCommandFactory.java Sun May 27 10:24:28 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.imapserver.codec.decode;
import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/MessagingImapCommandParser.java (from r541995, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/MessagingImapCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/MessagingImapCommandParser.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/MessagingImapCommandParser.java&r1=541995&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/MessagingImapCommandParser.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/MessagingImapCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/MessagingImapCommandParser.java Sun May 27 10:24:28 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.imapserver.codec.decode;
import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
Copied: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java (from r542000, james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/base/AbstractImapCommandParser.java)
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java?view=diff&rev=542006&p1=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/base/AbstractImapCommandParser.java&r1=542000&p2=james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java&r2=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/decode/base/AbstractImapCommandParser.java (original)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/base/AbstractImapCommandParser.java Sun May 27 10:24:28 2007
@@ -17,7 +17,7 @@
* under the License. *
****************************************************************/
-package org.apache.james.experimental.imapserver.decode.base;
+package org.apache.james.imapserver.codec.decode.base;
import java.text.DateFormat;
import java.text.ParseException;
@@ -34,9 +34,9 @@
import org.apache.james.api.imap.ProtocolException;
import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
import org.apache.james.api.imap.message.IdRange;
-import org.apache.james.experimental.imapserver.decode.ImapCommandParser;
-import org.apache.james.experimental.imapserver.decode.ImapRequestLineReader;
-import org.apache.james.experimental.imapserver.decode.MessagingImapCommandParser;
+import org.apache.james.imapserver.codec.decode.ImapCommandParser;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.MessagingImapCommandParser;
import org.apache.james.api.imap.message.MessageFlags;
/**
@@ -63,14 +63,14 @@
}
/**
- * @see org.apache.james.experimental.imapserver.decode.MessagingImapCommandParser#getMessageFactory()
+ * @see org.apache.james.imapserver.codec.decode.MessagingImapCommandParser#getMessageFactory()
*/
public Imap4Rev1MessageFactory getMessageFactory() {
return messageFactory;
}
/**
- * @see org.apache.james.experimental.imapserver.decode.MessagingImapCommandParser#setMessageFactory(org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory)
+ * @see org.apache.james.imapserver.codec.decode.MessagingImapCommandParser#setMessageFactory(org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory)
*/
public void setMessageFactory(Imap4Rev1MessageFactory messageFactory) {
this.messageFactory = messageFactory;
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AbstractUidCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AbstractUidCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AbstractUidCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AbstractUidCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,48 @@
+/****************************************************************
+ * 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.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+abstract class AbstractUidCommandParser extends AbstractImapCommandParser {
+
+ public AbstractUidCommandParser() {
+ }
+
+ protected ImapMessage decode(ImapCommand command,
+ ImapRequestLineReader request, String tag) throws ProtocolException {
+ final ImapMessage result = decode(command, request, tag, false);
+ return result;
+ }
+
+ public ImapMessage decode(ImapRequestLineReader request,
+ String tag, boolean useUids) throws ProtocolException {
+ final ImapCommand command = getCommand();
+ final ImapMessage result = decode(command, request, tag, useUids);
+ return result;
+ }
+
+ protected abstract ImapMessage decode(ImapCommand command,
+ ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException;
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AppendCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AppendCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AppendCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AppendCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,126 @@
+/****************************************************************
+ * 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.codec.decode.imap4rev1;
+
+import java.io.ByteArrayInputStream;
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.mail.internet.MimeMessage;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class AppendCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public AppendCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getAppend();
+ setCommand(command);
+ }
+
+ /**
+ * If the next character in the request is a '(', tries to read
+ * a "flag_list" argument from the request. If not, returns a
+ * MessageFlags with no flags set.
+ */
+ public Flags optionalAppendFlags( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ char next = request.nextWordChar();
+ if ( next == '(' ) {
+ return flagList( request );
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * If the next character in the request is a '"', tries to read
+ * a DateTime argument. If not, returns null.
+ */
+ public Date optionalDateTime( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ char next = request.nextWordChar();
+ if ( next == '"' ) {
+ return dateTime( request );
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Reads a MimeMessage encoded as a string literal from the request.
+ * TODO shouldn't need to read as a string and write out bytes
+ * use FixedLengthInputStream instead. Hopefully it can then be dynamic.
+ * @param request The Imap APPEND request
+ * @return A MimeMessage read off the request.
+ */
+ public MimeMessage mimeMessage( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ request.nextWordChar();
+ String mailString = consumeLiteral(request);
+ MimeMessage mm = null;
+
+ try {
+ byte[] messageBytes = mailString.getBytes("US-ASCII");
+ mm = new MimeMessage(null, new ByteArrayInputStream(
+ messageBytes));
+ } catch (Exception e) {
+ throw new ProtocolException("UnexpectedException: "
+ + e.getMessage(), e);
+
+ }
+ return mm;
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ String mailboxName = mailbox( request );
+ Flags flags = optionalAppendFlags( request );
+ if ( flags == null ) {
+ flags = new Flags();
+ }
+ Date datetime = optionalDateTime( request );
+ if ( datetime == null ) {
+ datetime = new Date();
+ }
+ MimeMessage message = mimeMessage( request );
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createAppendMessage(command, mailboxName,
+ flags, datetime, message, tag);
+ return result;
+ }
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AuthenticateCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AuthenticateCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AuthenticateCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/AuthenticateCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,53 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class AuthenticateCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public AuthenticateCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getAuthenticate();
+ setCommand(command);
+ }
+
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ String authType = astring( request );
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createAuthenticateMessage(command, authType, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CapabilityCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CapabilityCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CapabilityCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CapabilityCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class CapabilityCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public CapabilityCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getCapability();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createCapabilityMessage(command, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CheckCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CheckCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CheckCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CheckCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,49 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class CheckCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public CheckCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getCheck();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ endLine( request );
+ final ImapMessage result = getMessageFactory().createCheckMessage(command, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CloseCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CloseCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CloseCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CloseCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class CloseCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public CloseCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getClose();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createCloseMessage(command, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CopyCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CopyCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CopyCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CopyCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.message.IdRange;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+
+class CopyCommandParser extends AbstractUidCommandParser implements InitialisableCommandFactory {
+
+ public CopyCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getCopy();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command,
+ ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException {
+ IdRange[] idSet = parseIdRange( request );
+ String mailboxName = mailbox( request );
+ endLine( request );
+ final ImapMessage result = getMessageFactory().createCopyMessage(command, idSet, mailboxName, useUids, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CreateCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CreateCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CreateCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/CreateCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,53 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class CreateCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public CreateCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getCreate();
+ setCommand(command);
+ }
+
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ String mailboxName = mailbox( request );
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createCreateMessage(command, mailboxName, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/DeleteCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/DeleteCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/DeleteCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/DeleteCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class DeleteCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public DeleteCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getDelete();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ String mailboxName = mailbox( request );
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createDeleteMessage( command, mailboxName, tag );
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExamineCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExamineCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExamineCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExamineCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class ExamineCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public ExamineCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getExamine();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ final String mailboxName = mailbox( request );
+ endLine( request );
+ final ImapMessage result = getMessageFactory().createExamineMessage(command, mailboxName, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExpungeCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExpungeCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExpungeCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/ExpungeCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.imapserver.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+import org.apache.james.imapserver.codec.decode.base.AbstractImapCommandParser;
+
+class ExpungeCommandParser extends AbstractImapCommandParser implements InitialisableCommandFactory {
+
+ public ExpungeCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getExpunge();
+ setCommand(command);
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag) throws ProtocolException {
+ endLine( request );
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createExpungeMessage(command, tag);
+ return result;
+ }
+
+}
Added: james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/FetchCommandParser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/FetchCommandParser.java?view=auto&rev=542006
==============================================================================
--- james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/FetchCommandParser.java (added)
+++ james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/imapserver/codec/decode/imap4rev1/FetchCommandParser.java Sun May 27 10:24:28 2007
@@ -0,0 +1,185 @@
+/****************************************************************
+ * 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.codec.decode.imap4rev1;
+
+import org.apache.james.api.imap.ImapCommand;
+import org.apache.james.api.imap.ImapMessage;
+import org.apache.james.api.imap.ProtocolException;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import org.apache.james.api.imap.message.BodyFetchElement;
+import org.apache.james.api.imap.message.FetchData;
+import org.apache.james.api.imap.message.IdRange;
+import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
+import org.apache.james.imapserver.codec.decode.InitialisableCommandFactory;
+
+class FetchCommandParser extends AbstractUidCommandParser implements InitialisableCommandFactory
+{
+ public FetchCommandParser() {
+ }
+
+ /**
+ * @see org.apache.james.imapserver.codec.decode.InitialisableCommandFactory#init(org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory)
+ */
+ public void init(Imap4Rev1CommandFactory factory)
+ {
+ final ImapCommand command = factory.getFetch();
+ setCommand(command);
+ }
+
+ public FetchData fetchRequest( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ FetchData fetch = new FetchData();
+
+ char next = nextNonSpaceChar( request );
+ if (request.nextChar() == '(') {
+ consumeChar( request, '(' );
+
+ next = nextNonSpaceChar( request );
+ while ( next != ')' ) {
+ addNextElement( request, fetch );
+ next = nextNonSpaceChar( request );
+ }
+ consumeChar(request, ')');
+ } else {
+ addNextElement( request, fetch );
+
+ }
+
+ return fetch;
+ }
+
+ private void addNextElement( ImapRequestLineReader command, FetchData fetch)
+ throws ProtocolException
+ {
+ /*char next = nextCharInLine( command );
+ StringBuffer element = new StringBuffer();
+ while ( next != ' ' && next != '[' && next != ')' && next!='\n' && next!='\r' ) {
+ element.append(next);
+ command.consume();
+ next = nextCharInLine( command );
+ }*/
+
+
+ //String name = element.toString();
+ String name = readWord(command, " [)\r\n");
+ char next = command.nextChar();
+ // Simple elements with no '[]' parameters.
+ //if ( next == ' ' || next == ')' || next == '\n' || next == '\r') {
+ if (next != '[') {
+ if ( "FAST".equalsIgnoreCase( name ) ) {
+ fetch.setFlags(true);
+ fetch.setInternalDate(true);
+ fetch.setSize(true);
+ } else if ("FULL".equalsIgnoreCase(name)) {
+ fetch.setFlags(true);
+ fetch.setInternalDate(true);
+ fetch.setSize(true);
+ fetch.setEnvelope(true);
+ fetch.setBody(true);
+ } else if ("ALL".equalsIgnoreCase(name)) {
+ fetch.setFlags(true);
+ fetch.setInternalDate(true);
+ fetch.setSize(true);
+ fetch.setEnvelope(true);
+ } else if ("FLAGS".equalsIgnoreCase(name)) {
+ fetch.setFlags(true);
+ } else if ("RFC822.SIZE".equalsIgnoreCase(name)) {
+ fetch.setSize(true);
+ } else if ("ENVELOPE".equalsIgnoreCase(name)) {
+ fetch.setEnvelope(true);
+ } else if ("INTERNALDATE".equalsIgnoreCase(name)) {
+ fetch.setInternalDate(true);
+ } else if ("BODY".equalsIgnoreCase(name)) {
+ fetch.setBody(true);
+ } else if ("BODYSTRUCTURE".equalsIgnoreCase(name)) {
+ fetch.setBodyStructure(true);
+ } else if ("UID".equalsIgnoreCase(name)) {
+ fetch.setUid(true);
+ } else if ("RFC822".equalsIgnoreCase(name)) {
+ fetch.add(new BodyFetchElement("RFC822", ""), false);
+ } else if ("RFC822.HEADER".equalsIgnoreCase(name)) {
+ fetch.add(new BodyFetchElement("RFC822.HEADER", "HEADER"), true);
+ } else if ("RFC822.TEXT".equalsIgnoreCase(name)) {
+ fetch.add(new BodyFetchElement("RFC822.TEXT", "TEXT"), false);
+ } else {
+ throw new ProtocolException( "Invalid fetch attribute: " + name );
+ }
+ }
+ else {
+ consumeChar( command, '[' );
+
+
+ String parameter = readWord(command, "]");
+
+ consumeChar( command, ']');
+ if ( "BODY".equalsIgnoreCase( name ) ) {
+ fetch.add(new BodyFetchElement("BODY[" + parameter + "]", parameter), false);
+ } else if ( "BODY.PEEK".equalsIgnoreCase( name ) ) {
+ fetch.add(new BodyFetchElement("BODY[" + parameter + "]", parameter), true);
+ } else {
+ throw new ProtocolException( "Invalid fetch attibute: " + name + "[]" );
+ }
+ }
+ }
+
+ private String readWord(ImapRequestLineReader request, String terminator) throws ProtocolException {
+ StringBuffer buf = new StringBuffer();
+ char next = request.nextChar();
+ while(terminator.indexOf(next)==-1) {
+ buf.append(next);
+ request.consume();
+ next = request.nextChar();
+ }
+ return buf.toString();
+ }
+
+ private char nextCharInLine( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ char next = request.nextChar();
+ if ( next == '\r' || next == '\n' ) {
+ throw new ProtocolException( "Unexpected end of line." );
+ }
+ return next;
+ }
+
+ private char nextNonSpaceChar( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ char next = request.nextChar();
+ while ( next == ' ' ) {
+ request.consume();
+ next = request.nextChar();
+ }
+ return next;
+ }
+
+ protected ImapMessage decode(ImapCommand command, ImapRequestLineReader request, String tag, boolean useUids) throws ProtocolException {
+ IdRange[] idSet = parseIdRange( request );
+ FetchData fetch = fetchRequest( request );
+ endLine( request );
+
+ final Imap4Rev1MessageFactory factory = getMessageFactory();
+ final ImapMessage result = factory.createFetchMessage(command, useUids, idSet, fetch, tag);
+ return result;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org