You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/09/18 23:45:03 UTC

svn commit: r696828 [15/32] - in /james/protocols/imap/trunk: api/src/main/java/org/apache/james/api/imap/ api/src/main/java/org/apache/james/api/imap/display/ api/src/main/java/org/apache/james/api/imap/imap4rev1/ api/src/main/java/org/apache/james/ap...

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AbstractMailboxSelectionProcessor.java Thu Sep 18 14:44:56 2008
@@ -53,14 +53,17 @@
 
 abstract public class AbstractMailboxSelectionProcessor extends
         AbstractMailboxAwareProcessor {
-    
+
     private final FlagsResponse standardFlags;
+
     final StatusResponseFactory statusResponseFactory;
+
     private final boolean openReadOnly;
-    
+
     public AbstractMailboxSelectionProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, 
-            final StatusResponseFactory statusResponseFactory, final boolean openReadOnly) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory statusResponseFactory,
+            final boolean openReadOnly) {
         super(next, mailboxManagerProvider, statusResponseFactory);
         this.statusResponseFactory = statusResponseFactory;
         this.openReadOnly = openReadOnly;
@@ -72,9 +75,9 @@
         flags.add(Flags.Flag.SEEN);
         standardFlags = new FlagsResponse(flags);
     }
-    
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final AbstractMailboxSelectionRequest request = (AbstractMailboxSelectionRequest) message;
         final String mailboxName = request.getMailboxName();
         try {
@@ -82,21 +85,23 @@
             selectMailbox(fullMailboxName, session);
             respond(tag, command, session, responder);
         } catch (MailboxNotFoundException e) {
-            responder.respond(statusResponseFactory.taggedNo(tag, command, 
+            responder.respond(statusResponseFactory.taggedNo(tag, command,
                     HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX));
         } catch (MailboxManagerException e) {
             no(command, tag, responder, e);
-        } 
+        }
     }
 
     private void respond(String tag, ImapCommand command, ImapSession session,
             Responder responder) throws MailboxManagerException {
-        
+
         Mailbox mailbox = ImapSessionUtils.getMailbox(session);
-        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
+        final MailboxSession mailboxSession = ImapSessionUtils
+                .getMailboxSession(session);
         final SelectedImapMailbox selected = session.getSelected();
-        
-        // TODO: compact this into a single API call for meta-data about the repository
+
+        // TODO: compact this into a single API call for meta-data about the
+        // repository
         flags(responder);
         exists(responder, mailbox, mailboxSession);
         recent(responder, selected);
@@ -106,7 +111,8 @@
         taggedOk(responder, tag, command, mailbox);
     }
 
-    private void taggedOk(final Responder responder, final String tag, final ImapCommand command, final Mailbox mailbox) {
+    private void taggedOk(final Responder responder, final String tag,
+            final ImapCommand command, final Mailbox mailbox) {
         final boolean writeable = mailbox.isWriteable() && !openReadOnly;
         final ResponseCode code;
         if (writeable) {
@@ -114,7 +120,8 @@
         } else {
             code = ResponseCode.readOnly();
         }
-        final StatusResponse taggedOk = statusResponseFactory.taggedOk(tag, command, HumanReadableTextKey.SELECT, code);
+        final StatusResponse taggedOk = statusResponseFactory.taggedOk(tag,
+                command, HumanReadableTextKey.SELECT, code);
         responder.respond(taggedOk);
     }
 
@@ -124,24 +131,33 @@
 
     private void permanentFlags(Responder responder, Mailbox mailbox) {
         final Flags permanentFlags = mailbox.getPermanentFlags();
-        final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableTextKey.PERMANENT_FLAGS, ResponseCode.permanentFlags(permanentFlags));
+        final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(
+                HumanReadableTextKey.PERMANENT_FLAGS, ResponseCode
+                        .permanentFlags(permanentFlags));
         responder.respond(untaggedOk);
     }
 
-    private void unseen(Responder responder, Mailbox mailbox, final MailboxSession mailboxSession, final SelectedImapMailbox selected) throws MailboxManagerException {
-        final MessageResult firstUnseen = mailbox.getFirstUnseen(FetchGroupImpl.MINIMAL, mailboxSession);
+    private void unseen(Responder responder, Mailbox mailbox,
+            final MailboxSession mailboxSession,
+            final SelectedImapMailbox selected) throws MailboxManagerException {
+        final MessageResult firstUnseen = mailbox.getFirstUnseen(
+                FetchGroupImpl.MINIMAL, mailboxSession);
         if (firstUnseen != null) {
             final long unseenUid = firstUnseen.getUid();
             int msn = selected.msn(unseenUid);
-            final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableTextKey.UNSEEN, ResponseCode.unseen(msn));
+            final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(
+                    HumanReadableTextKey.UNSEEN, ResponseCode.unseen(msn));
             responder.respond(untaggedOk);
         }
-        
+
     }
 
-    private void uidValidity(Responder responder, Mailbox mailbox, final MailboxSession mailboxSession) throws MailboxManagerException {
+    private void uidValidity(Responder responder, Mailbox mailbox,
+            final MailboxSession mailboxSession) throws MailboxManagerException {
         final long uidValidity = mailbox.getUidValidity(mailboxSession);
-        final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableTextKey.UID_VALIDITY, ResponseCode.uidValidity(uidValidity));
+        final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(
+                HumanReadableTextKey.UID_VALIDITY, ResponseCode
+                        .uidValidity(uidValidity));
         responder.respond(untaggedOk);
     }
 
@@ -151,38 +167,45 @@
         responder.respond(recentResponse);
     }
 
-    private void exists(Responder responder, Mailbox mailbox, final MailboxSession mailboxSession) throws MailboxManagerException {
+    private void exists(Responder responder, Mailbox mailbox,
+            final MailboxSession mailboxSession) throws MailboxManagerException {
         final int messageCount = mailbox.getMessageCount(mailboxSession);
         final ExistsResponse existsResponse = new ExistsResponse(messageCount);
         responder.respond(existsResponse);
     }
 
-    private void selectMailbox(String mailboxName, ImapSession session) throws MailboxManagerException {
+    private void selectMailbox(String mailboxName, ImapSession session)
+            throws MailboxManagerException {
         final MailboxManager mailboxManager = getMailboxManager(session);
         final Mailbox mailbox = mailboxManager.getMailbox(mailboxName, false);
-        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
+        final MailboxSession mailboxSession = ImapSessionUtils
+                .getMailboxSession(session);
 
         final SelectedImapMailbox sessionMailbox;
         final SelectedImapMailbox currentMailbox = session.getSelected();
-        if (currentMailbox == null || !currentMailbox.getName().equals(mailboxName)) {
-            sessionMailbox = createNewSelectedMailbox(mailbox, mailboxSession, session);            
+        if (currentMailbox == null
+                || !currentMailbox.getName().equals(mailboxName)) {
+            sessionMailbox = createNewSelectedMailbox(mailbox, mailboxSession,
+                    session);
         } else {
             sessionMailbox = currentMailbox;
         }
         addRecent(mailbox, mailboxSession, sessionMailbox);
     }
 
-    private SelectedImapMailbox createNewSelectedMailbox(final Mailbox mailbox, final MailboxSession mailboxSession,
-            ImapSession session) throws MailboxManagerException {
+    private SelectedImapMailbox createNewSelectedMailbox(final Mailbox mailbox,
+            final MailboxSession mailboxSession, ImapSession session)
+            throws MailboxManagerException {
         final SelectedImapMailbox sessionMailbox;
-        final Iterator it = mailbox.getMessages(MessageRangeImpl
-                .all(), FetchGroupImpl.MINIMAL, mailboxSession);
+        final Iterator it = mailbox.getMessages(MessageRangeImpl.all(),
+                FetchGroupImpl.MINIMAL, mailboxSession);
         final List uids = new ArrayList();
-        while(it.hasNext()) {
+        while (it.hasNext()) {
             final MessageResult result = (MessageResult) it.next();
             uids.add(new Long(result.getUid()));
         }
-        sessionMailbox = new SelectedMailboxSessionImpl(mailbox, uids, mailboxSession);
+        sessionMailbox = new SelectedMailboxSessionImpl(mailbox, uids,
+                mailboxSession);
         session.selected(sessionMailbox);
         session.setAttribute(
                 ImapSessionUtils.SELECTED_MAILBOX_ATTRIBUTE_SESSION_KEY,
@@ -190,11 +213,13 @@
         return sessionMailbox;
     }
 
-    private void addRecent(final Mailbox mailbox, final MailboxSession mailboxSession, SelectedImapMailbox sessionMailbox) throws MailboxManagerException {
+    private void addRecent(final Mailbox mailbox,
+            final MailboxSession mailboxSession,
+            SelectedImapMailbox sessionMailbox) throws MailboxManagerException {
         final long[] recentUids = mailbox.recent(!openReadOnly, mailboxSession);
         for (int i = 0; i < recentUids.length; i++) {
             long uid = recentUids[i];
-            sessionMailbox.addRecent(uid);    
+            sessionMailbox.addRecent(uid);
         }
     }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AppendProcessor.java Thu Sep 18 14:44:56 2008
@@ -49,9 +49,10 @@
 public class AppendProcessor extends AbstractMailboxAwareProcessor {
 
     final StatusResponseFactory statusResponseFactory;
-    
+
     public AppendProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory statusResponseFactory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory statusResponseFactory) {
         super(next, mailboxManagerProvider, statusResponseFactory);
         this.statusResponseFactory = statusResponseFactory;
     }
@@ -60,8 +61,8 @@
         return (message instanceof AppendRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder){
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final AppendRequest request = (AppendRequest) message;
         final String mailboxName = request.getMailboxName();
         final MimeMessage mimeMessage = request.getMessage();
@@ -69,15 +70,18 @@
         // TODO: Flags are ignore: check whether the specification says that
         // they should be processed
         try {
-            
+
             final String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager(session);
-            final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName, false);
-            appendToMailbox(mimeMessage, datetime, session, tag, command, mailbox, responder);
-            
+            final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName,
+                    false);
+            appendToMailbox(mimeMessage, datetime, session, tag, command,
+                    mailbox, responder);
+
         } catch (MailboxManagerException mme) {
-            // Mailbox API does not provide facilities for diagnosing the problem
-            // assume that 
+            // Mailbox API does not provide facilities for diagnosing the
+            // problem
+            // assume that
             // TODO: improved API should communicate when this operation
             // TODO: fails whether the mailbox exists
             Log logger = getLog();
@@ -87,23 +91,27 @@
             if (logger.isDebugEnabled()) {
                 logger.debug("Cannot open mailbox: ", mme);
             }
-            no(command, tag, responder, HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX, 
+            no(command, tag, responder,
+                    HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX,
                     StatusResponse.ResponseCode.tryCreate());
         }
 
     }
 
-    private void appendToMailbox(MimeMessage message, Date datetime, 
-            ImapSession session, String tag, ImapCommand command, Mailbox mailbox,
-            Responder responder) {
+    private void appendToMailbox(MimeMessage message, Date datetime,
+            ImapSession session, String tag, ImapCommand command,
+            Mailbox mailbox, Responder responder) {
         try {
-            final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
+            final MailboxSession mailboxSession = ImapSessionUtils
+                    .getMailboxSession(session);
             final SelectedImapMailbox selectedMailbox = session.getSelected();
-            final boolean isSelectedMailbox = selectedMailbox != null && mailbox.getName().equals(selectedMailbox.getName());
+            final boolean isSelectedMailbox = selectedMailbox != null
+                    && mailbox.getName().equals(selectedMailbox.getName());
             if (!isSelectedMailbox) {
                 message.setFlag(Flag.RECENT, true);
             }
-            final MessageResult result = mailbox.appendMessage(message, datetime, FetchGroupImpl.MINIMAL, mailboxSession);
+            final MessageResult result = mailbox.appendMessage(message,
+                    datetime, FetchGroupImpl.MINIMAL, mailboxSession);
             final long uid = result.getUid();
             if (isSelectedMailbox) {
                 selectedMailbox.addRecent(uid);
@@ -116,6 +124,6 @@
         } catch (MessagingException e) {
             no(command, tag, responder, e);
         }
-        
+
     }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/AuthenticateProcessor.java Thu Sep 18 14:44:56 2008
@@ -31,7 +31,8 @@
 
 public class AuthenticateProcessor extends AbstractImapRequestProcessor {
 
-    public AuthenticateProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public AuthenticateProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -39,12 +40,14 @@
         return (message instanceof AuthenticateRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final AuthenticateRequest request = (AuthenticateRequest) message;
         final String authType = request.getAuthType();
-        getLog().info("Unsupported authentication mechanism '" + authType + "'");
-        no(command, tag, responder, HumanReadableTextKey.UNSUPPORTED_AUTHENTICATION_MECHANISM);
+        getLog()
+                .info("Unsupported authentication mechanism '" + authType + "'");
+        no(command, tag, responder,
+                HumanReadableTextKey.UNSUPPORTED_AUTHENTICATION_MECHANISM);
     }
 
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CapabilityProcessor.java Thu Sep 18 14:44:56 2008
@@ -35,7 +35,7 @@
 
     // TODO: capability text should be injected
 
-    public CapabilityProcessor(final ImapProcessor next, 
+    public CapabilityProcessor(final ImapProcessor next,
             final StatusResponseFactory factory) {
         super(next, factory);
     }
@@ -44,8 +44,8 @@
         return (message instanceof CapabilityRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final CapabilityRequest request = (CapabilityRequest) message;
         final ImapResponseMessage result = doProcess(request, session, tag,
                 command);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CheckProcessor.java Thu Sep 18 14:44:56 2008
@@ -30,7 +30,8 @@
 
 public class CheckProcessor extends AbstractImapRequestProcessor {
 
-    public CheckProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public CheckProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -38,8 +39,8 @@
         return (message instanceof CheckRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         unsolicitedResponses(session, responder, false);
         okComplete(command, tag, responder);
     }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CloseProcessor.java Thu Sep 18 14:44:56 2008
@@ -36,7 +36,8 @@
 
 public class CloseProcessor extends AbstractImapRequestProcessor {
 
-    public CloseProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public CloseProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -44,14 +45,15 @@
         return (message instanceof CloseRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         Mailbox mailbox = ImapSessionUtils.getMailbox(session);
         if (mailbox.isWriteable()) {
             try {
-                final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-                mailbox.expunge(MessageRangeImpl.all(),
-                        FetchGroupImpl.MINIMAL, mailboxSession);
+                final MailboxSession mailboxSession = ImapSessionUtils
+                        .getMailboxSession(session);
+                mailbox.expunge(MessageRangeImpl.all(), FetchGroupImpl.MINIMAL,
+                        mailboxSession);
                 session.deselect();
                 // TODO: the following comment was present in the code before
                 // refactoring

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CopyProcessor.java Thu Sep 18 14:44:56 2008
@@ -42,7 +42,8 @@
 public class CopyProcessor extends AbstractMailboxAwareProcessor {
 
     public CopyProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
 
@@ -50,21 +51,22 @@
         return (message instanceof CopyRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final CopyRequest request = (CopyRequest) message;
         final String mailboxName = request.getMailboxName();
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
-        Mailbox currentMailbox = ImapSessionUtils
-                .getMailbox(session);
+        Mailbox currentMailbox = ImapSessionUtils.getMailbox(session);
         try {
             String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager(session);
-            final boolean mailboxExists = mailboxManager.existsMailbox(fullMailboxName);
+            final boolean mailboxExists = mailboxManager
+                    .existsMailbox(fullMailboxName);
             if (!mailboxExists) {
-                no(command, tag, responder, 
-                        HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
+                no(command, tag, responder,
+                        HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX,
+                        ResponseCode.tryCreate());
             } else {
                 for (int i = 0; i < idSet.length; i++) {
                     final long highVal;
@@ -73,13 +75,17 @@
                         highVal = idSet[i].getHighVal();
                         lowVal = idSet[i].getLowVal();
                     } else {
-                        highVal = session.getSelected().uid((int)idSet[i].getHighVal());
-                        lowVal = session.getSelected().uid((int)idSet[i].getLowVal());
+                        highVal = session.getSelected().uid(
+                                (int) idSet[i].getHighVal());
+                        lowVal = session.getSelected().uid(
+                                (int) idSet[i].getLowVal());
                     }
-                    MessageRange messageSet = MessageRangeImpl.uidRange(lowVal, highVal);
-                    final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-                    mailboxManager.copyMessages(messageSet, currentMailbox.getName(), 
-                            fullMailboxName, mailboxSession);
+                    MessageRange messageSet = MessageRangeImpl.uidRange(lowVal,
+                            highVal);
+                    final MailboxSession mailboxSession = ImapSessionUtils
+                            .getMailboxSession(session);
+                    mailboxManager.copyMessages(messageSet, currentMailbox
+                            .getName(), fullMailboxName, mailboxSession);
                 }
                 unsolicitedResponses(session, responder, useUids);
                 okComplete(command, tag, responder);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/CreateProcessor.java Thu Sep 18 14:44:56 2008
@@ -34,7 +34,8 @@
 public class CreateProcessor extends AbstractMailboxAwareProcessor {
 
     public CreateProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
 
@@ -42,8 +43,8 @@
         return (message instanceof CreateRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final CreateRequest request = (CreateRequest) message;
         final String mailboxName = request.getMailboxName();
         try {

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/DeleteProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/DeleteProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/DeleteProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/DeleteProcessor.java Thu Sep 18 14:44:56 2008
@@ -35,7 +35,8 @@
 public class DeleteProcessor extends AbstractMailboxAwareProcessor {
 
     public DeleteProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
 
@@ -43,8 +44,8 @@
         return (message instanceof DeleteRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final DeleteRequest request = (DeleteRequest) message;
         final String mailboxName = request.getMailboxName();
         try {
@@ -56,10 +57,11 @@
                 }
             }
             final MailboxManager mailboxManager = getMailboxManager(session);
-            mailboxManager.deleteMailbox(fullMailboxName, ImapSessionUtils.getMailboxSession(session));
+            mailboxManager.deleteMailbox(fullMailboxName, ImapSessionUtils
+                    .getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
-            
+
         } catch (MailboxManagerException e) {
             no(command, tag, responder, e);
         }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ExpungeProcessor.java Thu Sep 18 14:44:56 2008
@@ -42,7 +42,8 @@
 public class ExpungeProcessor extends AbstractImapRequestProcessor {
 
     public ExpungeProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -50,18 +51,21 @@
         return (message instanceof ExpungeRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         Mailbox mailbox = ImapSessionUtils.getMailbox(session);
         if (!mailbox.isWriteable()) {
-            no(command, tag, responder, HumanReadableTextKey.MAILBOX_IS_READ_ONLY);
+            no(command, tag, responder,
+                    HumanReadableTextKey.MAILBOX_IS_READ_ONLY);
         } else {
             try {
                 final Iterator it = mailbox.expunge(MessageRangeImpl.all(),
-                        FetchGroupImpl.MINIMAL, ImapSessionUtils.getMailboxSession(session));
-                final SelectedImapMailbox mailboxSession = session.getSelected();
+                        FetchGroupImpl.MINIMAL, ImapSessionUtils
+                                .getMailboxSession(session));
+                final SelectedImapMailbox mailboxSession = session
+                        .getSelected();
                 if (mailboxSession != null) {
-                    while(it.hasNext()) {
+                    while (it.hasNext()) {
                         final MessageResult result = (MessageResult) it.next();
                         final long uid = result.getUid();
                         mailboxSession.removeRecent(uid);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java Thu Sep 18 14:44:56 2008
@@ -31,9 +31,9 @@
 
     public static final ImapProcessor createDefaultChain(
             final ImapProcessor chainEndProcessor,
-            final MailboxManagerProvider mailboxManagerProvider, 
+            final MailboxManagerProvider mailboxManagerProvider,
             final StatusResponseFactory statusResponseFactory) {
-        
+
         final LogoutProcessor logoutProcessor = new LogoutProcessor(
                 chainEndProcessor, statusResponseFactory);
         final CapabilityProcessor capabilityProcessor = new CapabilityProcessor(
@@ -47,26 +47,30 @@
         final DeleteProcessor deleteProcessor = new DeleteProcessor(
                 renameProcessor, mailboxManagerProvider, statusResponseFactory);
         final CreateProcessor createProcessor = new CreateProcessor(
-                deleteProcessor, mailboxManagerProvider,statusResponseFactory);
+                deleteProcessor, mailboxManagerProvider, statusResponseFactory);
         final CloseProcessor closeProcessor = new CloseProcessor(
-                createProcessor,statusResponseFactory);
+                createProcessor, statusResponseFactory);
         final UnsubscribeProcessor unsubscribeProcessor = new UnsubscribeProcessor(
                 closeProcessor, mailboxManagerProvider, statusResponseFactory);
         final SubscribeProcessor subscribeProcessor = new SubscribeProcessor(
-                unsubscribeProcessor, mailboxManagerProvider, statusResponseFactory);
+                unsubscribeProcessor, mailboxManagerProvider,
+                statusResponseFactory);
         final CopyProcessor copyProcessor = new CopyProcessor(
-                subscribeProcessor, mailboxManagerProvider, statusResponseFactory);
+                subscribeProcessor, mailboxManagerProvider,
+                statusResponseFactory);
         final AuthenticateProcessor authenticateProcessor = new AuthenticateProcessor(
                 copyProcessor, statusResponseFactory);
         final ExpungeProcessor expungeProcessor = new ExpungeProcessor(
-                authenticateProcessor, mailboxManagerProvider, statusResponseFactory);
+                authenticateProcessor, mailboxManagerProvider,
+                statusResponseFactory);
         final ExamineProcessor examineProcessor = new ExamineProcessor(
                 expungeProcessor, mailboxManagerProvider, statusResponseFactory);
         final AppendProcessor appendProcessor = new AppendProcessor(
                 examineProcessor, mailboxManagerProvider, statusResponseFactory);
         final StoreProcessor storeProcessor = new StoreProcessor(
                 appendProcessor, statusResponseFactory);
-        final NoopProcessor noopProcessor = new NoopProcessor(storeProcessor, statusResponseFactory);
+        final NoopProcessor noopProcessor = new NoopProcessor(storeProcessor,
+                statusResponseFactory);
         final StatusProcessor statusProcessor = new StatusProcessor(
                 noopProcessor, mailboxManagerProvider, statusResponseFactory);
         final LSubProcessor lsubProcessor = new LSubProcessor(statusProcessor,
@@ -77,7 +81,8 @@
                 listProcessor, statusResponseFactory);
         final SelectProcessor selectProcessor = new SelectProcessor(
                 searchProcessor, mailboxManagerProvider, statusResponseFactory);
-        final ImapProcessor result = new FetchProcessor(selectProcessor, statusResponseFactory);
+        final ImapProcessor result = new FetchProcessor(selectProcessor,
+                statusResponseFactory);
         return result;
     }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LSubProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LSubProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LSubProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LSubProcessor.java Thu Sep 18 14:44:56 2008
@@ -42,8 +42,9 @@
 import org.apache.james.mailboxmanager.manager.SubscriptionException;
 
 public class LSubProcessor extends AbstractMailboxAwareProcessor {
-    
-    public LSubProcessor(final ImapProcessor next, final MailboxManagerProvider mailboxManagerProvider, 
+
+    public LSubProcessor(final ImapProcessor next,
+            final MailboxManagerProvider mailboxManagerProvider,
             final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
@@ -52,8 +53,8 @@
         return (message instanceof LsubRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final LsubRequest request = (LsubRequest) message;
         final String referenceName = request.getBaseReferenceName();
         final String mailboxPattern = request.getMailboxPattern();
@@ -61,13 +62,14 @@
         try {
             if (mailboxPattern.length() == 0) {
                 respondWithHierarchyDelimiter(responder);
-                
+
             } else {
-                listSubscriptions(session, responder, referenceName, mailboxPattern);
-            }        
+                listSubscriptions(session, responder, referenceName,
+                        mailboxPattern);
+            }
 
             okComplete(command, tag, responder);
-            
+
         } catch (SubscriptionException e) {
             getLog().debug("Subscription failed", e);
             final HumanReadableTextKey exceptionKey = e.getKey();
@@ -82,51 +84,62 @@
             getLog().debug("Subscription failed", e);
             final HumanReadableTextKey displayTextKey = HumanReadableTextKey.GENERIC_LSUB_FAILURE;
             no(command, tag, responder, displayTextKey);
-        } 
+        }
     }
 
-    private void listSubscriptions(ImapSession session, Responder responder, final String referenceName, final String mailboxPattern) throws SubscriptionException, MailboxManagerException {
+    private void listSubscriptions(ImapSession session, Responder responder,
+            final String referenceName, final String mailboxPattern)
+            throws SubscriptionException, MailboxManagerException {
         final String userName = ImapSessionUtils.getUserName(session);
         final MailboxManager manager = getMailboxManager(session);
         final Collection mailboxes = manager.subscriptions(userName);
-        final MailboxExpression expression 
-            = new MailboxExpression(referenceName, mailboxPattern, '*', '%');
+        final MailboxExpression expression = new MailboxExpression(
+                referenceName, mailboxPattern, '*', '%');
         final Collection mailboxResponses = new ArrayList();
-        for (final Iterator it=mailboxes.iterator();it.hasNext();) {
+        for (final Iterator it = mailboxes.iterator(); it.hasNext();) {
             final String mailboxName = (String) it.next();
-            respond(responder, expression, mailboxName, true, mailboxes, mailboxResponses);
+            respond(responder, expression, mailboxName, true, mailboxes,
+                    mailboxResponses);
         }
     }
 
-    private void respond(Responder responder, final MailboxExpression expression, final String mailboxName, 
-            final boolean originalSubscription, final Collection mailboxes, final Collection mailboxResponses) {
-        if (expression.isExpressionMatch(mailboxName, ImapConstants.HIERARCHY_DELIMITER_CHAR)) {
-            if (!mailboxResponses.contains(mailboxName))
-            {
-                final LSubResponse response = new LSubResponse(mailboxName, ImapConstants.HIERARCHY_DELIMITER, !originalSubscription);
+    private void respond(Responder responder,
+            final MailboxExpression expression, final String mailboxName,
+            final boolean originalSubscription, final Collection mailboxes,
+            final Collection mailboxResponses) {
+        if (expression.isExpressionMatch(mailboxName,
+                ImapConstants.HIERARCHY_DELIMITER_CHAR)) {
+            if (!mailboxResponses.contains(mailboxName)) {
+                final LSubResponse response = new LSubResponse(mailboxName,
+                        ImapConstants.HIERARCHY_DELIMITER,
+                        !originalSubscription);
                 responder.respond(response);
                 mailboxResponses.add(mailboxName);
             }
-        }
-        else
-        {
-            final int lastDelimiter = mailboxName.lastIndexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
+        } else {
+            final int lastDelimiter = mailboxName
+                    .lastIndexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
             if (lastDelimiter > 0) {
-                final String parentMailbox = mailboxName.substring(0, lastDelimiter);
+                final String parentMailbox = mailboxName.substring(0,
+                        lastDelimiter);
                 if (!mailboxes.contains(parentMailbox)) {
-                    respond(responder, expression, parentMailbox, false, mailboxes, mailboxResponses);
+                    respond(responder, expression, parentMailbox, false,
+                            mailboxes, mailboxResponses);
                 }
             }
         }
     }
 
-    /** 
+    /**
      * An empty mailboxPattern signifies a request for the hierarchy delimiter
      * and root name of the referenceName argument
-     * @param referenceName IMAP reference name, possibly null
+     * 
+     * @param referenceName
+     *            IMAP reference name, possibly null
      */
     private void respondWithHierarchyDelimiter(final Responder responder) {
-        final LSubResponse response = new LSubResponse("", ImapConstants.HIERARCHY_DELIMITER, true);
+        final LSubResponse response = new LSubResponse("",
+                ImapConstants.HIERARCHY_DELIMITER, true);
         responder.respond(response);
     }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/ListProcessor.java Thu Sep 18 14:44:56 2008
@@ -41,7 +41,8 @@
 public class ListProcessor extends AbstractMailboxAwareProcessor {
 
     public ListProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
 
@@ -49,27 +50,25 @@
         return (message instanceof ListRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final ListRequest request = (ListRequest) message;
         final String baseReferenceName = request.getBaseReferenceName();
         final String mailboxPatternString = request.getMailboxPattern();
-        doProcess(baseReferenceName,
-                mailboxPatternString, session, tag, command,responder);
+        doProcess(baseReferenceName, mailboxPatternString, session, tag,
+                command, responder);
     }
 
-
-    protected ImapResponseMessage createResponse(boolean noInferior, boolean noSelect, boolean marked, boolean unmarked, String hierarchyDelimiter, String mailboxName) {
-        return new ListResponse(noInferior, noSelect, marked, unmarked, hierarchyDelimiter, mailboxName);
+    protected ImapResponseMessage createResponse(boolean noInferior,
+            boolean noSelect, boolean marked, boolean unmarked,
+            String hierarchyDelimiter, String mailboxName) {
+        return new ListResponse(noInferior, noSelect, marked, unmarked,
+                hierarchyDelimiter, mailboxName);
     }
-    
 
-    protected final void doProcess(
-            final String baseReferenceName, 
-            final String mailboxPattern,
-            final ImapSession session, 
-            final String tag, ImapCommand command,
-            final Responder responder) {
+    protected final void doProcess(final String baseReferenceName,
+            final String mailboxPattern, final ImapSession session,
+            final String tag, ImapCommand command, final Responder responder) {
         try {
             String referenceName = baseReferenceName;
             // Should the #user.userName section be removed from names returned?
@@ -79,7 +78,7 @@
 
             final String user = ImapSessionUtils.getUserName(session);
             final String personalNamespace = ImapConstants.USER_NAMESPACE
-            + ImapConstants.HIERARCHY_DELIMITER_CHAR + user;
+                    + ImapConstants.HIERARCHY_DELIMITER_CHAR + user;
 
             if (mailboxPattern.length() == 0) {
                 // An empty mailboxPattern signifies a request for the hierarchy
@@ -92,14 +91,16 @@
                     // and don't remove the user prefix
                     removeUserPrefix = false;
                     int firstDelimiter = referenceName
-                    .indexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
+                            .indexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
                     if (firstDelimiter == -1) {
                         referenceRoot = referenceName;
                     } else {
-                        referenceRoot = referenceName.substring(0, firstDelimiter);
+                        referenceRoot = referenceName.substring(0,
+                                firstDelimiter);
                     }
                 } else {
-                    // A relative reference name - need to remove user prefix from
+                    // A relative reference name - need to remove user prefix
+                    // from
                     // results.
                     referenceRoot = "";
                     removeUserPrefix = true;
@@ -108,7 +109,8 @@
 
                 // Get the mailbox for the reference name.
                 listResults = new ListResult[1];
-                listResults[0] = ListResultImpl.createNoSelect(referenceRoot, ImapConstants.HIERARCHY_DELIMITER);
+                listResults[0] = ListResultImpl.createNoSelect(referenceRoot,
+                        ImapConstants.HIERARCHY_DELIMITER);
             } else {
 
                 // If the mailboxPattern is fully qualified, ignore the
@@ -132,19 +134,22 @@
 
             for (int i = 0; i < listResults.length; i++) {
                 final ListResult listResult = listResults[i];
-                processResult(responder, removeUserPrefix, prefixLength, listResult);
-            }   
+                processResult(responder, removeUserPrefix, prefixLength,
+                        listResult);
+            }
 
             okComplete(command, tag, responder);
         } catch (MailboxManagerException e) {
-            no(command,tag, responder, e);
+            no(command, tag, responder, e);
         }
     }
 
-    void processResult(final Responder responder, final boolean removeUserPrefix, 
-            int prefixLength, final ListResult listResult) {
+    void processResult(final Responder responder,
+            final boolean removeUserPrefix, int prefixLength,
+            final ListResult listResult) {
         final String delimiter = listResult.getHierarchyDelimiter();
-        final String mailboxName = mailboxName(removeUserPrefix, prefixLength, listResult);
+        final String mailboxName = mailboxName(removeUserPrefix, prefixLength,
+                listResult);
 
         final boolean noInferior = listResult.isNoInferiors();
         boolean noSelect = false;
@@ -156,16 +161,17 @@
                 break;
             case ListResult.SELECTABILITY_FLAG_UNMARKED:
                 unmarked = true;
-                break;                
+                break;
             case ListResult.SELECTABILITY_FLAG_NOSELECT:
                 noSelect = true;
                 break;
         }
-        responder.respond(createResponse(noInferior, noSelect, marked, unmarked, 
-                delimiter, mailboxName));
+        responder.respond(createResponse(noInferior, noSelect, marked,
+                unmarked, delimiter, mailboxName));
     }
 
-    private String mailboxName(final boolean removeUserPrefix, int prefixLength, final ListResult listResult) {
+    private String mailboxName(final boolean removeUserPrefix,
+            int prefixLength, final ListResult listResult) {
         final String mailboxName;
         final String name = listResult.getName();
         if (removeUserPrefix) {
@@ -179,11 +185,12 @@
         }
         return mailboxName;
     }
-   
+
     protected final ListResult[] doList(ImapSession session, String base,
-            String pattern) throws MailboxManagerException  {
+            String pattern) throws MailboxManagerException {
         final MailboxManager mailboxManager = getMailboxManager(session);
-        final ListResult[] result = mailboxManager.list(new MailboxExpression(base,pattern, '*', '%'));
+        final ListResult[] result = mailboxManager.list(new MailboxExpression(
+                base, pattern, '*', '%'));
         return result;
     }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LoginProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LoginProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LoginProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LoginProcessor.java Thu Sep 18 14:44:56 2008
@@ -38,12 +38,13 @@
  */
 public class LoginProcessor extends AbstractMailboxAwareProcessor {
 
-    private static final String ATTRIBUTE_NUMBER_OF_FAILURES 
-        = "org.apache.james.imapserver.processor.imap4rev1.LoginProcessor.NUMBER_OF_FAILURES";
+    private static final String ATTRIBUTE_NUMBER_OF_FAILURES = "org.apache.james.imapserver.processor.imap4rev1.LoginProcessor.NUMBER_OF_FAILURES";
+
     // TODO: this should be configurable
     private static final int MAX_FAILURES = 3;
 
-    public LoginProcessor(final ImapProcessor next, final MailboxManagerProvider mailboxManagerProvider, 
+    public LoginProcessor(final ImapProcessor next,
+            final MailboxManagerProvider mailboxManagerProvider,
             final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
@@ -52,10 +53,9 @@
         return (message instanceof LoginRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
-        try
-        {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
+        try {
             final LoginRequest request = (LoginRequest) message;
             final String userid = request.getUserid();
             final String passwd = request.getPassword();
@@ -65,7 +65,8 @@
                 ImapSessionUtils.setUserName(session, userid);
                 okComplete(command, tag, responder);
             } else {
-                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;
@@ -73,8 +74,10 @@
                     failures = currentNumberOfFailures.intValue() + 1;
                 }
                 if (failures < MAX_FAILURES) {
-                    session.setAttribute(ATTRIBUTE_NUMBER_OF_FAILURES, new Integer(failures));
-                    no(command,tag, responder, HumanReadableTextKey.INVALID_LOGIN);
+                    session.setAttribute(ATTRIBUTE_NUMBER_OF_FAILURES,
+                            new Integer(failures));
+                    no(command, tag, responder,
+                            HumanReadableTextKey.INVALID_LOGIN);
                 } else {
                     bye(responder, HumanReadableTextKey.TOO_MANY_FAILURES);
                     session.logout();

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LogoutProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LogoutProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LogoutProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/LogoutProcessor.java Thu Sep 18 14:44:56 2008
@@ -30,7 +30,8 @@
 
 public class LogoutProcessor extends AbstractImapRequestProcessor {
 
-    public LogoutProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public LogoutProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -38,8 +39,8 @@
         return (message instanceof LogoutRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         session.logout();
         bye(responder);
         okComplete(command, tag, responder);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/NoopProcessor.java Thu Sep 18 14:44:56 2008
@@ -30,7 +30,8 @@
 
 public class NoopProcessor extends AbstractImapRequestProcessor {
 
-    public NoopProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public NoopProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -38,8 +39,8 @@
         return (message instanceof NoopRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final NoopRequest request = (NoopRequest) message;
         // TODO: untagged responses?
         // TODO: NOOP is used to check for new mail: need to return untagged

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/RenameProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/RenameProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/RenameProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/RenameProcessor.java Thu Sep 18 14:44:56 2008
@@ -37,7 +37,8 @@
 public class RenameProcessor extends AbstractMailboxAwareProcessor {
 
     public RenameProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
 
@@ -45,24 +46,26 @@
         return (message instanceof RenameRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final RenameRequest request = (RenameRequest) message;
         final String existingName = request.getExistingName();
         final String newName = request.getNewName();
         try {
-            
+
             final String fullExistingName = buildFullName(session, existingName);
             final String fullNewName = buildFullName(session, newName);
             final MailboxManager mailboxManager = getMailboxManager(session);
             mailboxManager.renameMailbox(fullExistingName, fullNewName);
             okComplete(command, tag, responder);
             unsolicitedResponses(session, responder, false);
-            
+
         } catch (MailboxExistsException e) {
-            no(command, tag, responder, HumanReadableTextKey.FAILURE_MAILBOX_EXISTS);
+            no(command, tag, responder,
+                    HumanReadableTextKey.FAILURE_MAILBOX_EXISTS);
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX);
+            no(command, tag, responder,
+                    HumanReadableTextKey.FAILURE_NO_SUCH_MAILBOX);
         } catch (MailboxManagerException e) {
             no(command, tag, responder, e);
         }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SearchProcessor.java Thu Sep 18 14:44:56 2008
@@ -52,7 +52,8 @@
 
 public class SearchProcessor extends AbstractImapRequestProcessor {
 
-    public SearchProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public SearchProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -60,20 +61,21 @@
         return (message instanceof SearchRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         try {
             final SearchRequest request = (SearchRequest) message;
             final SearchKey searchKey = request.getSearchKey();
             final boolean useUids = request.isUseUids();
             Mailbox mailbox = ImapSessionUtils.getMailbox(session);
             final FetchGroup fetchGroup = FetchGroupImpl.MINIMAL;
-    
+
             final SearchQuery query = toQuery(searchKey, session);
-            
-            final Collection results = findIds(useUids, session, mailbox, fetchGroup, query);
+
+            final Collection results = findIds(useUids, session, mailbox,
+                    fetchGroup, query);
             final long[] ids = toArray(results);
-            
+
             final SearchResponse response = new SearchResponse(ids);
             responder.respond(response);
             boolean omitExpunged = (!useUids);
@@ -94,9 +96,12 @@
         return ids;
     }
 
-    private Collection findIds(final boolean useUids, final ImapSession session, Mailbox mailbox, 
-            final FetchGroup fetchGroup, final SearchQuery query) throws MailboxManagerException {
-        final Iterator it = mailbox.search(query, fetchGroup, ImapSessionUtils.getMailboxSession(session));
+    private Collection findIds(final boolean useUids,
+            final ImapSession session, Mailbox mailbox,
+            final FetchGroup fetchGroup, final SearchQuery query)
+            throws MailboxManagerException {
+        final Iterator it = mailbox.search(query, fetchGroup, ImapSessionUtils
+                .getMailboxSession(session));
 
         final Collection results = new TreeSet();
         while (it.hasNext()) {
@@ -120,62 +125,114 @@
             final long[] recent = selected.getRecent();
             for (int i = 0; i < recent.length; i++) {
                 long uid = recent[i];
-                result.getRecentMessageUids().add(new Long(uid));   
+                result.getRecentMessageUids().add(new Long(uid));
             }
         }
         final SearchQuery.Criterion criterion = toCriterion(key, session);
         result.andCriteria(criterion);
         return result;
     }
-    
-    private SearchQuery.Criterion toCriterion(final SearchKey key, final ImapSession session) {
+
+    private SearchQuery.Criterion toCriterion(final SearchKey key,
+            final ImapSession session) {
         final int type = key.getType();
         final DayMonthYear date = key.getDate();
-        switch(type) {
-            case SearchKey.TYPE_ALL: return SearchQuery.all();
-            case SearchKey.TYPE_AND: return and(key.getKeys(), session);
-            case SearchKey.TYPE_ANSWERED: return SearchQuery.flagIsSet(Flag.ANSWERED);
-            case SearchKey.TYPE_BCC: return SearchQuery.headerContains(ImapConstants.RFC822_BCC, key.getValue());
-            case SearchKey.TYPE_BEFORE: return SearchQuery.internalDateBefore(date.getDay(), date.getMonth(), date.getYear());
-            case SearchKey.TYPE_BODY: return SearchQuery.bodyContains(key.getValue());
-            case SearchKey.TYPE_CC: return SearchQuery.headerContains(ImapConstants.RFC822_CC, key.getValue());
-            case SearchKey.TYPE_DELETED: return SearchQuery.flagIsSet(Flag.DELETED);
-            case SearchKey.TYPE_DRAFT: return SearchQuery.flagIsSet(Flag.DRAFT);
-            case SearchKey.TYPE_FLAGGED: return SearchQuery.flagIsSet(Flag.FLAGGED);
-            case SearchKey.TYPE_FROM: return SearchQuery.headerContains(ImapConstants.RFC822_FROM, key.getValue());
-            case SearchKey.TYPE_HEADER: return SearchQuery.headerContains(key.getName(), key.getValue());
-            case SearchKey.TYPE_KEYWORD: return SearchQuery.flagIsSet(key.getValue());
-            case SearchKey.TYPE_LARGER: return SearchQuery.sizeGreaterThan(key.getSize());
-            case SearchKey.TYPE_NEW: return SearchQuery.and(SearchQuery.flagIsSet(Flag.RECENT), SearchQuery.flagIsUnSet(Flag.SEEN));
-            case SearchKey.TYPE_NOT: return not(key.getKeys(), session);
-            case SearchKey.TYPE_OLD: return SearchQuery.flagIsUnSet(Flag.RECENT);
-            case SearchKey.TYPE_ON: return SearchQuery.internalDateOn(date.getDay(), date.getMonth(), date.getYear());
-            case SearchKey.TYPE_OR: return or(key.getKeys(), session);
-            case SearchKey.TYPE_RECENT: return SearchQuery.flagIsSet(Flag.RECENT);
-            case SearchKey.TYPE_SEEN: return SearchQuery.flagIsSet(Flag.SEEN);
-            case SearchKey.TYPE_SENTBEFORE: return SearchQuery.headerDateBefore(ImapConstants.RFC822_DATE, date.getDay(), date.getMonth(), date.getYear());
-            case SearchKey.TYPE_SENTON: return SearchQuery.headerDateOn(ImapConstants.RFC822_DATE, date.getDay(), date.getMonth(), date.getYear());
-            case SearchKey.TYPE_SENTSINCE: return SearchQuery.headerDateAfter(ImapConstants.RFC822_DATE, date.getDay(), date.getMonth(), date.getYear());
-            case SearchKey.TYPE_SEQUENCE_SET: return sequence(key.getSequenceNumbers(), session, true);
-            case SearchKey.TYPE_SINCE: return SearchQuery.internalDateAfter(date.getDay(), date.getMonth(), date.getYear());
-            case SearchKey.TYPE_SMALLER: return SearchQuery.sizeLessThan(key.getSize());
-            case SearchKey.TYPE_SUBJECT: return SearchQuery.headerContains(ImapConstants.RFC822_SUBJECT, key.getValue());
-            case SearchKey.TYPE_TEXT: return SearchQuery.mailContains(key.getValue());
-            case SearchKey.TYPE_TO: return SearchQuery.headerContains(ImapConstants.RFC822_TO, key.getValue());
-            case SearchKey.TYPE_UID: return sequence(key.getSequenceNumbers(), session, false);
-            case SearchKey.TYPE_UNANSWERED: return SearchQuery.flagIsUnSet(Flag.ANSWERED);
-            case SearchKey.TYPE_UNDELETED: return SearchQuery.flagIsUnSet(Flag.DELETED);
-            case SearchKey.TYPE_UNDRAFT: return SearchQuery.flagIsUnSet(Flag.DRAFT);
-            case SearchKey.TYPE_UNFLAGGED: return SearchQuery.flagIsUnSet(Flag.FLAGGED);
-            case SearchKey.TYPE_UNKEYWORD: return SearchQuery.flagIsUnSet(key.getValue());
-            case SearchKey.TYPE_UNSEEN: return SearchQuery.flagIsUnSet(Flag.SEEN);
+        switch (type) {
+            case SearchKey.TYPE_ALL:
+                return SearchQuery.all();
+            case SearchKey.TYPE_AND:
+                return and(key.getKeys(), session);
+            case SearchKey.TYPE_ANSWERED:
+                return SearchQuery.flagIsSet(Flag.ANSWERED);
+            case SearchKey.TYPE_BCC:
+                return SearchQuery.headerContains(ImapConstants.RFC822_BCC, key
+                        .getValue());
+            case SearchKey.TYPE_BEFORE:
+                return SearchQuery.internalDateBefore(date.getDay(), date
+                        .getMonth(), date.getYear());
+            case SearchKey.TYPE_BODY:
+                return SearchQuery.bodyContains(key.getValue());
+            case SearchKey.TYPE_CC:
+                return SearchQuery.headerContains(ImapConstants.RFC822_CC, key
+                        .getValue());
+            case SearchKey.TYPE_DELETED:
+                return SearchQuery.flagIsSet(Flag.DELETED);
+            case SearchKey.TYPE_DRAFT:
+                return SearchQuery.flagIsSet(Flag.DRAFT);
+            case SearchKey.TYPE_FLAGGED:
+                return SearchQuery.flagIsSet(Flag.FLAGGED);
+            case SearchKey.TYPE_FROM:
+                return SearchQuery.headerContains(ImapConstants.RFC822_FROM,
+                        key.getValue());
+            case SearchKey.TYPE_HEADER:
+                return SearchQuery
+                        .headerContains(key.getName(), key.getValue());
+            case SearchKey.TYPE_KEYWORD:
+                return SearchQuery.flagIsSet(key.getValue());
+            case SearchKey.TYPE_LARGER:
+                return SearchQuery.sizeGreaterThan(key.getSize());
+            case SearchKey.TYPE_NEW:
+                return SearchQuery.and(SearchQuery.flagIsSet(Flag.RECENT),
+                        SearchQuery.flagIsUnSet(Flag.SEEN));
+            case SearchKey.TYPE_NOT:
+                return not(key.getKeys(), session);
+            case SearchKey.TYPE_OLD:
+                return SearchQuery.flagIsUnSet(Flag.RECENT);
+            case SearchKey.TYPE_ON:
+                return SearchQuery.internalDateOn(date.getDay(), date
+                        .getMonth(), date.getYear());
+            case SearchKey.TYPE_OR:
+                return or(key.getKeys(), session);
+            case SearchKey.TYPE_RECENT:
+                return SearchQuery.flagIsSet(Flag.RECENT);
+            case SearchKey.TYPE_SEEN:
+                return SearchQuery.flagIsSet(Flag.SEEN);
+            case SearchKey.TYPE_SENTBEFORE:
+                return SearchQuery.headerDateBefore(ImapConstants.RFC822_DATE,
+                        date.getDay(), date.getMonth(), date.getYear());
+            case SearchKey.TYPE_SENTON:
+                return SearchQuery.headerDateOn(ImapConstants.RFC822_DATE, date
+                        .getDay(), date.getMonth(), date.getYear());
+            case SearchKey.TYPE_SENTSINCE:
+                return SearchQuery.headerDateAfter(ImapConstants.RFC822_DATE,
+                        date.getDay(), date.getMonth(), date.getYear());
+            case SearchKey.TYPE_SEQUENCE_SET:
+                return sequence(key.getSequenceNumbers(), session, true);
+            case SearchKey.TYPE_SINCE:
+                return SearchQuery.internalDateAfter(date.getDay(), date
+                        .getMonth(), date.getYear());
+            case SearchKey.TYPE_SMALLER:
+                return SearchQuery.sizeLessThan(key.getSize());
+            case SearchKey.TYPE_SUBJECT:
+                return SearchQuery.headerContains(ImapConstants.RFC822_SUBJECT,
+                        key.getValue());
+            case SearchKey.TYPE_TEXT:
+                return SearchQuery.mailContains(key.getValue());
+            case SearchKey.TYPE_TO:
+                return SearchQuery.headerContains(ImapConstants.RFC822_TO, key
+                        .getValue());
+            case SearchKey.TYPE_UID:
+                return sequence(key.getSequenceNumbers(), session, false);
+            case SearchKey.TYPE_UNANSWERED:
+                return SearchQuery.flagIsUnSet(Flag.ANSWERED);
+            case SearchKey.TYPE_UNDELETED:
+                return SearchQuery.flagIsUnSet(Flag.DELETED);
+            case SearchKey.TYPE_UNDRAFT:
+                return SearchQuery.flagIsUnSet(Flag.DRAFT);
+            case SearchKey.TYPE_UNFLAGGED:
+                return SearchQuery.flagIsUnSet(Flag.FLAGGED);
+            case SearchKey.TYPE_UNKEYWORD:
+                return SearchQuery.flagIsUnSet(key.getValue());
+            case SearchKey.TYPE_UNSEEN:
+                return SearchQuery.flagIsUnSet(Flag.SEEN);
             default:
                 getLog().warn("Ignoring unknown search key.");
                 return SearchQuery.all();
         }
     }
 
-    private Criterion sequence(IdRange[] sequenceNumbers, final ImapSession session, boolean msn) {
+    private Criterion sequence(IdRange[] sequenceNumbers,
+            final ImapSession session, boolean msn) {
         final int length = sequenceNumbers.length;
         final SearchQuery.NumericRange[] ranges = new SearchQuery.NumericRange[length];
         for (int i = 0; i < length; i++) {
@@ -197,7 +254,7 @@
                 } else {
                     final int lowMsn = (int) lowVal;
                     lowUid = selected.uid(lowMsn);
-                }                
+                }
             } else {
                 lowUid = lowVal;
                 highUid = highVal;
@@ -215,14 +272,14 @@
         final Criterion result = SearchQuery.or(criterionOne, criterionTwo);
         return result;
     }
-    
+
     private Criterion not(List keys, final ImapSession session) {
         final SearchKey key = (SearchKey) keys.get(0);
         final Criterion criterion = toCriterion(key, session);
         final Criterion result = SearchQuery.not(criterion);
         return result;
     }
-    
+
     private Criterion and(List keys, final ImapSession session) {
         final int size = keys.size();
         final List criteria = new ArrayList(size);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StatusProcessor.java Thu Sep 18 14:44:56 2008
@@ -40,7 +40,8 @@
 public class StatusProcessor extends AbstractMailboxAwareProcessor {
 
     public StatusProcessor(final ImapProcessor next,
-            final MailboxManagerProvider mailboxManagerProvider, final StatusResponseFactory factory) {
+            final MailboxManagerProvider mailboxManagerProvider,
+            final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
 
@@ -48,14 +49,15 @@
         return (message instanceof StatusRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final StatusRequest request = (StatusRequest) message;
         final String mailboxName = request.getMailboxName();
         final StatusDataItems statusDataItems = request.getStatusDataItems();
         final Log logger = getLog();
-        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        
+        final MailboxSession mailboxSession = ImapSessionUtils
+                .getMailboxSession(session);
+
         try {
             String fullMailboxName = buildFullName(session, mailboxName);
 
@@ -65,26 +67,32 @@
             }
 
             final MailboxManager mailboxManager = getMailboxManager(session);
-            final Mailbox mailbox = mailboxManager
-                    .getMailbox(fullMailboxName, false);
-            
-            final Long messages = messages(statusDataItems, mailboxSession, mailbox);
+            final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName,
+                    false);
+
+            final Long messages = messages(statusDataItems, mailboxSession,
+                    mailbox);
             final Long recent = recent(statusDataItems, mailboxSession, mailbox);
-            final Long uidNext = uidNext(statusDataItems, mailboxSession, mailbox);
-            final Long uidValidity = uidValidity(statusDataItems, mailboxSession, mailbox);
+            final Long uidNext = uidNext(statusDataItems, mailboxSession,
+                    mailbox);
+            final Long uidValidity = uidValidity(statusDataItems,
+                    mailboxSession, mailbox);
             final Long unseen = unseen(statusDataItems, mailboxSession, mailbox);
-            
-            final STATUSResponse response = new STATUSResponse(messages, recent, uidNext, uidValidity, unseen, mailboxName);
+
+            final STATUSResponse response = new STATUSResponse(messages,
+                    recent, uidNext, uidValidity, unseen, mailboxName);
             responder.respond(response);
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
-            
+
         } catch (MailboxManagerException e) {
             no(command, tag, responder, e);
         }
     }
 
-    private Long unseen(final StatusDataItems statusDataItems, final MailboxSession mailboxSession, final Mailbox mailbox) throws MailboxManagerException {
+    private Long unseen(final StatusDataItems statusDataItems,
+            final MailboxSession mailboxSession, final Mailbox mailbox)
+            throws MailboxManagerException {
         final Long unseen;
         if (statusDataItems.isUnseen()) {
             final int unseenCountValue = mailbox.getUnseenCount(mailboxSession);
@@ -95,10 +103,13 @@
         return unseen;
     }
 
-    private Long uidValidity(final StatusDataItems statusDataItems, final MailboxSession mailboxSession, final Mailbox mailbox) throws MailboxManagerException {
+    private Long uidValidity(final StatusDataItems statusDataItems,
+            final MailboxSession mailboxSession, final Mailbox mailbox)
+            throws MailboxManagerException {
         final Long uidValidity;
         if (statusDataItems.isUidValidity()) {
-            final long uidValidityValue = mailbox.getUidValidity(mailboxSession);
+            final long uidValidityValue = mailbox
+                    .getUidValidity(mailboxSession);
             uidValidity = new Long(uidValidityValue);
         } else {
             uidValidity = null;
@@ -106,7 +117,9 @@
         return uidValidity;
     }
 
-    private Long uidNext(final StatusDataItems statusDataItems, final MailboxSession mailboxSession, final Mailbox mailbox) throws MailboxManagerException {
+    private Long uidNext(final StatusDataItems statusDataItems,
+            final MailboxSession mailboxSession, final Mailbox mailbox)
+            throws MailboxManagerException {
         final Long uidNext;
         if (statusDataItems.isUidNext()) {
             final long uidNextValue = mailbox.getUidNext(mailboxSession);
@@ -117,7 +130,9 @@
         return uidNext;
     }
 
-    private Long recent(final StatusDataItems statusDataItems, final MailboxSession mailboxSession, final Mailbox mailbox) throws MailboxManagerException {
+    private Long recent(final StatusDataItems statusDataItems,
+            final MailboxSession mailboxSession, final Mailbox mailbox)
+            throws MailboxManagerException {
         final Long recent;
         if (statusDataItems.isRecent()) {
             final int recentCount = mailbox.recent(false, mailboxSession).length;
@@ -128,7 +143,9 @@
         return recent;
     }
 
-    private Long messages(final StatusDataItems statusDataItems, final MailboxSession mailboxSession, final Mailbox mailbox) throws MailboxManagerException {
+    private Long messages(final StatusDataItems statusDataItems,
+            final MailboxSession mailboxSession, final Mailbox mailbox)
+            throws MailboxManagerException {
         final Long messages;
         if (statusDataItems.isMessages()) {
             final int messageCount = mailbox.getMessageCount(mailboxSession);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/StoreProcessor.java Thu Sep 18 14:44:56 2008
@@ -48,7 +48,8 @@
 
     private static final FetchGroup STORE_FETCH_GROUP = FetchGroupImpl.FLAGS;
 
-    public StoreProcessor(final ImapProcessor next, final StatusResponseFactory factory) {
+    public StoreProcessor(final ImapProcessor next,
+            final StatusResponseFactory factory) {
         super(next, factory);
     }
 
@@ -56,8 +57,8 @@
         return (message instanceof StoreRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final StoreRequest request = (StoreRequest) message;
         final IdRange[] idSet = request.getIdSet();
         final Flags flags = request.getFlags();
@@ -65,7 +66,7 @@
         final boolean silent = request.isSilent();
         final boolean isSignedPlus = request.isSignedPlus();
         final boolean isSignedMinus = request.isSignedMinus();
-        
+
         Mailbox mailbox = ImapSessionUtils.getMailbox(session);
 
         final boolean replace;
@@ -92,12 +93,14 @@
                     lowVal = selected.uid((int) idSet[i].getLowVal());
                     highVal = selected.uid((int) idSet[i].getHighVal());
                 }
-                final MessageRange messageSet = MessageRangeImpl.uidRange(lowVal, highVal);
-                final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-                final Iterator it = mailbox.setFlags(flags, value, 
-                        replace, messageSet, STORE_FETCH_GROUP, mailboxSession);
+                final MessageRange messageSet = MessageRangeImpl.uidRange(
+                        lowVal, highVal);
+                final MailboxSession mailboxSession = ImapSessionUtils
+                        .getMailboxSession(session);
+                final Iterator it = mailbox.setFlags(flags, value, replace,
+                        messageSet, STORE_FETCH_GROUP, mailboxSession);
                 if (!silent) {
-                    while(it.hasNext()) {
+                    while (it.hasNext()) {
                         final MessageResult result = (MessageResult) it.next();
                         final long uid = result.getUid();
                         final int msn = selected.msn(uid);
@@ -111,8 +114,9 @@
                         if (selected.isRecent(uid)) {
                             resultFlags.add(Flags.Flag.RECENT);
                         }
-                        final FetchResponse response 
-                            = new FetchResponse(msn, resultFlags, resultUid, null, null, null, null, null, null);
+                        final FetchResponse response = new FetchResponse(msn,
+                                resultFlags, resultUid, null, null, null, null,
+                                null, null);
                         responder.respond(response);
                     }
                 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SubscribeProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SubscribeProcessor.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SubscribeProcessor.java (original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imapserver/processor/imap4rev1/SubscribeProcessor.java Thu Sep 18 14:44:56 2008
@@ -36,7 +36,8 @@
 
 public class SubscribeProcessor extends AbstractMailboxAwareProcessor {
 
-    public SubscribeProcessor(final ImapProcessor next, final MailboxManagerProvider mailboxManagerProvider,
+    public SubscribeProcessor(final ImapProcessor next,
+            final MailboxManagerProvider mailboxManagerProvider,
             final StatusResponseFactory factory) {
         super(next, mailboxManagerProvider, factory);
     }
@@ -45,22 +46,22 @@
         return (message instanceof SubscribeRequest);
     }
 
-    protected void doProcess(ImapRequest message,
-            ImapSession session, String tag, ImapCommand command, Responder responder) {
+    protected void doProcess(ImapRequest message, ImapSession session,
+            String tag, ImapCommand command, Responder responder) {
         final SubscribeRequest request = (SubscribeRequest) message;
         final String mailboxName = request.getMailboxName();
         final String userName = ImapSessionUtils.getUserName(session);
         try {
             final MailboxManager manager = getMailboxManager(session);
             manager.subscribe(userName, mailboxName);
-            
+
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
-            
+
         } catch (SubscriptionException e) {
             getLog().debug("Subscription failed", e);
             unsolicitedResponses(session, responder, false);
-            
+
             final HumanReadableTextKey exceptionKey = e.getKey();
             final HumanReadableTextKey displayTextKey;
             if (exceptionKey == null) {
@@ -72,7 +73,7 @@
         } catch (MailboxManagerException e) {
             getLog().debug("Subscription failed", e);
             unsolicitedResponses(session, responder, false);
-            
+
             final HumanReadableTextKey displayTextKey = HumanReadableTextKey.GENERIC_SUBSCRIPTION_FAILURE;
             no(command, tag, responder, displayTextKey);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org