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 fe...@apache.org on 2011/04/14 13:21:16 UTC
svn commit: r1092137 [7/9] - in /james/imap/trunk:
api/src/main/java/org/apache/james/imap/api/
api/src/main/java/org/apache/james/imap/api/display/
api/src/main/java/org/apache/james/imap/api/message/
api/src/main/java/org/apache/james/imap/api/messag...
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java Thu Apr 14 11:21:11 2011
@@ -47,18 +47,21 @@ import org.slf4j.Logger;
public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
- public AppendProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory statusResponseFactory) {
- super(AppendRequest.class,next, mailboxManager, statusResponseFactory);
+ public AppendProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory statusResponseFactory) {
+ super(AppendRequest.class, next, mailboxManager, statusResponseFactory);
}
-
+
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(AppendRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(AppendRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final String mailboxName = request.getMailboxName();
final InputStream messageIn = request.getMessage();
final Date datetime = request.getDatetime();
@@ -68,91 +71,91 @@ public class AppendProcessor extends Abs
final MailboxPath mailboxPath = buildFullPath(session, mailboxName);
final MailboxManager mailboxManager = getMailboxManager();
final MessageManager mailbox = mailboxManager.getMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
- appendToMailbox(messageIn, datetime, flags, session, tag,
- command, mailbox, responder, mailboxPath);
+ appendToMailbox(messageIn, datetime, flags, session, tag, command, mailbox, responder, mailboxPath);
} catch (MailboxNotFoundException e) {
// consume message on exception
consume(messageIn);
-
-// Indicates that the mailbox does not exist
-// So TRY CREATE
+
+ // Indicates that the mailbox does not exist
+ // So TRY CREATE
tryCreate(session, tag, command, responder, e);
-
+
} catch (MailboxException e) {
// consume message on exception
consume(messageIn);
-// Some other issue
+ // Some other issue
no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
-
+
}
}
-
+
private void consume(InputStream in) {
try {
- while(in.read() != -1); // NOPMD false positive
+ while (in.read() != -1)
+ ; // NOPMD false positive
} catch (IOException e1) { // NOPMD false positive
// just consume
- }
+ }
}
/**
* Issues a TRY CREATE response.
- * @param session not null
- * @param tag not null
- * @param command not null
- * @param responder not null
- * @param e not null
+ *
+ * @param session
+ * not null
+ * @param tag
+ * not null
+ * @param command
+ * not null
+ * @param responder
+ * not null
+ * @param e
+ * not null
*/
- private void tryCreate(ImapSession session, String tag, ImapCommand command,
- Responder responder, MailboxNotFoundException e) {
-
+ private void tryCreate(ImapSession session, String tag, ImapCommand command, Responder responder, MailboxNotFoundException e) {
+
final Logger logger = session.getLog();
if (logger.isDebugEnabled()) {
logger.debug("Cannot open mailbox: ", e);
}
-
- no(command, tag, responder,
- HumanReadableText.FAILURE_NO_SUCH_MAILBOX,
- StatusResponse.ResponseCode.tryCreate());
+
+ no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
}
- private void appendToMailbox(final InputStream message, final Date datetime,
- final Flags flagsToBeSet, final ImapSession session, final String tag,
- final ImapCommand command, final MessageManager mailbox, Responder responder, final MailboxPath mailboxPath) {
+ private void appendToMailbox(final InputStream message, final Date datetime, final Flags flagsToBeSet, final ImapSession session, final String tag, final ImapCommand command, final MessageManager mailbox, Responder responder, final MailboxPath mailboxPath) {
try {
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
final SelectedMailbox selectedMailbox = session.getSelected();
final MailboxManager mailboxManager = getMailboxManager();
- final boolean isSelectedMailbox = selectedMailbox != null
- && selectedMailbox.getPath().equals(mailboxPath);
- final long uid = mailbox.appendMessage(message, datetime, mailboxSession,
- !isSelectedMailbox, flagsToBeSet);
+ final boolean isSelectedMailbox = selectedMailbox != null && selectedMailbox.getPath().equals(mailboxPath);
+ final long uid = mailbox.appendMessage(message, datetime, mailboxSession, !isSelectedMailbox, flagsToBeSet);
if (isSelectedMailbox) {
selectedMailbox.addRecent(uid);
}
-
+
// get folder UIDVALIDITY
Long uidValidity = mailboxManager.getMailbox(mailboxPath, mailboxSession).getMetaData(false, mailboxSession, FetchGroup.NO_UNSEEN).getUidValidity();
unsolicitedResponses(session, responder, false);
- // in case of MULTIAPPEND support we will push more then one UID here
+ // in case of MULTIAPPEND support we will push more then one UID
+ // here
okComplete(command, tag, ResponseCode.appendUid(uidValidity, new IdRange[] { new IdRange(uid) }), responder);
} catch (MailboxNotFoundException e) {
-// Indicates that the mailbox does not exist
-// So TRY CREATE
+ // Indicates that the mailbox does not exist
+ // So TRY CREATE
tryCreate(session, tag, command, responder, e);
- /*} catch (StorageException e) {
- taggedBad(command, tag, responder, e.getKey());
- */
+ /*
+ * } catch (StorageException e) { taggedBad(command, tag, responder,
+ * e.getKey());
+ */
} catch (MailboxException e) {
session.getLog().debug("Unable to append message", e);
-// Some other issue
+ // Some other issue
no(command, tag, responder, HumanReadableText.SAVE_FAILED);
}
}
-
-
+
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java Thu Apr 14 11:21:11 2011
@@ -29,22 +29,24 @@ import org.apache.james.mailbox.MailboxM
public class AuthenticateProcessor extends AbstractMailboxProcessor<AuthenticateRequest> {
- public AuthenticateProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public AuthenticateProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(AuthenticateRequest.class, next, mailboxManager, factory);
}
-
+
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(AuthenticateRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(AuthenticateRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final String authType = request.getAuthType();
- session.getLog()
- .info("Unsupported authentication mechanism '" + authType + "'");
- no(command, tag, responder,
- HumanReadableText.UNSUPPORTED_AUTHENTICATION_MECHANISM);
+ session.getLog().info("Unsupported authentication mechanism '" + authType + "'");
+ no(command, tag, responder, HumanReadableText.UNSUPPORTED_AUTHENTICATION_MECHANISM);
}
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityImplementingProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityImplementingProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityImplementingProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityImplementingProcessor.java Thu Apr 14 11:21:11 2011
@@ -26,12 +26,9 @@ import org.apache.james.imap.api.process
/**
* {@link ImapProcessor} which implements one ore more Capabilities
- *
- *
*/
-public interface CapabilityImplementingProcessor extends ImapProcessor{
+public interface CapabilityImplementingProcessor extends ImapProcessor {
-
/**
* Return a list of all Capabilities that are implemented by the Processor
*
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java Thu Apr 14 11:21:11 2011
@@ -39,35 +39,36 @@ public class CapabilityProcessor extends
private final List<CapabilityImplementingProcessor> capabilities = new ArrayList<CapabilityImplementingProcessor>();
- public CapabilityProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory, final List<CapabilityImplementingProcessor> capabilities) {
+ public CapabilityProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory, final List<CapabilityImplementingProcessor> capabilities) {
this(next, mailboxManager, factory);
this.capabilities.addAll(capabilities);
}
- public CapabilityProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
- super(CapabilityRequest.class,next, mailboxManager, factory);
+ public CapabilityProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
+ super(CapabilityRequest.class, next, mailboxManager, factory);
this.capabilities.add(this);
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(CapabilityRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
- final ImapResponseMessage result = doProcess(request, session, tag,
- command);
+ protected void doProcess(CapabilityRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
+ final ImapResponseMessage result = doProcess(request, session, tag, command);
responder.respond(result);
unsolicitedResponses(session, responder, false);
okComplete(command, tag, responder);
}
- private ImapResponseMessage doProcess(CapabilityRequest request,
- ImapSession session, String tag, ImapCommand command) {
+ private ImapResponseMessage doProcess(CapabilityRequest request, ImapSession session, String tag, ImapCommand command) {
List<String> caps = new ArrayList<String>();
for (int i = 0; i < capabilities.size(); i++) {
caps.addAll(capabilities.get(i).getImplementedCapabilities(session));
@@ -75,9 +76,10 @@ public class CapabilityProcessor extends
final CapabilityResponse result = new CapabilityResponse(caps);
return result;
}
-
+
/**
- * Add a {@link CapabilityImplementor} which will get queried for implemented capabilities
+ * Add a {@link CapabilityImplementor} which will get queried for
+ * implemented capabilities
*
* @param implementor
*/
@@ -87,7 +89,9 @@ public class CapabilityProcessor extends
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
+ *
+ * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#
+ * getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
*/
public List<String> getImplementedCapabilities(ImapSession session) {
final List<String> capabilities = new ArrayList<String>();
@@ -96,6 +100,5 @@ public class CapabilityProcessor extends
capabilities.add(SUPPORTS_RFC3348);
return capabilities;
}
-
-
+
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CheckProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CheckProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CheckProcessor.java Thu Apr 14 11:21:11 2011
@@ -28,13 +28,11 @@ import org.apache.james.mailbox.MailboxM
public class CheckProcessor extends AbstractMailboxProcessor<CheckRequest> {
- public CheckProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public CheckProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(CheckRequest.class, next, mailboxManager, factory);
}
- protected void doProcess(CheckRequest message, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(CheckRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) {
unsolicitedResponses(session, responder, false);
okComplete(command, tag, responder);
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CloseProcessor.java Thu Apr 14 11:21:11 2011
@@ -34,14 +34,11 @@ import org.apache.james.mailbox.MessageR
public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
- public CloseProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public CloseProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(CloseRequest.class, next, mailboxManager, factory);
}
-
- protected void doProcess(CloseRequest message, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(CloseRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) {
try {
MessageManager mailbox = getSelectedMailbox(session);
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -52,12 +49,12 @@ public class CloseProcessor extends Abst
// TODO: the following comment was present in the code before
// refactoring
// TODO: doesn't seem to match the implementation
- // TODO: check that implementation is correct
+ // TODO: check that implementation is correct.
// Don't send unsolicited responses on close.
unsolicitedResponses(session, responder, false);
okComplete(command, tag, responder);
}
-
+
} catch (MailboxException e) {
no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CompressProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CompressProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CompressProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CompressProcessor.java Thu Apr 14 11:21:11 2011
@@ -30,22 +30,25 @@ import org.apache.james.imap.api.process
import org.apache.james.imap.message.request.CompressRequest;
import org.apache.james.imap.processor.base.AbstractChainedProcessor;
-public class CompressProcessor extends AbstractChainedProcessor<CompressRequest> implements CapabilityImplementingProcessor{
+public class CompressProcessor extends AbstractChainedProcessor<CompressRequest> implements CapabilityImplementingProcessor {
private final static String ALGO = "DEFLATE";
private final static List<String> CAPA = Arrays.asList(ImapConstants.COMPRESS_COMMAND_NAME + "=" + ALGO);
private StatusResponseFactory factory;
private final static String COMPRESSED = "COMPRESSED";
-
+
public CompressProcessor(ImapProcessor next, final StatusResponseFactory factory) {
super(CompressRequest.class, next);
this.factory = factory;
}
-
-
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.base.AbstractChainedProcessor#doProcess(org.apache.james.imap.api.ImapMessage, org.apache.james.imap.api.process.ImapProcessor.Responder, org.apache.james.imap.api.process.ImapSession)
+ *
+ * @see
+ * org.apache.james.imap.processor.base.AbstractChainedProcessor#doProcess
+ * (org.apache.james.imap.api.ImapMessage,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder,
+ * org.apache.james.imap.api.process.ImapSession)
*/
protected void doProcess(CompressRequest request, Responder responder, ImapSession session) {
if (session.isCompressionSupported()) {
@@ -70,7 +73,9 @@ public class CompressProcessor extends A
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
+ *
+ * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#
+ * getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
*/
@SuppressWarnings("unchecked")
public List<String> getImplementedCapabilities(ImapSession session) {
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java Thu Apr 14 11:21:11 2011
@@ -45,19 +45,21 @@ import org.apache.james.mailbox.MessageR
public class CopyProcessor extends AbstractMailboxProcessor<CopyRequest> {
-
- public CopyProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public CopyProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(CopyRequest.class, next, mailboxManager, factory);
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(CopyRequest request, final ImapSession session,
- String tag, ImapCommand command, final Responder responder) {
+ protected void doProcess(CopyRequest request, final ImapSession session, String tag, ImapCommand command, final Responder responder) {
final MailboxPath targetMailbox = buildFullPath(session, request.getMailboxName());
final IdRange[] idSet = request.getIdSet();
final boolean useUids = request.isUseUids();
@@ -66,32 +68,32 @@ public class CopyProcessor extends Abstr
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
final MailboxManager mailboxManager = getMailboxManager();
final boolean mailboxExists = mailboxManager.mailboxExists(targetMailbox, mailboxSession);
-
+
if (!mailboxExists) {
- no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX,
- ResponseCode.tryCreate());
+ no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
} else {
-
+
final MessageManager mailbox = mailboxManager.getMailbox(targetMailbox, mailboxSession);
- List<IdRange> resultRanges=new ArrayList<IdRange>();
+ List<IdRange> resultRanges = new ArrayList<IdRange>();
for (int i = 0; i < idSet.length; i++) {
MessageRange messageSet = messageRange(currentMailbox, idSet[i], useUids);
List<MessageRange> copiedUids = mailboxManager.copyMessages(messageSet, currentMailbox.getPath(), targetMailbox, mailboxSession);
for (MessageRange mr : copiedUids) {
- // Set recent flag on copied message as this SHOULD be done.
- // See RFC 3501 6.4.7. COPY Command
- // See IMAP-287
- mailbox.setFlags(new Flags(Flags.Flag.RECENT), true, false, mr, mailboxSession);
- resultRanges.add(new IdRange(mr.getUidFrom(), mr.getUidTo()));
+ // Set recent flag on copied message as this SHOULD be
+ // done.
+ // See RFC 3501 6.4.7. COPY Command
+ // See IMAP-287
+ mailbox.setFlags(new Flags(Flags.Flag.RECENT), true, false, mr, mailboxSession);
+ resultRanges.add(new IdRange(mr.getUidFrom(), mr.getUidTo()));
}
}
IdRange[] resultUids = IdRange.mergeRanges(resultRanges).toArray(new IdRange[0]);
// get folder UIDVALIDITY
Long uidValidity = mailbox.getMetaData(false, mailboxSession, FetchGroup.NO_UNSEEN).getUidValidity();
-
+
unsolicitedResponses(session, responder, useUids);
okComplete(command, tag, ResponseCode.copyUid(uidValidity, idSet, resultUids), responder);
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java Thu Apr 14 11:21:11 2011
@@ -33,18 +33,21 @@ import org.apache.james.mailbox.MailboxP
public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> {
- public CreateProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public CreateProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(CreateRequest.class, next, mailboxManager, factory);
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(CreateRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(CreateRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
try {
final MailboxManager mailboxManager = getMailboxManager();
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java Thu Apr 14 11:21:11 2011
@@ -19,7 +19,6 @@
package org.apache.james.imap.processor;
-
import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapProcessor;
import org.apache.james.imap.api.process.MailboxTyper;
@@ -32,82 +31,49 @@ import org.apache.james.mailbox.Subscrip
*/
public class DefaultProcessorChain {
- public static final ImapProcessor createDefaultChain(
- final ImapProcessor chainEndProcessor,
- final MailboxManager mailboxManager,
- final SubscriptionManager subscriptionManager,
- final StatusResponseFactory statusResponseFactory, MailboxTyper mailboxTyper, int batchSize) {
+ public static final ImapProcessor createDefaultChain(final ImapProcessor chainEndProcessor, final MailboxManager mailboxManager, final SubscriptionManager subscriptionManager, final StatusResponseFactory statusResponseFactory, MailboxTyper mailboxTyper, int batchSize) {
final SystemMessageProcessor systemProcessor = new SystemMessageProcessor(chainEndProcessor, mailboxManager);
- final LogoutProcessor logoutProcessor = new LogoutProcessor(
- systemProcessor, mailboxManager, statusResponseFactory);
-
- final CapabilityProcessor capabilityProcessor = new CapabilityProcessor(
- logoutProcessor, mailboxManager, statusResponseFactory);
- final CheckProcessor checkProcessor = new CheckProcessor(
- capabilityProcessor, mailboxManager, statusResponseFactory);
- final LoginProcessor loginProcessor = new LoginProcessor(
- checkProcessor, mailboxManager, statusResponseFactory);
- final RenameProcessor renameProcessor = new RenameProcessor(
- loginProcessor, mailboxManager, statusResponseFactory);
- final DeleteProcessor deleteProcessor = new DeleteProcessor(
- renameProcessor, mailboxManager, statusResponseFactory);
- final CreateProcessor createProcessor = new CreateProcessor(
- deleteProcessor, mailboxManager, statusResponseFactory);
- final CloseProcessor closeProcessor = new CloseProcessor(
- createProcessor, mailboxManager, statusResponseFactory);
- final UnsubscribeProcessor unsubscribeProcessor = new UnsubscribeProcessor(
- closeProcessor, mailboxManager, subscriptionManager, statusResponseFactory);
- final SubscribeProcessor subscribeProcessor = new SubscribeProcessor(
- unsubscribeProcessor, mailboxManager,
- subscriptionManager, statusResponseFactory);
- final CopyProcessor copyProcessor = new CopyProcessor(
- subscribeProcessor, mailboxManager,
- statusResponseFactory);
- final AuthenticateProcessor authenticateProcessor = new AuthenticateProcessor(
- copyProcessor, mailboxManager, statusResponseFactory);
- final ExpungeProcessor expungeProcessor = new ExpungeProcessor(
- authenticateProcessor, mailboxManager,
- statusResponseFactory);
- final ExamineProcessor examineProcessor = new ExamineProcessor(
- expungeProcessor, mailboxManager, statusResponseFactory);
- final AppendProcessor appendProcessor = new AppendProcessor(
- examineProcessor, mailboxManager, statusResponseFactory);
- final StoreProcessor storeProcessor = new StoreProcessor(
- appendProcessor, mailboxManager, statusResponseFactory);
- final NoopProcessor noopProcessor = new NoopProcessor(storeProcessor,
- mailboxManager, statusResponseFactory);
- final IdleProcessor idleProcessor = new IdleProcessor(noopProcessor,
- mailboxManager, statusResponseFactory);
- final StatusProcessor statusProcessor = new StatusProcessor(
- idleProcessor, mailboxManager, statusResponseFactory);
- final LSubProcessor lsubProcessor = new LSubProcessor(statusProcessor,
- mailboxManager, subscriptionManager, statusResponseFactory);
- final XListProcessor xlistProcessor = new XListProcessor(lsubProcessor,
- mailboxManager, statusResponseFactory,mailboxTyper);
- final ListProcessor listProcessor = new ListProcessor(xlistProcessor,
- mailboxManager, statusResponseFactory);
- final SearchProcessor searchProcessor = new SearchProcessor(
- listProcessor, mailboxManager, statusResponseFactory);
- final SelectProcessor selectProcessor = new SelectProcessor(
- searchProcessor, mailboxManager, statusResponseFactory);
- final NamespaceProcessor namespaceProcessor = new NamespaceProcessor(
- selectProcessor, mailboxManager, statusResponseFactory);
-
+ final LogoutProcessor logoutProcessor = new LogoutProcessor(systemProcessor, mailboxManager, statusResponseFactory);
+
+ final CapabilityProcessor capabilityProcessor = new CapabilityProcessor(logoutProcessor, mailboxManager, statusResponseFactory);
+ final CheckProcessor checkProcessor = new CheckProcessor(capabilityProcessor, mailboxManager, statusResponseFactory);
+ final LoginProcessor loginProcessor = new LoginProcessor(checkProcessor, mailboxManager, statusResponseFactory);
+ final RenameProcessor renameProcessor = new RenameProcessor(loginProcessor, mailboxManager, statusResponseFactory);
+ final DeleteProcessor deleteProcessor = new DeleteProcessor(renameProcessor, mailboxManager, statusResponseFactory);
+ final CreateProcessor createProcessor = new CreateProcessor(deleteProcessor, mailboxManager, statusResponseFactory);
+ final CloseProcessor closeProcessor = new CloseProcessor(createProcessor, mailboxManager, statusResponseFactory);
+ final UnsubscribeProcessor unsubscribeProcessor = new UnsubscribeProcessor(closeProcessor, mailboxManager, subscriptionManager, statusResponseFactory);
+ final SubscribeProcessor subscribeProcessor = new SubscribeProcessor(unsubscribeProcessor, mailboxManager, subscriptionManager, statusResponseFactory);
+ final CopyProcessor copyProcessor = new CopyProcessor(subscribeProcessor, mailboxManager, statusResponseFactory);
+ final AuthenticateProcessor authenticateProcessor = new AuthenticateProcessor(copyProcessor, mailboxManager, statusResponseFactory);
+ final ExpungeProcessor expungeProcessor = new ExpungeProcessor(authenticateProcessor, mailboxManager, statusResponseFactory);
+ final ExamineProcessor examineProcessor = new ExamineProcessor(expungeProcessor, mailboxManager, statusResponseFactory);
+ final AppendProcessor appendProcessor = new AppendProcessor(examineProcessor, mailboxManager, statusResponseFactory);
+ final StoreProcessor storeProcessor = new StoreProcessor(appendProcessor, mailboxManager, statusResponseFactory);
+ final NoopProcessor noopProcessor = new NoopProcessor(storeProcessor, mailboxManager, statusResponseFactory);
+ final IdleProcessor idleProcessor = new IdleProcessor(noopProcessor, mailboxManager, statusResponseFactory);
+ final StatusProcessor statusProcessor = new StatusProcessor(idleProcessor, mailboxManager, statusResponseFactory);
+ final LSubProcessor lsubProcessor = new LSubProcessor(statusProcessor, mailboxManager, subscriptionManager, statusResponseFactory);
+ final XListProcessor xlistProcessor = new XListProcessor(lsubProcessor, mailboxManager, statusResponseFactory, mailboxTyper);
+ final ListProcessor listProcessor = new ListProcessor(xlistProcessor, mailboxManager, statusResponseFactory);
+ final SearchProcessor searchProcessor = new SearchProcessor(listProcessor, mailboxManager, statusResponseFactory);
+ final SelectProcessor selectProcessor = new SelectProcessor(searchProcessor, mailboxManager, statusResponseFactory);
+ final NamespaceProcessor namespaceProcessor = new NamespaceProcessor(selectProcessor, mailboxManager, statusResponseFactory);
+
capabilityProcessor.addProcessor(xlistProcessor);
-
- final ImapProcessor fetchProcessor = new FetchProcessor(namespaceProcessor,
- mailboxManager, statusResponseFactory, batchSize);
+
+ final ImapProcessor fetchProcessor = new FetchProcessor(namespaceProcessor, mailboxManager, statusResponseFactory, batchSize);
final StartTLSProcessor startTLSProcessor = new StartTLSProcessor(fetchProcessor, statusResponseFactory);
-
+
final UnselectProcessor unselectProcessor = new UnselectProcessor(startTLSProcessor, mailboxManager, statusResponseFactory);
-
+
final CompressProcessor compressProcessor = new CompressProcessor(unselectProcessor, statusResponseFactory);
capabilityProcessor.addProcessor(startTLSProcessor);
capabilityProcessor.addProcessor(idleProcessor);
capabilityProcessor.addProcessor(namespaceProcessor);
// added to announce UIDPLUS support
capabilityProcessor.addProcessor(expungeProcessor);
-
+
// announce the UNSELECT extension. See RFC3691
capabilityProcessor.addProcessor(unselectProcessor);
@@ -115,7 +81,7 @@ public class DefaultProcessorChain {
capabilityProcessor.addProcessor(compressProcessor);
return compressProcessor;
-
- }
-
+
+ }
+
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java Thu Apr 14 11:21:11 2011
@@ -34,18 +34,21 @@ import org.apache.james.mailbox.MailboxP
public class DeleteProcessor extends AbstractMailboxProcessor<DeleteRequest> {
- public DeleteProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public DeleteProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(DeleteRequest.class, next, mailboxManager, factory);
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(DeleteRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(DeleteRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
try {
final SelectedMailbox selected = session.getSelected();
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java Thu Apr 14 11:21:11 2011
@@ -26,9 +26,7 @@ import org.apache.james.mailbox.MailboxM
public class ExamineProcessor extends AbstractSelectionProcessor<ExamineRequest> {
- public ExamineProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory statusResponseFactory) {
- super(ExamineRequest.class,next, mailboxManager, statusResponseFactory, true);
+ public ExamineProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory statusResponseFactory) {
+ super(ExamineRequest.class, next, mailboxManager, statusResponseFactory, true);
}
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java Thu Apr 14 11:21:11 2011
@@ -39,25 +39,21 @@ import org.apache.james.mailbox.MessageM
import org.apache.james.mailbox.MessageRange;
import org.apache.james.mailbox.MessageRangeException;
-public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> implements CapabilityImplementingProcessor{
+public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> implements CapabilityImplementingProcessor {
private final static List<String> UIDPLUS = Arrays.asList("UIDPLUS");
-
- public ExpungeProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+
+ public ExpungeProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(ExpungeRequest.class, next, mailboxManager, factory);
}
- protected void doProcess(ExpungeRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(ExpungeRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
try {
final MessageManager mailbox = getSelectedMailbox(session);
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-
+
if (!mailbox.isWriteable(mailboxSession)) {
- no(command, tag, responder,
- HumanReadableText.MAILBOX_IS_READ_ONLY);
+ no(command, tag, responder, HumanReadableText.MAILBOX_IS_READ_ONLY);
} else {
IdRange[] ranges = request.getUidSet();
if (ranges == null) {
@@ -65,14 +61,14 @@ public class ExpungeProcessor extends Ab
} else {
// Handle UID EXPUNGE which is part of UIDPLUS
// See http://tools.ietf.org/html/rfc4315
- for (int i = 0; i <ranges.length; i++) {
+ for (int i = 0; i < ranges.length; i++) {
MessageRange mRange = messageRange(session.getSelected(), ranges[i], true);
expunge(mailbox, mRange, session, mailboxSession);
}
}
-
+
unsolicitedResponses(session, responder, false);
okComplete(command, tag, responder);
}
@@ -83,7 +79,7 @@ public class ExpungeProcessor extends Ab
no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
}
}
-
+
private void expunge(MessageManager mailbox, MessageRange range, ImapSession session, MailboxSession mailboxSession) throws MailboxException {
final Iterator<Long> it = mailbox.expunge(range, mailboxSession);
final SelectedMailbox selected = session.getSelected();
@@ -95,10 +91,11 @@ public class ExpungeProcessor extends Ab
}
}
-
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
+ *
+ * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#
+ * getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
*/
public List<String> getImplementedCapabilities(ImapSession session) {
return UIDPLUS;
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/IdleProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/IdleProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/IdleProcessor.java Thu Apr 14 11:21:11 2011
@@ -48,12 +48,11 @@ import org.apache.james.mailbox.MailboxM
import org.apache.james.mailbox.MailboxSession;
public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> implements CapabilityImplementingProcessor {
-
-
- private final ScheduledExecutorService heartbeatExecutor;
+
+ private final ScheduledExecutorService heartbeatExecutor;
private final static String HEARTBEAT_FUTURE = "IDLE_HEARTBEAT_FUTURE";
-
+
// 2 minutes
public final static long DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS = 2 * 60;
public final static TimeUnit DEFAULT_HEARTBEAT_INTERVAL_UNIT = TimeUnit.SECONDS;
@@ -61,62 +60,59 @@ public class IdleProcessor extends Abstr
private final static String DONE = "DONE";
private final TimeUnit heartbeatIntervalUnit;
private final long heartbeatInterval;
-
- public IdleProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+
+ public IdleProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
this(next, mailboxManager, factory, DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS, DEFAULT_HEARTBEAT_INTERVAL_UNIT, Executors.newScheduledThreadPool(DEFAULT_SCHEDULED_POOL_CORE_SIZE));
-
+
}
- public IdleProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory, long heartbeatInterval, TimeUnit heartbeatIntervalUnit, ScheduledExecutorService heartbeatExecutor) {
+ public IdleProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory, long heartbeatInterval, TimeUnit heartbeatIntervalUnit, ScheduledExecutorService heartbeatExecutor) {
super(IdleRequest.class, next, mailboxManager, factory);
this.heartbeatInterval = heartbeatInterval;
this.heartbeatIntervalUnit = heartbeatIntervalUnit;
this.heartbeatExecutor = heartbeatExecutor;
-
+
}
- protected void doProcess(final IdleRequest message, final ImapSession session,
- final String tag, final ImapCommand command, final Responder responder) {
+ protected void doProcess(final IdleRequest message, final ImapSession session, final String tag, final ImapCommand command, final Responder responder) {
final AtomicBoolean closed = new AtomicBoolean(false);
- try {
+ try {
responder.respond(new ContinuationResponse(HumanReadableText.IDLING));
unsolicitedResponses(session, responder, false);
final MailboxManager mailboxManager = getMailboxManager();
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
SelectedMailbox sm = session.getSelected();
- if(sm != null) {
- mailboxManager.addListener(sm.getPath(),
- new IdleMailboxListener(closed, session, responder), mailboxSession);
+ if (sm != null) {
+ mailboxManager.addListener(sm.getPath(), new IdleMailboxListener(closed, session, responder), mailboxSession);
}
-
-
+
session.pushLineHandler(new ImapLineHandler() {
-
+
/*
* (non-Javadoc)
- * @see org.apache.james.imap.api.process.ImapLineHandler#onLine(org.apache.james.imap.api.process.ImapSession, byte[])
+ *
+ * @see
+ * org.apache.james.imap.api.process.ImapLineHandler#onLine(
+ * org.apache.james.imap.api.process.ImapSession, byte[])
*/
public void onLine(ImapSession session, byte[] data) {
String line;
if (data.length > 2) {
- line = new String(data, 0, data.length -2 );
+ line = new String(data, 0, data.length - 2);
} else {
line = "";
}
-
+
closed.set(true);
session.popLineHandler();
if (!DONE.equals(line.toUpperCase(Locale.US))) {
- StatusResponse response = getStatusResponseFactory().taggedBad(tag, command,
- HumanReadableText.INVALID_COMMAND);
+ StatusResponse response = getStatusResponseFactory().taggedBad(tag, command, HumanReadableText.INVALID_COMMAND);
responder.respond(response);
} else {
okComplete(command, tag, responder);
-
+
// See if we need to cancel the idle heartbeat handling
Object oFuture = session.getAttribute(HEARTBEAT_FUTURE);
if (oFuture != null) {
@@ -129,7 +125,7 @@ public class IdleProcessor extends Abstr
}
session.setAttribute(HEARTBEAT_FUTURE, null);
}
- }
+ }
}
});
@@ -141,21 +137,23 @@ public class IdleProcessor extends Abstr
// check if we need to cancel the Runnable
// See IMAP-275
if (session.getState() == ImapSessionState.LOGOUT) {
-
+
Object future = session.getAttribute(HEARTBEAT_FUTURE);
if (future != null) {
- // cancel the future if needed to be sure it not run infinity
+ // cancel the future if needed to be sure it not
+ // run infinity
((ScheduledFuture<?>) future).cancel(true);
session.setAttribute(HEARTBEAT_FUTURE, null);
}
-
+
} else {
- // Send a heartbeat to the client to make sure we reset
- // the idle timeout. This is kind of the same workaround
- // as dovecot use.
+ // Send a heartbeat to the client to make sure we
+ // reset the idle timeout. This is kind of the same
+ // workaround as dovecot use.
//
- // This is mostly needed because of the broken outlook
- // client, but can't harm for other clients too.
+ // This is mostly needed because of the broken
+ // outlook client, but can't harm for other clients
+ // too.
// See IMAP-272
StatusResponse response = getStatusResponseFactory().untaggedOk(HumanReadableText.HEARTBEAT);
responder.respond(response);
@@ -177,12 +175,12 @@ public class IdleProcessor extends Abstr
public List<String> getImplementedCapabilities(ImapSession session) {
return Arrays.asList(SUPPORTS_IDLE);
}
-
+
private class IdleMailboxListener extends ImapStateAwareMailboxListener {
-
+
private final AtomicBoolean closed;
private final Responder responder;
-
+
public IdleMailboxListener(AtomicBoolean closed, ImapSession session, Responder responder) {
super(session);
this.closed = closed;
@@ -199,14 +197,16 @@ public class IdleProcessor extends Abstr
}
}
}
-
+
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.ImapSessionAwareMailboxListener#isListenerClosed()
+ *
+ * @see org.apache.james.imap.processor.ImapSessionAwareMailboxListener#
+ * isListenerClosed()
*/
protected boolean isListenerClosed() {
return closed.get();
}
-
+
}
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java Thu Apr 14 11:21:11 2011
@@ -44,48 +44,41 @@ public class LSubProcessor extends Abstr
public LSubProcessor(ImapProcessor next, MailboxManager mailboxManager, SubscriptionManager subscriptionManager, StatusResponseFactory factory) {
super(LsubRequest.class, next, mailboxManager, subscriptionManager, factory);
}
- private void listSubscriptions(ImapSession session, Responder responder,
- final String referenceName, final String mailboxName)
- throws SubscriptionException, MailboxException {
+
+ private void listSubscriptions(ImapSession session, Responder responder, final String referenceName, final String mailboxName) throws SubscriptionException, MailboxException {
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
final Collection<String> mailboxes = getSubscriptionManager().subscriptions(mailboxSession);
// If the mailboxName is fully qualified, ignore the reference name.
String finalReferencename = referenceName;
-
+
if (mailboxName.charAt(0) == MailboxConstants.NAMESPACE_PREFIX_CHAR) {
finalReferencename = "";
}
-
+
// Is the interpreted (combined) pattern relative?
boolean isRelative = ((finalReferencename + mailboxName).charAt(0) != MailboxConstants.NAMESPACE_PREFIX_CHAR);
MailboxPath basePath = null;
if (isRelative) {
- basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE,
- mailboxSession.getUser().getUserName(), finalReferencename);
- }
- else {
+ basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, mailboxSession.getUser().getUserName(), finalReferencename);
+ } else {
basePath = buildFullPath(session, finalReferencename);
}
-
final MailboxQuery expression = new MailboxQuery(basePath, mailboxName, mailboxSession.getPathDelimiter());
final Collection<String> mailboxResponses = new ArrayList<String>();
- for (final String mailbox: mailboxes) {
+ for (final String mailbox : mailboxes) {
respond(responder, expression, mailbox, true, mailboxes, mailboxResponses, mailboxSession.getPathDelimiter());
}
}
- private void respond(Responder responder, final MailboxQuery expression,
- final String mailboxName, final boolean originalSubscription,
- final Collection<String> mailboxes, final Collection<String> mailboxResponses, final char delimiter) {
+ private void respond(Responder responder, final MailboxQuery expression, final String mailboxName, final boolean originalSubscription, final Collection<String> mailboxes, final Collection<String> mailboxResponses, final char delimiter) {
if (expression.isExpressionMatch(mailboxName)) {
if (!mailboxResponses.contains(mailboxName)) {
final LSubResponse response = new LSubResponse(mailboxName, !originalSubscription, delimiter);
responder.respond(response);
mailboxResponses.add(mailboxName);
}
- }
- else {
+ } else {
final int lastDelimiter = mailboxName.lastIndexOf(delimiter);
if (lastDelimiter > 0) {
final String parentMailbox = mailboxName.substring(0, lastDelimiter);
@@ -110,13 +103,18 @@ public class LSubProcessor extends Abstr
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractSubscriptionProcessor#doProcessRequest(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see org.apache.james.imap.processor.AbstractSubscriptionProcessor#
+ * doProcessRequest(org.apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
protected void doProcessRequest(LsubRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final String referenceName = request.getBaseReferenceName();
final String mailboxPattern = request.getMailboxPattern();
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-
+
try {
if (mailboxPattern.length() == 0) {
respondWithHierarchyDelimiter(responder, mailboxSession.getPathDelimiter());
@@ -133,6 +131,6 @@ public class LSubProcessor extends Abstr
session.getLog().debug("Subscription failed", e);
final HumanReadableText displayTextKey = HumanReadableText.GENERIC_LSUB_FAILURE;
no(command, tag, responder, displayTextKey);
- }
+ }
}
}
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java Thu Apr 14 11:21:11 2011
@@ -44,45 +44,43 @@ import org.apache.james.mailbox.MailboxS
import org.apache.james.mailbox.MailboxMetaData.Children;
import org.apache.james.mailbox.util.SimpleMailboxMetaData;
-public class ListProcessor extends AbstractMailboxProcessor<ListRequest>{
+public class ListProcessor extends AbstractMailboxProcessor<ListRequest> {
- public ListProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public ListProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(ListRequest.class, next, mailboxManager, factory);
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(ListRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(ListRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final String baseReferenceName = request.getBaseReferenceName();
final String mailboxPatternString = request.getMailboxPattern();
- doProcess(baseReferenceName, mailboxPatternString, session, tag,
- command, responder,null);
+ doProcess(baseReferenceName, mailboxPatternString, session, tag, command, responder, null);
}
- protected ImapResponseMessage createResponse(boolean noInferior,
- boolean noSelect, boolean marked, boolean unmarked,
- boolean hasChildren, boolean hasNoChildren, String mailboxName, char delimiter,MailboxType type) {
- return new ListResponse(noInferior, noSelect, marked, unmarked,
- hasChildren, hasNoChildren, mailboxName, delimiter);
+ protected ImapResponseMessage createResponse(boolean noInferior, boolean noSelect, boolean marked, boolean unmarked, boolean hasChildren, boolean hasNoChildren, String mailboxName, char delimiter, MailboxType type) {
+ return new ListResponse(noInferior, noSelect, marked, unmarked, hasChildren, hasNoChildren, mailboxName, delimiter);
}
/**
- * (from rfc3501)
- * The LIST command returns a subset of names from the complete set
- * of all names available to the client. Zero or more untagged LIST
- * replies are returned, containing the name attributes, hierarchy
- * delimiter, and name; see the description of the LIST reply for
- * more detail.
- * ...
- * An empty ("" string) mailbox name argument is a special request to
- * return the hierarchy delimiter and the root name of the name given
- * in the reference. The value returned as the root MAY be the empty
- * string if the reference is non-rooted or is an empty string.
+ * (from rfc3501)<br>
+ * The LIST command returns a subset of names from the complete set of all
+ * names available to the client. Zero or more untagged LIST replies are
+ * returned, containing the name attributes, hierarchy delimiter, and name;
+ * see the description of the LIST reply for more detail.<br>
+ * ...<br>
+ * An empty ("" string) mailbox name argument is a special request to return
+ * the hierarchy delimiter and the root name of the name given in the
+ * reference. The value returned as the root MAY be the empty string if the
+ * reference is non-rooted or is an empty string.
*
* @param referenceName
* @param mailboxName
@@ -91,9 +89,7 @@ public class ListProcessor extends Abstr
* @param command
* @param responder
*/
- protected final void doProcess(final String referenceName,
- final String mailboxName, final ImapSession session,
- final String tag, ImapCommand command, final Responder responder,final MailboxTyper mailboxTyper) {
+ protected final void doProcess(final String referenceName, final String mailboxName, final ImapSession session, final String tag, ImapCommand command, final Responder responder, final MailboxTyper mailboxTyper) {
try {
// Should the namespace section be returned or not?
final boolean isRelative;
@@ -114,13 +110,12 @@ public class ListProcessor extends Abstr
int firstDelimiter = referenceName.indexOf(mailboxSession.getPathDelimiter());
if (firstDelimiter == -1) {
referenceRoot = referenceName;
- }
- else {
+ } else {
referenceRoot = referenceName.substring(0, firstDelimiter);
}
- }
- else {
- // A relative reference name, return "" to indicate it is non-rooted
+ } else {
+ // A relative reference name, return "" to indicate it is
+ // non-rooted
referenceRoot = "";
isRelative = true;
}
@@ -128,9 +123,9 @@ public class ListProcessor extends Abstr
MailboxPath rootPath = new MailboxPath(referenceRoot, "", "");
results = new ArrayList<MailboxMetaData>(1);
results.add(SimpleMailboxMetaData.createNoSelect(rootPath, mailboxSession.getPathDelimiter()));
- }
- else {
- // If the mailboxPattern is fully qualified, ignore the reference name.
+ } else {
+ // If the mailboxPattern is fully qualified, ignore the
+ // reference name.
String finalReferencename = referenceName;
if (mailboxName.charAt(0) == MailboxConstants.NAMESPACE_PREFIX_CHAR) {
finalReferencename = "";
@@ -141,17 +136,15 @@ public class ListProcessor extends Abstr
MailboxPath basePath = null;
if (isRelative) {
basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, finalReferencename);
- }
- else {
+ } else {
basePath = buildFullPath(session, finalReferencename);
}
- results = getMailboxManager().search(new MailboxQuery(basePath, mailboxName, mailboxSession.getPathDelimiter()),
- mailboxSession);
+ results = getMailboxManager().search(new MailboxQuery(basePath, mailboxName, mailboxSession.getPathDelimiter()), mailboxSession);
}
- for (final MailboxMetaData metaData: results) {
- processResult(responder, isRelative, metaData,getMailboxType(session,mailboxTyper,metaData.getPath()));
+ for (final MailboxMetaData metaData : results) {
+ processResult(responder, isRelative, metaData, getMailboxType(session, mailboxTyper, metaData.getPath()));
}
okComplete(command, tag, responder);
@@ -160,7 +153,7 @@ public class ListProcessor extends Abstr
}
}
- void processResult(final Responder responder, final boolean relative, final MailboxMetaData listResult,final MailboxType mailboxType) {
+ void processResult(final Responder responder, final boolean relative, final MailboxMetaData listResult, final MailboxType mailboxType) {
final char delimiter = listResult.getHierarchyDelimiter();
final String mailboxName = mailboxName(relative, listResult.getPath(), delimiter);
@@ -172,27 +165,31 @@ public class ListProcessor extends Abstr
boolean marked = false;
boolean unmarked = false;
switch (listResult.getSelectability()) {
- case MARKED:
- marked = true;
- break;
- case UNMARKED:
- unmarked = true;
- break;
- case NOSELECT:
- noSelect = true;
- break;
- default:
- break;
+ case MARKED:
+ marked = true;
+ break;
+ case UNMARKED:
+ unmarked = true;
+ break;
+ case NOSELECT:
+ noSelect = true;
+ break;
+ default:
+ break;
}
- responder.respond(createResponse(noInferior, noSelect, marked,
- unmarked, hasChildren, hasNoChildren, mailboxName, delimiter,mailboxType));
+ responder.respond(createResponse(noInferior, noSelect, marked, unmarked, hasChildren, hasNoChildren, mailboxName, delimiter, mailboxType));
}
/**
- * retrieve mailboxType for specified mailboxPath using provided MailboxTyper
- * @param session current imap session
- * @param mailboxTyper provided MailboxTyper used to retrieve mailbox type
- * @param path mailbox's path
+ * retrieve mailboxType for specified mailboxPath using provided
+ * MailboxTyper
+ *
+ * @param session
+ * current imap session
+ * @param mailboxTyper
+ * provided MailboxTyper used to retrieve mailbox type
+ * @param path
+ * mailbox's path
* @return MailboxType value
*/
private MailboxType getMailboxType(ImapSession session, MailboxTyper mailboxTyper, MailboxPath path) {
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java Thu Apr 14 11:21:11 2011
@@ -39,25 +39,27 @@ import org.apache.james.mailbox.MailboxS
public class LoginProcessor extends AbstractMailboxProcessor<LoginRequest> {
public static final String INBOX = "INBOX";
-
+
private static final String ATTRIBUTE_NUMBER_OF_FAILURES = "org.apache.james.imap.processor.imap4rev1.LoginProcessor.NUMBER_OF_FAILURES";
// TODO: this should be configurable
private static final int MAX_FAILURES = 3;
- public LoginProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public LoginProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(LoginRequest.class, next, mailboxManager, factory);
}
-
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(LoginRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(LoginRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
try {
final String userid = request.getUserid();
final String passwd = request.getPassword();
@@ -65,8 +67,7 @@ public class LoginProcessor extends Abst
try {
final MailboxSession mailboxSession = mailboxManager.login(userid, passwd, session.getLog());
session.authenticated();
- session.setAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY,
- mailboxSession);
+ session.setAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY, mailboxSession);
final MailboxPath inboxPath = buildFullPath(session, INBOX);
if (mailboxManager.mailboxExists(inboxPath, mailboxSession)) {
session.getLog().debug("INBOX exists. No need to create it.");
@@ -80,8 +81,7 @@ public class LoginProcessor extends Abst
}
okComplete(command, tag, responder);
} catch (BadCredentialsException e) {
- final Integer currentNumberOfFailures = (Integer) session
- .getAttribute(ATTRIBUTE_NUMBER_OF_FAILURES);
+ final Integer currentNumberOfFailures = (Integer) session.getAttribute(ATTRIBUTE_NUMBER_OF_FAILURES);
final int failures;
if (currentNumberOfFailures == null) {
failures = 1;
@@ -89,10 +89,8 @@ public class LoginProcessor extends Abst
failures = currentNumberOfFailures.intValue() + 1;
}
if (failures < MAX_FAILURES) {
- session.setAttribute(ATTRIBUTE_NUMBER_OF_FAILURES,
- failures);
- no(command, tag, responder,
- HumanReadableText.INVALID_LOGIN);
+ session.setAttribute(ATTRIBUTE_NUMBER_OF_FAILURES, failures);
+ no(command, tag, responder, HumanReadableText.INVALID_LOGIN);
} else {
session.getLog().info("Too many authentication failures. Closing connection.");
bye(responder, HumanReadableText.TOO_MANY_FAILURES);
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java Thu Apr 14 11:21:11 2011
@@ -32,13 +32,11 @@ import org.apache.james.mailbox.MailboxS
public class LogoutProcessor extends AbstractMailboxProcessor<LogoutRequest> {
- public LogoutProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public LogoutProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(LogoutRequest.class, next, mailboxManager, factory);
}
-
- protected void doProcess(LogoutRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+
+ protected void doProcess(LogoutRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
try {
getMailboxManager().logout(mailboxSession, false);
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java Thu Apr 14 11:21:11 2011
@@ -38,17 +38,14 @@ import org.apache.james.mailbox.MailboxS
/**
* Processes a NAMESPACE command into a suitable set of responses.
*/
-public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceRequest> implements CapabilityImplementingProcessor{
-
- public NamespaceProcessor(ImapProcessor next,
- MailboxManager mailboxManager,
- StatusResponseFactory factory) {
- super(NamespaceRequest.class,next, mailboxManager, factory);
+public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceRequest> implements CapabilityImplementingProcessor {
+
+ public NamespaceProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory) {
+ super(NamespaceRequest.class, next, mailboxManager, factory);
}
@Override
- protected void doProcess(NamespaceRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(NamespaceRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
final List<NamespaceResponse.Namespace> personalNamespaces = buildPersonalNamespaces(mailboxSession);
final List<NamespaceResponse.Namespace> otherUsersNamespaces = buildOtherUsersSpaces(mailboxSession);
@@ -61,7 +58,9 @@ public class NamespaceProcessor extends
/**
* Builds personal namespaces from the session.
- * @param mailboxSession not null
+ *
+ * @param mailboxSession
+ * not null
* @return personal namespaces, not null
*/
private List<NamespaceResponse.Namespace> buildPersonalNamespaces(final MailboxSession mailboxSession) {
@@ -81,22 +80,24 @@ public class NamespaceProcessor extends
}
return otherUsersSpaces;
}
-
+
private List<NamespaceResponse.Namespace> buildSharedNamespaces(final MailboxSession mailboxSession) {
List<NamespaceResponse.Namespace> sharedNamespaces = null;
final Collection<String> sharedSpaces = mailboxSession.getSharedSpaces();
if (!sharedSpaces.isEmpty()) {
sharedNamespaces = new ArrayList<NamespaceResponse.Namespace>(sharedSpaces.size());
- for (String space: sharedSpaces) {
+ for (String space : sharedSpaces) {
sharedNamespaces.add(new NamespaceResponse.Namespace(space, mailboxSession.getPathDelimiter()));
- }
+ }
}
return sharedNamespaces;
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
+ *
+ * @see org.apache.james.imap.processor.CapabilityImplementingProcessor#
+ * getImplementedCapabilities(org.apache.james.imap.api.process.ImapSession)
*/
public List<String> getImplementedCapabilities(ImapSession session) {
return Arrays.asList(SUPPORTS_NAMESPACES);
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NoopProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NoopProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/NoopProcessor.java Thu Apr 14 11:21:11 2011
@@ -28,14 +28,11 @@ import org.apache.james.mailbox.MailboxM
public class NoopProcessor extends AbstractMailboxProcessor<NoopRequest> {
- public NoopProcessor(final ImapProcessor next, final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public NoopProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(NoopRequest.class, next, mailboxManager, factory);
}
-
- protected void doProcess(NoopRequest message, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(NoopRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) {
// So, unsolicated responses are returned to check for new mail
unsolicitedResponses(session, responder, false);
okComplete(command, tag, responder);
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java?rev=1092137&r1=1092136&r2=1092137&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java Thu Apr 14 11:21:11 2011
@@ -36,18 +36,21 @@ import org.apache.james.mailbox.MailboxS
public class RenameProcessor extends AbstractMailboxProcessor<RenameRequest> {
- public RenameProcessor(final ImapProcessor next,
- final MailboxManager mailboxManager,
- final StatusResponseFactory factory) {
+ public RenameProcessor(final ImapProcessor next, final MailboxManager mailboxManager, final StatusResponseFactory factory) {
super(RenameRequest.class, next, mailboxManager, factory);
}
/*
* (non-Javadoc)
- * @see org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org.apache.james.imap.api.message.request.ImapRequest, org.apache.james.imap.api.process.ImapSession, java.lang.String, org.apache.james.imap.api.ImapCommand, org.apache.james.imap.api.process.ImapProcessor.Responder)
+ *
+ * @see
+ * org.apache.james.imap.processor.AbstractMailboxProcessor#doProcess(org
+ * .apache.james.imap.api.message.request.ImapRequest,
+ * org.apache.james.imap.api.process.ImapSession, java.lang.String,
+ * org.apache.james.imap.api.ImapCommand,
+ * org.apache.james.imap.api.process.ImapProcessor.Responder)
*/
- protected void doProcess(RenameRequest request, ImapSession session,
- String tag, ImapCommand command, Responder responder) {
+ protected void doProcess(RenameRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
final MailboxPath existingPath = buildFullPath(session, request.getExistingName());
final MailboxPath newPath = buildFullPath(session, request.getNewName());
try {
@@ -55,12 +58,9 @@ public class RenameProcessor extends Abs
MailboxSession mailboxsession = ImapSessionUtils.getMailboxSession(session);
mailboxManager.renameMailbox(existingPath, newPath, mailboxsession);
- if (existingPath.getName().equalsIgnoreCase(
- ImapConstants.INBOX_NAME)
- && mailboxManager.mailboxExists(existingPath,
- mailboxsession) == false) {
- mailboxManager.createMailbox(existingPath, mailboxsession);
- }
+ if (existingPath.getName().equalsIgnoreCase(ImapConstants.INBOX_NAME) && mailboxManager.mailboxExists(existingPath, mailboxsession) == false) {
+ mailboxManager.createMailbox(existingPath, mailboxsession);
+ }
okComplete(command, tag, responder);
unsolicitedResponses(session, responder, false);
} catch (MailboxExistsException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org