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 bt...@apache.org on 2019/12/13 02:39:29 UTC
[james-project] 13/27: PROTOCOLS-120 StatusResponseFactory should
be immutable in parsers
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit a1df5a2d1ac16ba6a10ed26406543835f9b4ef4f
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Dec 6 15:39:58 2019 +0700
PROTOCOLS-120 StatusResponseFactory should be immutable in parsers
---
.../imap/decode/MessagingImapCommandParser.java | 28 ------
.../decode/base/AbstractImapCommandParser.java | 19 +---
.../parser/AbstractMessageRangeCommandParser.java | 5 +-
.../parser/AbstractSelectionCommandParser.java | 5 +-
.../decode/parser/AbstractUidCommandParser.java | 5 +-
.../imap/decode/parser/AppendCommandParser.java | 5 +-
.../decode/parser/AuthenticateCommandParser.java | 5 +-
.../decode/parser/CapabilityCommandParser.java | 5 +-
.../imap/decode/parser/CheckCommandParser.java | 5 +-
.../imap/decode/parser/CloseCommandParser.java | 5 +-
.../imap/decode/parser/CompressCommandParser.java | 5 +-
.../imap/decode/parser/CopyCommandParser.java | 5 +-
.../imap/decode/parser/CreateCommandParser.java | 5 +-
.../imap/decode/parser/DeleteACLCommandParser.java | 5 +-
.../imap/decode/parser/DeleteCommandParser.java | 5 +-
.../imap/decode/parser/EnableCommandParser.java | 5 +-
.../imap/decode/parser/ExamineCommandParser.java | 5 +-
.../imap/decode/parser/ExpungeCommandParser.java | 5 +-
.../imap/decode/parser/FetchCommandParser.java | 5 +-
.../imap/decode/parser/GetACLCommandParser.java | 5 +-
.../decode/parser/GetAnnotationCommandParser.java | 5 +-
.../imap/decode/parser/GetQuotaCommandParser.java | 5 +-
.../decode/parser/GetQuotaRootCommandParser.java | 5 +-
.../imap/decode/parser/IdleCommandParser.java | 5 +-
.../imap/decode/parser/ImapParserFactory.java | 106 +++++++++------------
.../imap/decode/parser/ListCommandParser.java | 9 +-
.../decode/parser/ListRightsCommandParser.java | 5 +-
.../imap/decode/parser/LoginCommandParser.java | 5 +-
.../imap/decode/parser/LogoutCommandParser.java | 5 +-
.../imap/decode/parser/LsubCommandParser.java | 5 +-
.../imap/decode/parser/MoveCommandParser.java | 5 +-
.../imap/decode/parser/MyRightsCommandParser.java | 5 +-
.../imap/decode/parser/NamespaceCommandParser.java | 5 +-
.../imap/decode/parser/NoopCommandParser.java | 5 +-
.../imap/decode/parser/RenameCommandParser.java | 5 +-
.../imap/decode/parser/SearchCommandParser.java | 7 +-
.../imap/decode/parser/SelectCommandParser.java | 8 +-
.../imap/decode/parser/SetACLCommandParser.java | 5 +-
.../decode/parser/SetAnnotationCommandParser.java | 5 +-
.../imap/decode/parser/SetQuotaCommandParser.java | 5 +-
.../imap/decode/parser/StartTLSCommandParser.java | 5 +-
.../imap/decode/parser/StatusCommandParser.java | 5 +-
.../imap/decode/parser/StoreCommandParser.java | 5 +-
.../imap/decode/parser/SubscribeCommandParser.java | 5 +-
.../james/imap/decode/parser/UidCommandParser.java | 5 +-
.../imap/decode/parser/UnselectCommandParser.java | 5 +-
.../decode/parser/UnsubscribeCommandParser.java | 5 +-
.../imap/decode/parser/XListCommandParser.java | 5 +-
.../james/imap/decode/parser/CopyParserTest.java | 4 +-
.../decode/parser/CreateCommandParserTest.java | 4 +-
.../parser/FetchCommandParserPartialFetchTest.java | 3 +-
.../parser/GetAnnotationCommandParserTest.java | 4 +-
.../imap/decode/parser/GetQuotaParserTest.java | 4 +-
.../imap/decode/parser/GetQuotaRootParserTest.java | 6 +-
.../james/imap/decode/parser/MoveParserTest.java | 4 +-
.../SearchCommandParserAndParenthesesTest.java | 5 +-
.../parser/SearchCommandParserCharsetTest.java | 6 +-
.../decode/parser/SearchCommandParserNotTest.java | 4 +-
.../decode/parser/SearchCommandParserOrTest.java | 4 +-
.../SearchCommandParserQuotedCharsetTest.java | 6 +-
...earchCommandParserSearchKeySequenceSetTest.java | 4 +-
.../parser/SearchCommandParserSearchKeyTest.java | 4 +-
.../parser/SearchCommandParserTopLevelAndTest.java | 4 +-
.../parser/SetAnnotationCommandParserTest.java | 4 +-
.../decode/parser/SetQuotaCommandParserTest.java | 4 +-
.../imap/decode/parser/StoreCommandParserTest.java | 3 +-
66 files changed, 237 insertions(+), 227 deletions(-)
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/MessagingImapCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/MessagingImapCommandParser.java
deleted file mode 100644
index 5040ad2..0000000
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/MessagingImapCommandParser.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.imap.decode;
-
-import org.apache.james.imap.api.message.response.StatusResponseFactory;
-
-public interface MessagingImapCommandParser extends ImapCommandParser {
-
- StatusResponseFactory getStatusResponseFactory();
-
- void setStatusResponseFactory(StatusResponseFactory statusResponseFactory);
-}
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java
index e4f62af..46466f5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/base/AbstractImapCommandParser.java
@@ -26,8 +26,8 @@ import org.apache.james.imap.api.display.HumanReadableText;
import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
+import org.apache.james.imap.decode.ImapCommandParser;
import org.apache.james.imap.decode.ImapRequestLineReader;
-import org.apache.james.imap.decode.MessagingImapCommandParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,32 +36,23 @@ import org.slf4j.LoggerFactory;
* <strong>Note:</strong>
* </p>
*/
-public abstract class AbstractImapCommandParser implements MessagingImapCommandParser {
+public abstract class AbstractImapCommandParser implements ImapCommandParser {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractImapCommandParser.class);
private final ImapCommand command;
- private StatusResponseFactory statusResponseFactory;
+ protected final StatusResponseFactory statusResponseFactory;
- public AbstractImapCommandParser(ImapCommand command) {
+ public AbstractImapCommandParser(ImapCommand command, StatusResponseFactory statusResponseFactory) {
this.command = command;
+ this.statusResponseFactory = statusResponseFactory;
}
public ImapCommand getCommand() {
return command;
}
- @Override
- public final StatusResponseFactory getStatusResponseFactory() {
- return statusResponseFactory;
- }
-
- @Override
- public final void setStatusResponseFactory(StatusResponseFactory statusResponseFactory) {
- this.statusResponseFactory = statusResponseFactory;
- }
-
/**
* Parses a request into a command message for later processing.
*
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractMessageRangeCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractMessageRangeCommandParser.java
index 1a364c0..8d44469 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractMessageRangeCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractMessageRangeCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -30,8 +31,8 @@ import org.apache.james.imap.message.request.AbstractMessageRangeRequest;
public abstract class AbstractMessageRangeCommandParser extends AbstractUidCommandParser {
- public AbstractMessageRangeCommandParser(ImapCommand command) {
- super(command);
+ public AbstractMessageRangeCommandParser(ImapCommand command, StatusResponseFactory statusResponseFactory) {
+ super(command, statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
index 4224e5a..5ec332a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractSelectionCommandParser.java
@@ -25,6 +25,7 @@ import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -37,8 +38,8 @@ public abstract class AbstractSelectionCommandParser extends AbstractImapCommand
private static final byte[] CONDSTORE = ImapConstants.SUPPORTS_CONDSTORE.asString().getBytes();
private static final byte[] QRESYNC = ImapConstants.SUPPORTS_QRESYNC.asString().getBytes();
- public AbstractSelectionCommandParser(ImapCommand command) {
- super(command);
+ public AbstractSelectionCommandParser(ImapCommand command, StatusResponseFactory statusResponseFactory) {
+ super(command, statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractUidCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractUidCommandParser.java
index 82d94a6..c496f00 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractUidCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AbstractUidCommandParser.java
@@ -22,6 +22,7 @@ package org.apache.james.imap.decode.parser;
import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -29,8 +30,8 @@ import org.apache.james.imap.decode.base.AbstractImapCommandParser;
abstract class AbstractUidCommandParser extends AbstractImapCommandParser {
- public AbstractUidCommandParser(ImapCommand command) {
- super(command);
+ public AbstractUidCommandParser(ImapCommand command, StatusResponseFactory statusResponseFactory) {
+ super(command, statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AppendCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AppendCommandParser.java
index 2fbfc63..bbf8ffc 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AppendCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AppendCommandParser.java
@@ -28,6 +28,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -39,8 +40,8 @@ import org.apache.james.imap.message.request.AppendRequest;
*/
public class AppendCommandParser extends AbstractImapCommandParser {
- public AppendCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.APPEND_COMMAND_NAME));
+ public AppendCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.APPEND_COMMAND_NAME), statusResponseFactory);
}
/**
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AuthenticateCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AuthenticateCommandParser.java
index 0f79b95..3985c75 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AuthenticateCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/AuthenticateCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.IRAuthenticateRequest;
*/
public class AuthenticateCommandParser extends AbstractImapCommandParser {
- public AuthenticateCommandParser() {
- super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.AUTHENTICATE_COMMAND_NAME));
+ public AuthenticateCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.AUTHENTICATE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CapabilityCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CapabilityCommandParser.java
index 0dc4e3f..1e0d820 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CapabilityCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CapabilityCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.CapabilityRequest;
*/
public class CapabilityCommandParser extends AbstractImapCommandParser {
- public CapabilityCommandParser() {
- super(ImapCommand.anyStateCommand(ImapConstants.CAPABILITY_COMMAND_NAME));
+ public CapabilityCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.anyStateCommand(ImapConstants.CAPABILITY_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CheckCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CheckCommandParser.java
index 6cd6238..81b8b44 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CheckCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CheckCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.CheckRequest;
*/
public class CheckCommandParser extends AbstractImapCommandParser {
- public CheckCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.CHECK_COMMAND_NAME));
+ public CheckCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.CHECK_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CloseCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CloseCommandParser.java
index b5bd60c..3246a53 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CloseCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CloseCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.CloseRequest;
*/
class CloseCommandParser extends AbstractImapCommandParser {
- public CloseCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.CLOSE_COMMAND_NAME));
+ public CloseCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.CLOSE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CompressCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CompressCommandParser.java
index 9809182..b7d66fe 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CompressCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CompressCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -30,8 +31,8 @@ import org.apache.james.imap.message.request.CompressRequest;
public class CompressCommandParser extends AbstractImapCommandParser {
- public CompressCommandParser() {
- super(ImapCommand.anyStateCommand(ImapConstants.COMPRESS_COMMAND_NAME));
+ public CompressCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.anyStateCommand(ImapConstants.COMPRESS_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CopyCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CopyCommandParser.java
index 9431a07..c84e0a8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CopyCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CopyCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.message.request.CopyRequest;
/**
@@ -29,8 +30,8 @@ import org.apache.james.imap.message.request.CopyRequest;
*/
public class CopyCommandParser extends AbstractMessageRangeCommandParser {
- public CopyCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.COPY_COMMAND_NAME));
+ public CopyCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.COPY_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CreateCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CreateCommandParser.java
index 350f65f..894fc81 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CreateCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/CreateCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -38,8 +39,8 @@ import com.google.common.base.Strings;
*/
public class CreateCommandParser extends AbstractImapCommandParser {
- public CreateCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.CREATE_COMMAND_NAME));
+ public CreateCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.CREATE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java
index 9d4497d..f7d16d1 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteACLCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.DeleteACLRequest;
*/
public class DeleteACLCommandParser extends AbstractImapCommandParser {
- public DeleteACLCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.DELETEACL_COMMAND_NAME));
+ public DeleteACLCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.DELETEACL_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteCommandParser.java
index 3adac5f..6fc1a64 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/DeleteCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.DeleteRequest;
*/
public class DeleteCommandParser extends AbstractImapCommandParser {
- public DeleteCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.DELETE_COMMAND_NAME));
+ public DeleteCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.DELETE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/EnableCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/EnableCommandParser.java
index 256713a..555a0b7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/EnableCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/EnableCommandParser.java
@@ -26,6 +26,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.Capability;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.EnableRequest;
public class EnableCommandParser extends AbstractImapCommandParser {
- public EnableCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.ENABLE_COMMAND_NAME));
+ public EnableCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.ENABLE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExamineCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExamineCommandParser.java
index 233b488..7bd0809 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExamineCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExamineCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.message.request.AbstractMailboxSelectionRequest;
import org.apache.james.imap.message.request.ExamineRequest;
@@ -31,8 +32,8 @@ import org.apache.james.imap.message.request.ExamineRequest;
*/
public class ExamineCommandParser extends AbstractSelectionCommandParser {
- public ExamineCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.EXAMINE_COMMAND_NAME));
+ public ExamineCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.EXAMINE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExpungeCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExpungeCommandParser.java
index a506e35..3d7f70d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExpungeCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ExpungeCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.ExpungeRequest;
*/
public class ExpungeCommandParser extends AbstractUidCommandParser {
- public ExpungeCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.EXPUNGE_COMMAND_NAME));
+ public ExpungeCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.EXPUNGE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
index d0573e3..4d5b616 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
@@ -38,6 +38,7 @@ import org.apache.james.imap.api.message.BodyFetchElement;
import org.apache.james.imap.api.message.FetchData;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.SectionType;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.FetchPartPathDecoder;
@@ -52,8 +53,8 @@ public class FetchCommandParser extends AbstractUidCommandParser {
private static final byte[] CHANGEDSINCE = "CHANGEDSINCE".getBytes();
private static final byte[] VANISHED = "VANISHED".getBytes();
- public FetchCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.FETCH_COMMAND_NAME));
+ public FetchCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.FETCH_COMMAND_NAME), statusResponseFactory);
}
/**
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetACLCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetACLCommandParser.java
index b84777e..cc698c0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetACLCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetACLCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.GetACLRequest;
*/
public class GetACLCommandParser extends AbstractImapCommandParser {
- public GetACLCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.GETACL_COMMAND_NAME));
+ public GetACLCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.GETACL_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParser.java
index 2e462d5..afda91d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParser.java
@@ -26,6 +26,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -44,8 +45,8 @@ public class GetAnnotationCommandParser extends AbstractImapCommandParser {
private static final String DEPTH = "DEPTH";
private static final boolean STOP_ON_PAREN = true;
- public GetAnnotationCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.GETANNOTATION_COMMAND_NAME));
+ public GetAnnotationCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.GETANNOTATION_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaCommandParser.java
index 8a240bb..a7717e7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.GetQuotaRequest;
* GETQUOTA command parser
*/
public class GetQuotaCommandParser extends AbstractImapCommandParser {
- public GetQuotaCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.GETQUOTA_COMMAND_NAME));
+ public GetQuotaCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.GETQUOTA_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaRootCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaRootCommandParser.java
index 64d3a99..2f4d276 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaRootCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/GetQuotaRootCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.GetQuotaRootRequest;
*/
public class GetQuotaRootCommandParser extends AbstractImapCommandParser {
- public GetQuotaRootCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.GETQUOTAROOT_COMMAND_NAME));
+ public GetQuotaRootCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.GETQUOTAROOT_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/IdleCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/IdleCommandParser.java
index 4171059..1b6835f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/IdleCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/IdleCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.IdleRequest;
*/
public class IdleCommandParser extends AbstractImapCommandParser {
- public IdleCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.IDLE_COMMAND_NAME));
+ public IdleCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.IDLE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java
index 3d2be5e..0d02fc0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java
@@ -27,7 +27,6 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.ImapCommandParser;
import org.apache.james.imap.decode.ImapCommandParserFactory;
-import org.apache.james.imap.decode.MessagingImapCommandParser;
/**
* A factory for ImapCommand instances, provided based on the command name.
@@ -36,99 +35,82 @@ import org.apache.james.imap.decode.MessagingImapCommandParser;
public class ImapParserFactory implements ImapCommandParserFactory {
private final Map<String, ImapCommandParser> imapCommands;
- private final StatusResponseFactory statusResponseFactory;
-
public ImapParserFactory(StatusResponseFactory statusResponseFactory) {
- this.statusResponseFactory = statusResponseFactory;
imapCommands = new HashMap<>();
// Commands valid in any state
// CAPABILITY, NOOP, and LOGOUT
- imapCommands.put(ImapConstants.CAPABILITY_COMMAND_NAME, new CapabilityCommandParser());
- imapCommands.put(ImapConstants.NOOP_COMMAND_NAME, new NoopCommandParser());
- imapCommands.put(ImapConstants.LOGOUT_COMMAND_NAME, new LogoutCommandParser());
+ imapCommands.put(ImapConstants.CAPABILITY_COMMAND_NAME, new CapabilityCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.NOOP_COMMAND_NAME, new NoopCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.LOGOUT_COMMAND_NAME, new LogoutCommandParser(statusResponseFactory));
// Commands valid in NON_AUTHENTICATED state.
// AUTHENTICATE and LOGIN
- imapCommands.put(ImapConstants.AUTHENTICATE_COMMAND_NAME, new AuthenticateCommandParser());
- imapCommands.put(ImapConstants.LOGIN_COMMAND_NAME, new LoginCommandParser());
+ imapCommands.put(ImapConstants.AUTHENTICATE_COMMAND_NAME, new AuthenticateCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.LOGIN_COMMAND_NAME, new LoginCommandParser(statusResponseFactory));
// 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, new SelectCommandParser());
- imapCommands.put(ImapConstants.EXAMINE_COMMAND_NAME, new ExamineCommandParser());
- imapCommands.put(ImapConstants.CREATE_COMMAND_NAME, new CreateCommandParser());
- imapCommands.put(ImapConstants.DELETE_COMMAND_NAME, new DeleteCommandParser());
- imapCommands.put(ImapConstants.RENAME_COMMAND_NAME, new RenameCommandParser());
- imapCommands.put(ImapConstants.SUBSCRIBE_COMMAND_NAME, new SubscribeCommandParser());
- imapCommands.put(ImapConstants.UNSUBSCRIBE_COMMAND_NAME, new UnsubscribeCommandParser());
- imapCommands.put(ImapConstants.LIST_COMMAND_NAME, new ListCommandParser());
- imapCommands.put(ImapConstants.XLIST_COMMAND_NAME, new XListCommandParser());
- imapCommands.put(ImapConstants.LSUB_COMMAND_NAME, new LsubCommandParser());
- imapCommands.put(ImapConstants.STATUS_COMMAND_NAME, new StatusCommandParser());
- imapCommands.put(ImapConstants.APPEND_COMMAND_NAME,new AppendCommandParser());
+ imapCommands.put(ImapConstants.SELECT_COMMAND_NAME, new SelectCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.EXAMINE_COMMAND_NAME, new ExamineCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.CREATE_COMMAND_NAME, new CreateCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.DELETE_COMMAND_NAME, new DeleteCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.RENAME_COMMAND_NAME, new RenameCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.SUBSCRIBE_COMMAND_NAME, new SubscribeCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.UNSUBSCRIBE_COMMAND_NAME, new UnsubscribeCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.LIST_COMMAND_NAME, new ListCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.XLIST_COMMAND_NAME, new XListCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.LSUB_COMMAND_NAME, new LsubCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.STATUS_COMMAND_NAME, new StatusCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.APPEND_COMMAND_NAME, new AppendCommandParser(statusResponseFactory));
// RFC2342 NAMESPACE
- imapCommands.put(ImapConstants.NAMESPACE_COMMAND_NAME, new NamespaceCommandParser());
+ imapCommands.put(ImapConstants.NAMESPACE_COMMAND_NAME, new NamespaceCommandParser(statusResponseFactory));
// RFC4314 GETACL, SETACL, DELETEACL, LISTRIGHTS, MYRIGHTS
- imapCommands.put(ImapConstants.GETACL_COMMAND_NAME, new GetACLCommandParser());
- imapCommands.put(ImapConstants.SETACL_COMMAND_NAME, new SetACLCommandParser());
- imapCommands.put(ImapConstants.DELETEACL_COMMAND_NAME, new DeleteACLCommandParser());
- imapCommands.put(ImapConstants.LISTRIGHTS_COMMAND_NAME, new ListRightsCommandParser());
- imapCommands.put(ImapConstants.MYRIGHTS_COMMAND_NAME, new MyRightsCommandParser());
+ imapCommands.put(ImapConstants.GETACL_COMMAND_NAME, new GetACLCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.SETACL_COMMAND_NAME, new SetACLCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.DELETEACL_COMMAND_NAME, new DeleteACLCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.LISTRIGHTS_COMMAND_NAME, new ListRightsCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.MYRIGHTS_COMMAND_NAME, new MyRightsCommandParser(statusResponseFactory));
// Commands only valid in SELECTED state.
// CHECK, CLOSE, EXPUNGE, SEARCH, FETCH, STORE, COPY, UID and IDLE
- imapCommands.put(ImapConstants.CHECK_COMMAND_NAME, new CheckCommandParser());
- imapCommands.put(ImapConstants.CLOSE_COMMAND_NAME, new CloseCommandParser());
- imapCommands.put(ImapConstants.EXPUNGE_COMMAND_NAME, new ExpungeCommandParser());
- imapCommands.put(ImapConstants.COPY_COMMAND_NAME, new CopyCommandParser());
- imapCommands.put(ImapConstants.MOVE_COMMAND_NAME, new MoveCommandParser());
- imapCommands.put(ImapConstants.SEARCH_COMMAND_NAME, new SearchCommandParser());
- imapCommands.put(ImapConstants.FETCH_COMMAND_NAME, new FetchCommandParser());
- imapCommands.put(ImapConstants.STORE_COMMAND_NAME, new StoreCommandParser());
- imapCommands.put(ImapConstants.UID_COMMAND_NAME, new UidCommandParser(this));
- imapCommands.put(ImapConstants.IDLE_COMMAND_NAME, new IdleCommandParser());
- imapCommands.put(ImapConstants.STARTTLS, new StartTLSCommandParser());
+ imapCommands.put(ImapConstants.CHECK_COMMAND_NAME, new CheckCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.CLOSE_COMMAND_NAME, new CloseCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.EXPUNGE_COMMAND_NAME, new ExpungeCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.COPY_COMMAND_NAME, new CopyCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.MOVE_COMMAND_NAME, new MoveCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.SEARCH_COMMAND_NAME, new SearchCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.FETCH_COMMAND_NAME, new FetchCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.STORE_COMMAND_NAME, new StoreCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.UID_COMMAND_NAME, new UidCommandParser(this, statusResponseFactory));
+ imapCommands.put(ImapConstants.IDLE_COMMAND_NAME, new IdleCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.STARTTLS, new StartTLSCommandParser(statusResponseFactory));
// RFC3691
- imapCommands.put(ImapConstants.UNSELECT_COMMAND_NAME, new UnselectCommandParser());
+ imapCommands.put(ImapConstants.UNSELECT_COMMAND_NAME, new UnselectCommandParser(statusResponseFactory));
// RFC4978
- imapCommands.put(ImapConstants.COMPRESS_COMMAND_NAME, new CompressCommandParser());
-
- imapCommands.put(ImapConstants.ENABLE_COMMAND_NAME, new EnableCommandParser());
+ imapCommands.put(ImapConstants.COMPRESS_COMMAND_NAME, new CompressCommandParser(statusResponseFactory));
+
+ imapCommands.put(ImapConstants.ENABLE_COMMAND_NAME, new EnableCommandParser(statusResponseFactory));
// RFC2087
// GETQUOTAROOT, GETQUOTA, SETQUOTA
- imapCommands.put(ImapConstants.GETQUOTAROOT_COMMAND_NAME, new GetQuotaRootCommandParser());
- imapCommands.put(ImapConstants.GETQUOTA_COMMAND_NAME, new GetQuotaCommandParser());
- imapCommands.put(ImapConstants.SETQUOTA_COMMAND_NAME, new SetQuotaCommandParser());
+ imapCommands.put(ImapConstants.GETQUOTAROOT_COMMAND_NAME, new GetQuotaRootCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.GETQUOTA_COMMAND_NAME, new GetQuotaCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.SETQUOTA_COMMAND_NAME, new SetQuotaCommandParser(statusResponseFactory));
//RFC5464
//SETMETADATA, GETMETADATA
- imapCommands.put(ImapConstants.SETANNOTATION_COMMAND_NAME, new SetAnnotationCommandParser());
- imapCommands.put(ImapConstants.GETANNOTATION_COMMAND_NAME, new GetAnnotationCommandParser());
+ imapCommands.put(ImapConstants.SETANNOTATION_COMMAND_NAME, new SetAnnotationCommandParser(statusResponseFactory));
+ imapCommands.put(ImapConstants.GETANNOTATION_COMMAND_NAME, new GetAnnotationCommandParser(statusResponseFactory));
}
@Override
public ImapCommandParser getParser(String commandName) {
- ImapCommandParser parser = imapCommands.get(commandName.toUpperCase(Locale.US));
-
- if (parser == null) {
- return null;
- } else {
- initialiseParser(parser);
- return parser;
- }
- }
-
- private void initialiseParser(ImapCommandParser cmd) {
- if (cmd instanceof MessagingImapCommandParser) {
- final MessagingImapCommandParser messagingImapCommandParser = (MessagingImapCommandParser) cmd;
- messagingImapCommandParser.setStatusResponseFactory(statusResponseFactory);
- }
+ return imapCommands.get(commandName.toUpperCase(Locale.US));
}
}
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java
index e97eb96..8cad84f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,12 +34,12 @@ import org.apache.james.imap.message.request.ListRequest;
*/
public class ListCommandParser extends AbstractUidCommandParser {
- public ListCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.LIST_COMMAND_NAME));
+ public ListCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.LIST_COMMAND_NAME), statusResponseFactory);
}
- protected ListCommandParser(ImapCommand command) {
- super(command);
+ protected ListCommandParser(ImapCommand command, StatusResponseFactory statusResponseFactory) {
+ super(command, statusResponseFactory);
}
/**
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java
index 88b0d13..584d9eb 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListRightsCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.ListRightsRequest;
*/
public class ListRightsCommandParser extends AbstractImapCommandParser {
- public ListRightsCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.LISTRIGHTS_COMMAND_NAME));
+ public ListRightsCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.LISTRIGHTS_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LoginCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LoginCommandParser.java
index 4f0a53f..e974f8f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LoginCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LoginCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.LoginRequest;
*/
public class LoginCommandParser extends AbstractImapCommandParser {
- public LoginCommandParser() {
- super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.LOGIN_COMMAND_NAME));
+ public LoginCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.LOGIN_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LogoutCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LogoutCommandParser.java
index 7a489aa..12db4de 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LogoutCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LogoutCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.LogoutRequest;
*/
public class LogoutCommandParser extends AbstractImapCommandParser {
- public LogoutCommandParser() {
- super(ImapCommand.anyStateCommand(ImapConstants.LOGOUT_COMMAND_NAME));
+ public LogoutCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.anyStateCommand(ImapConstants.LOGOUT_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LsubCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LsubCommandParser.java
index 51676e2..a3dd8fc 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LsubCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/LsubCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.message.request.LsubRequest;
/**
@@ -29,8 +30,8 @@ import org.apache.james.imap.message.request.LsubRequest;
*/
public class LsubCommandParser extends ListCommandParser {
- public LsubCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.LSUB_COMMAND_NAME));
+ public LsubCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.LSUB_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java
index 63a5024..2ddc766 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java
@@ -4,6 +4,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.message.request.MoveRequest;
/**
@@ -11,8 +12,8 @@ import org.apache.james.imap.message.request.MoveRequest;
*/
public class MoveCommandParser extends AbstractMessageRangeCommandParser {
- public MoveCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.MOVE_COMMAND_NAME));
+ public MoveCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.MOVE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java
index 69e818a..e74119c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MyRightsCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.MyRightsRequest;
*/
public class MyRightsCommandParser extends AbstractImapCommandParser {
- public MyRightsCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.MYRIGHTS_COMMAND_NAME));
+ public MyRightsCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.MYRIGHTS_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NamespaceCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NamespaceCommandParser.java
index b59e63d..b83371a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NamespaceCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NamespaceCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.NamespaceRequest;
*/
public class NamespaceCommandParser extends AbstractImapCommandParser {
- public NamespaceCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.NAMESPACE_COMMAND_NAME));
+ public NamespaceCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.NAMESPACE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NoopCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NoopCommandParser.java
index 1bfb55b..ee3352a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NoopCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/NoopCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.NoopRequest;
*/
public class NoopCommandParser extends AbstractImapCommandParser {
- public NoopCommandParser() {
- super(ImapCommand.anyStateCommand(ImapConstants.NOOP_COMMAND_NAME));
+ public NoopCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.anyStateCommand(ImapConstants.NOOP_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/RenameCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/RenameCommandParser.java
index feeef9d..9cee81f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/RenameCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/RenameCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.RenameRequest;
*/
public class RenameCommandParser extends AbstractImapCommandParser {
- public RenameCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.RENAME_COMMAND_NAME));
+ public RenameCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.RENAME_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
index 68614da..77040d2 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java
@@ -52,8 +52,8 @@ import org.slf4j.LoggerFactory;
public class SearchCommandParser extends AbstractUidCommandParser {
private static final Logger LOGGER = LoggerFactory.getLogger(SearchCommandParser.class);
- public SearchCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.SEARCH_COMMAND_NAME));
+ public SearchCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.SEARCH_COMMAND_NAME), statusResponseFactory);
}
/**
@@ -903,9 +903,8 @@ public class SearchCommandParser extends AbstractUidCommandParser {
}
private ImapMessage unsupportedCharset(Tag tag, ImapCommand command) {
- final StatusResponseFactory factory = getStatusResponseFactory();
final ResponseCode badCharset = StatusResponse.ResponseCode.badCharset();
- return factory.taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset);
+ return statusResponseFactory.taggedNo(tag, command, HumanReadableText.BAD_CHARSET, badCharset);
}
/**
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java
index 253b853..2309bbe 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SelectCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.message.request.AbstractMailboxSelectionRequest;
import org.apache.james.imap.message.request.SelectRequest;
@@ -30,15 +31,12 @@ import org.apache.james.imap.message.request.SelectRequest;
* Parse SELECT commands
*/
public class SelectCommandParser extends AbstractSelectionCommandParser {
-
- public SelectCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.SELECT_COMMAND_NAME));
+ public SelectCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.SELECT_COMMAND_NAME), statusResponseFactory);
}
@Override
protected AbstractMailboxSelectionRequest createRequest(ImapCommand command, String mailboxName, boolean condstore, Long lastKnownUidValidity, Long knownModSeq, UidRange[] uidSet, UidRange[] knownUidSet, IdRange[] knownSequenceSet, Tag tag) {
return new SelectRequest(command, mailboxName, condstore, lastKnownUidValidity, knownModSeq, uidSet, knownUidSet, knownSequenceSet, tag);
}
-
-
}
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java
index 4cfc4da..4a96992 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.SetACLRequest;
*/
public class SetACLCommandParser extends AbstractImapCommandParser {
- public SetACLCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.SETACL_COMMAND_NAME));
+ public SetACLCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.SETACL_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParser.java
index 0c24420..f650a72 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParser.java
@@ -27,6 +27,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -38,8 +39,8 @@ import org.apache.james.mailbox.model.MailboxAnnotationKey;
import com.google.common.collect.ImmutableList;
public class SetAnnotationCommandParser extends AbstractImapCommandParser {
- public SetAnnotationCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.SETANNOTATION_COMMAND_NAME));
+ public SetAnnotationCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.SETANNOTATION_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetQuotaCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetQuotaCommandParser.java
index f38a554..fdbb092 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetQuotaCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetQuotaCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -34,8 +35,8 @@ import org.apache.james.imap.message.request.SetQuotaRequest;
*/
public class SetQuotaCommandParser extends AbstractImapCommandParser {
- public SetQuotaCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.SETQUOTA_COMMAND_NAME));
+ public SetQuotaCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.SETQUOTA_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StartTLSCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StartTLSCommandParser.java
index c5d2743..ec0fdf0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StartTLSCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StartTLSCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.StartTLSRequest;
*/
public class StartTLSCommandParser extends AbstractImapCommandParser {
- public StartTLSCommandParser() {
- super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.STARTTLS));
+ public StartTLSCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.nonAuthenticatedStateCommand(ImapConstants.STARTTLS), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java
index 660256d..3c809e0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java
@@ -26,6 +26,7 @@ import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
import org.apache.james.imap.api.message.StatusDataItems;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -42,8 +43,8 @@ import com.google.common.collect.ImmutableList;
public class StatusCommandParser extends AbstractImapCommandParser {
private static final ImapRequestLineReader.NoopCharValidator NOOP_CHAR_VALIDATOR = new ImapRequestLineReader.NoopCharValidator();
- public StatusCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.STATUS_COMMAND_NAME));
+ public StatusCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.STATUS_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java
index de64f2e..ddf3bbc 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StoreCommandParser.java
@@ -26,6 +26,7 @@ import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -40,8 +41,8 @@ public class StoreCommandParser extends AbstractUidCommandParser {
private static final byte[] UNCHANGEDSINCE = "UNCHANGEDSINCE".getBytes();
- public StoreCommandParser() {
- super(ImapCommand.selectedStateCommand(ImapConstants.STORE_COMMAND_NAME));
+ public StoreCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.STORE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java
index 3934019..2f9669a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SubscribeCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.SubscribeRequest;
*/
public class SubscribeCommandParser extends AbstractImapCommandParser {
- public SubscribeCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.SUBSCRIBE_COMMAND_NAME));
+ public SubscribeCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.SUBSCRIBE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java
index 2c1e0ef..b94e15f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UidCommandParser.java
@@ -23,6 +23,7 @@ import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapCommandParser;
@@ -40,8 +41,8 @@ public class UidCommandParser extends AbstractImapCommandParser {
private final ImapCommandParserFactory parserFactory;
- public UidCommandParser(ImapCommandParserFactory parserFactory) {
- super(ImapCommand.selectedStateCommand(ImapConstants.UID_COMMAND_NAME));
+ public UidCommandParser(ImapCommandParserFactory parserFactory, StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.selectedStateCommand(ImapConstants.UID_COMMAND_NAME), statusResponseFactory);
this.parserFactory = parserFactory;
}
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnselectCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnselectCommandParser.java
index 4ee9a15..452ee7a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnselectCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnselectCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -35,11 +36,11 @@ import org.apache.james.imap.message.request.UnselectRequest;
*/
public class UnselectCommandParser extends AbstractImapCommandParser {
- public UnselectCommandParser() {
+ public UnselectCommandParser(StatusResponseFactory statusResponseFactory) {
// from the RFC it seems like the command should be valid in any state.
// At least kind of, as we will return a "BAD" response if no mailbox is
// currently selected in the UnselectProcessor
- super(ImapCommand.authenticatedStateCommand(ImapConstants.UNSELECT_COMMAND_NAME));
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.UNSELECT_COMMAND_NAME), statusResponseFactory);
}
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java
index 1070ef9..487c96f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/UnsubscribeCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -33,8 +34,8 @@ import org.apache.james.imap.message.request.UnsubscribeRequest;
*/
public class UnsubscribeCommandParser extends AbstractImapCommandParser {
- public UnsubscribeCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.UNSUBSCRIBE_COMMAND_NAME));
+ public UnsubscribeCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.UNSUBSCRIBE_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/XListCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/XListCommandParser.java
index 9b056e9..861792b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/XListCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/XListCommandParser.java
@@ -22,6 +22,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapConstants;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.message.request.XListRequest;
/**
@@ -29,8 +30,8 @@ import org.apache.james.imap.message.request.XListRequest;
*/
public class XListCommandParser extends ListCommandParser {
- public XListCommandParser() {
- super(ImapCommand.authenticatedStateCommand(ImapConstants.XLIST_COMMAND_NAME));
+ public XListCommandParser(StatusResponseFactory statusResponseFactory) {
+ super(ImapCommand.authenticatedStateCommand(ImapConstants.XLIST_COMMAND_NAME), statusResponseFactory);
}
@Override
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CopyParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CopyParserTest.java
index 5a87531..bc766a7 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CopyParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CopyParserTest.java
@@ -21,12 +21,14 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.message.request.CopyRequest;
@@ -36,7 +38,7 @@ public class CopyParserTest {
@Test
public void testQuotaParsing() throws DecodingException {
- CopyCommandParser parser = new CopyCommandParser();
+ CopyCommandParser parser = new CopyCommandParser(mock(StatusResponseFactory.class));
ImapCommand command = ImapCommand.anyStateCommand("Command");
String commandString = " 42:69 foo \n";
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
index 7c9e6ed..77ef9a1 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
@@ -22,6 +22,7 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -30,6 +31,7 @@ import java.nio.charset.StandardCharsets;
import org.apache.james.core.Username;
import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.encode.FakeImapSession;
@@ -52,7 +54,7 @@ public class CreateCommandParserTest {
imapSession = new FakeImapSession();
imapSession.setMailboxSession(mailboxSession);
- parser = new CreateCommandParser();
+ parser = new CreateCommandParser(mock(StatusResponseFactory.class));
}
@Test
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java
index 160c2b5..88e5deb 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/FetchCommandParserPartialFetchTest.java
@@ -32,6 +32,7 @@ import org.apache.james.imap.api.message.BodyFetchElement;
import org.apache.james.imap.api.message.FetchData;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.SectionType;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
@@ -48,7 +49,7 @@ public class FetchCommandParserPartialFetchTest {
@Before
public void setUp() throws Exception {
- parser = new FetchCommandParser();
+ parser = new FetchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
session = new FakeImapSession();
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParserTest.java
index 38b5481..c5c4ee1 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetAnnotationCommandParserTest.java
@@ -21,6 +21,7 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -28,6 +29,7 @@ import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
@@ -50,7 +52,7 @@ public class GetAnnotationCommandParserTest {
@Before
public void setUp() throws Exception {
- parser = new GetAnnotationCommandParser();
+ parser = new GetAnnotationCommandParser(mock(StatusResponseFactory.class));
}
@Test(expected = DecodingException.class)
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java
index 9e6fff3..666be6e 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaParserTest.java
@@ -21,11 +21,13 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.message.request.GetQuotaRequest;
@@ -38,7 +40,7 @@ public class GetQuotaParserTest {
@Test
public void testQuotaParsing() throws DecodingException {
- GetQuotaCommandParser parser = new GetQuotaCommandParser();
+ GetQuotaCommandParser parser = new GetQuotaCommandParser(mock(StatusResponseFactory.class));
ImapCommand command = ImapCommand.anyStateCommand("Command");
String commandString = "quotaRoot \n";
InputStream inputStream = new ByteArrayInputStream(commandString.getBytes());
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java
index 6e82484..4cc06a1 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/GetQuotaRootParserTest.java
@@ -21,11 +21,13 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.message.request.GetQuotaRootRequest;
@@ -38,7 +40,7 @@ public class GetQuotaRootParserTest {
@Test
public void testNonQuotedMailbox() throws DecodingException {
- GetQuotaRootCommandParser parser = new GetQuotaRootCommandParser();
+ GetQuotaRootCommandParser parser = new GetQuotaRootCommandParser(mock(StatusResponseFactory.class));
ImapCommand command = ImapCommand.anyStateCommand("Command");
String commandString = "INBOX\n";
InputStream inputStream = new ByteArrayInputStream(commandString.getBytes());
@@ -50,7 +52,7 @@ public class GetQuotaRootParserTest {
@Test
public void testQuotedMailbox() throws DecodingException {
- GetQuotaRootCommandParser parser = new GetQuotaRootCommandParser();
+ GetQuotaRootCommandParser parser = new GetQuotaRootCommandParser(mock(StatusResponseFactory.class));
ImapCommand command = ImapCommand.anyStateCommand("Command");
String commandString = "\"INBOX\" \n";
InputStream inputStream = new ByteArrayInputStream(commandString.getBytes());
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/MoveParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/MoveParserTest.java
index 1cb617a..aa02143 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/MoveParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/MoveParserTest.java
@@ -21,12 +21,14 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.message.request.MoveRequest;
@@ -36,7 +38,7 @@ public class MoveParserTest {
@Test
public void testQuotaParsing() throws DecodingException {
- MoveCommandParser parser = new MoveCommandParser();
+ MoveCommandParser parser = new MoveCommandParser(mock(StatusResponseFactory.class));
ImapCommand command = ImapCommand.anyStateCommand("Command");
String commandString = " 42:69 foo \n";
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java
index 95c1d78..6e7834d 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserAndParenthesesTest.java
@@ -20,10 +20,10 @@
package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,6 +34,7 @@ import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
import org.apache.james.imap.api.message.request.DayMonthYear;
import org.apache.james.imap.api.message.request.SearchKey;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
@@ -152,7 +153,7 @@ public class SearchCommandParserAndParenthesesTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ parser = new SearchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java
index 805ff55..ca18b9c 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserCharsetTest.java
@@ -72,12 +72,10 @@ public class SearchCommandParserCharsetTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ mockStatusResponseFactory = mock(StatusResponseFactory.class);
+ parser = new SearchCommandParser(mockStatusResponseFactory);
command = ImapCommand.anyStateCommand("Command");
message = mock(ImapMessage.class);
-
- mockStatusResponseFactory = mock(StatusResponseFactory.class);
- parser.setStatusResponseFactory(mockStatusResponseFactory);
}
@Test
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java
index 9b51acf..b479d87 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserNotTest.java
@@ -20,6 +20,7 @@
package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -32,6 +33,7 @@ import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
import org.apache.james.imap.api.message.request.DayMonthYear;
import org.apache.james.imap.api.message.request.SearchKey;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.mailbox.MessageUid;
@@ -45,7 +47,7 @@ public class SearchCommandParserNotTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ parser = new SearchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java
index eae0525..e157607 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserOrTest.java
@@ -20,6 +20,7 @@
package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -31,6 +32,7 @@ import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
import org.apache.james.imap.api.message.request.DayMonthYear;
import org.apache.james.imap.api.message.request.SearchKey;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.mailbox.MessageUid;
@@ -44,7 +46,7 @@ public class SearchCommandParserOrTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ parser = new SearchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java
index 5fb2dc7..8e28d53 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserQuotedCharsetTest.java
@@ -135,13 +135,11 @@ public class SearchCommandParserQuotedCharsetTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ mockStatusResponseFactory = mock(StatusResponseFactory.class);
+ parser = new SearchCommandParser(mockStatusResponseFactory);
command = ImapCommand.anyStateCommand("Command");
message = mock(ImapMessage.class);
- mockStatusResponseFactory = mock(StatusResponseFactory.class);
session = new FakeImapSession();
-
- parser.setStatusResponseFactory(mockStatusResponseFactory);
}
@Test
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java
index 1287082..8fbff9e 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeySequenceSetTest.java
@@ -20,6 +20,7 @@
package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -30,6 +31,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
import org.apache.james.imap.api.message.request.SearchKey;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.mailbox.MessageUid;
@@ -43,7 +45,7 @@ public class SearchCommandParserSearchKeySequenceSetTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ parser = new SearchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java
index 2534ab0..ed4025b 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserSearchKeyTest.java
@@ -21,6 +21,7 @@ package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Fail.fail;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -32,6 +33,7 @@ import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
import org.apache.james.imap.api.message.request.DayMonthYear;
import org.apache.james.imap.api.message.request.SearchKey;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
@@ -49,7 +51,7 @@ public class SearchCommandParserSearchKeyTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ parser = new SearchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java
index 4e779cf..e4cb20c 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SearchCommandParserTopLevelAndTest.java
@@ -20,6 +20,7 @@
package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -33,6 +34,7 @@ import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.UidRange;
import org.apache.james.imap.api.message.request.DayMonthYear;
import org.apache.james.imap.api.message.request.SearchKey;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
@@ -137,7 +139,7 @@ public class SearchCommandParserTopLevelAndTest {
@Before
public void setUp() throws Exception {
- parser = new SearchCommandParser();
+ parser = new SearchCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
}
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParserTest.java
index a79162a..4457684 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetAnnotationCommandParserTest.java
@@ -21,12 +21,14 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.message.request.SetAnnotationRequest;
@@ -43,7 +45,7 @@ public class SetAnnotationCommandParserTest {
private static final MailboxAnnotation PRIVATE_ANNOTATION = MailboxAnnotation.newInstance(PRIVATE_KEY, "This is my comment");
private static final MailboxAnnotation SHARED_ANNOTATION = MailboxAnnotation.newInstance(SHARED_KEY, "This one is for you!");
private static final MailboxAnnotation NIL_ANNOTATION = MailboxAnnotation.nil(PRIVATE_KEY);
- private SetAnnotationCommandParser parser = new SetAnnotationCommandParser();
+ private SetAnnotationCommandParser parser = new SetAnnotationCommandParser(mock(StatusResponseFactory.class));
private ImapCommand command = ImapCommand.anyStateCommand("Command");
@Test
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java
index 1be99d9..c262d16 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/SetQuotaCommandParserTest.java
@@ -21,12 +21,14 @@ package org.apache.james.imap.decode.parser;
import static org.apache.james.imap.ImapFixture.TAG;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.decode.DecodingException;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
import org.apache.james.imap.message.request.SetQuotaRequest;
@@ -39,7 +41,7 @@ public class SetQuotaCommandParserTest {
@Test
public void testQuotaParsing() throws DecodingException {
- SetQuotaCommandParser parser = new SetQuotaCommandParser();
+ SetQuotaCommandParser parser = new SetQuotaCommandParser(mock(StatusResponseFactory.class));
ImapCommand command = ImapCommand.anyStateCommand("Command");
String commandString = "quotaRoot (STORAGE 512) ( MESSAGE 1024 ) \n";
InputStream inputStream = new ByteArrayInputStream(commandString.getBytes());
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/StoreCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/StoreCommandParserTest.java
index a670c76..fb6518f 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/StoreCommandParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/StoreCommandParserTest.java
@@ -32,6 +32,7 @@ import org.apache.james.imap.api.ImapCommand;
import org.apache.james.imap.api.ImapMessage;
import org.apache.james.imap.api.Tag;
import org.apache.james.imap.api.message.IdRange;
+import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapSession;
import org.apache.james.imap.decode.ImapRequestLineReader;
import org.apache.james.imap.decode.ImapRequestStreamLineReader;
@@ -48,7 +49,7 @@ public class StoreCommandParserTest {
@Before
public void setUp() throws Exception {
- parser = new StoreCommandParser();
+ parser = new StoreCommandParser(mock(StatusResponseFactory.class));
command = ImapCommand.anyStateCommand("Command");
session = mock(ImapSession.class);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org