james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r985146 - in /james/imap/trunk: mailbox/src/main/java/org/apache/james/imap/mailbox/ message/src/main/java/org/apache/james/imap/encode/ message/src/main/java/org/apache/james/imap/encode/base/ message/src/main/java/org/apache/james/imap/me...
Date Fri, 13 Aug 2010 09:50:23 GMT
Author: norman
Date: Fri Aug 13 09:50:22 2010
New Revision: 985146

URL: http://svn.apache.org/viewvc?rev=985146&view=rev
Log:
change return types to long and remove the casting stuff (IMAP-194)

Removed:
    james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MailboxMetaData.java
Modified:
    james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/ExistsResponse.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
    james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxMetaData.java
    james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java
    james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java

Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java (original)
+++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java Fri
Aug 13 09:50:22 2010
@@ -47,7 +47,7 @@ public interface Mailbox {
      * @return count
      * @throws MailboxException
      */
-    int getMessageCount(MailboxSession mailboxSession) throws MailboxException;
+    long getMessageCount(MailboxSession mailboxSession) throws MailboxException;
 
     /**
      * Return if the Mailbox is writable
@@ -157,7 +157,7 @@ public interface Mailbox {
          * Gets the number of recent messages.
          * @return the number of messages flagged RECENT in this mailbox
          */
-        public int countRecent();
+        public long countRecent();
         
         /**
          * Gets the flags which can be stored by this mailbox.
@@ -183,7 +183,7 @@ public interface Mailbox {
          * Gets the number of messages that this mailbox contains.
          * @return number of messages contained
          */
-        int getMessageCount();
+        long getMessageCount();
         
         /**
          * Gets the number of unseen messages contained in this mailbox.
@@ -192,7 +192,7 @@ public interface Mailbox {
          * or zero when this optional data has not been requested
          * @see FetchGroup#UNSEEN_COUNT
          */
-        int getUnseenCount();
+        long getUnseenCount();
         
         /**
          * Gets the UID of the first unseen message.

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java
Fri Aug 13 09:50:22 2010
@@ -39,7 +39,7 @@ public class ExistsResponseEncoder exten
     protected void doEncode(ImapMessage acceptableMessage,
             ImapResponseComposer composer, ImapSession session) throws IOException {
         final ExistsResponse existsResponse = (ExistsResponse) acceptableMessage;
-        final int numberOfMessages = existsResponse.getNumberOfMessages();
+        final long numberOfMessages = existsResponse.getNumberOfMessages();
         composer.existsResponse(numberOfMessages);
 
     }

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
Fri Aug 13 09:50:22 2010
@@ -58,11 +58,11 @@ public interface ImapResponseComposer {
      */
     public abstract void flagsResponse(Flags flags) throws IOException;
 
-    public abstract void existsResponse(int count) throws IOException;
+    public abstract void existsResponse(long count) throws IOException;
 
-    public abstract void recentResponse(int count) throws IOException;
+    public abstract void recentResponse(long count) throws IOException;
 
-    public abstract void expungeResponse(int msn) throws IOException;
+    public abstract void expungeResponse(long msn) throws IOException;
 
     public abstract void searchResponse(long[] ids) throws IOException;
 

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
Fri Aug 13 09:50:22 2010
@@ -98,33 +98,33 @@ public class ImapResponseComposerImpl im
         end();
     }
 
-    /**
-     * @throws IOException
-     * @see org.apache.james.imap.encode.ImapResponseComposer#existsResponse(int)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.imap.encode.ImapResponseComposer#existsResponse(long)
      */
-    public void existsResponse(int count) throws IOException {
+    public void existsResponse(long count) throws IOException {
         untagged();
         message(count);
         message(EXISTS);
         end();
     }
 
-    /**
-     * @throws IOException
-     * @see org.apache.james.imap.encode.ImapResponseComposer#recentResponse(int)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.imap.encode.ImapResponseComposer#recentResponse(long)
      */
-    public void recentResponse(int count) throws IOException {
+    public void recentResponse(long count) throws IOException {
         untagged();
         message(count);
         message(RECENT);
         end();
     }
 
-    /**
-     * @throws IOException
-     * @see org.apache.james.imap.encode.ImapResponseComposer#expungeResponse(int)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.imap.encode.ImapResponseComposer#expungeResponse(long)
      */
-    public void expungeResponse(int msn) throws IOException {
+    public void expungeResponse(long msn) throws IOException {
         untagged();
         message(msn);
         message(EXPUNGE);

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/ExistsResponse.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/ExistsResponse.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/ExistsResponse.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/ExistsResponse.java
Fri Aug 13 09:50:22 2010
@@ -22,14 +22,14 @@ package org.apache.james.imap.message.re
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
 
 public final class ExistsResponse implements ImapResponseMessage {
-    private final int numberOfMessages;
+    private final long numberOfMessages;
 
-    public ExistsResponse(final int numberOfMessages) {
+    public ExistsResponse(final long numberOfMessages) {
         super();
         this.numberOfMessages = numberOfMessages;
     }
 
-    public final int getNumberOfMessages() {
+    public final long getNumberOfMessages() {
         return numberOfMessages;
     }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
Fri Aug 13 09:50:22 2010
@@ -247,7 +247,7 @@ abstract public class AbstractMailboxPro
         try {
             final Mailbox mailbox = getMailbox(session, selected);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-            final int messageCount = mailbox.getMessageCount(mailboxSession);
+            final long messageCount = mailbox.getMessageCount(mailboxSession);
             // TODO: use factory
             final ExistsResponse response = new ExistsResponse(messageCount);
             responder.respond(response);

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
Fri Aug 13 09:50:22 2010
@@ -165,7 +165,7 @@ abstract class AbstractSelectionProcesso
     }
 
     private void exists(Responder responder, Mailbox.MetaData metaData) throws MailboxException
{
-        final int messageCount = metaData.getMessageCount();
+        final long messageCount = metaData.getMessageCount();
         final ExistsResponse existsResponse = new ExistsResponse(messageCount);
         responder.respond(existsResponse);
     }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
Fri Aug 13 09:50:22 2010
@@ -94,8 +94,7 @@ public class StatusProcessor extends Abs
             throws MailboxException {
         final Long unseen;
         if (statusDataItems.isUnseen()) {
-            final int unseenCountValue = metaData.getUnseenCount();
-            unseen = new Long(unseenCountValue);
+            unseen = metaData.getUnseenCount();
         } else {
             unseen = null;
         }
@@ -130,8 +129,7 @@ public class StatusProcessor extends Abs
             throws MailboxException {
         final Long recent;
         if (statusDataItems.isRecent()) {
-            final int recentCount = metaData.countRecent();
-            recent = new Long(recentCount);
+            recent = metaData.countRecent();
         } else {
             recent = null;
         }
@@ -142,8 +140,7 @@ public class StatusProcessor extends Abs
             throws MailboxException {
         final Long messages;
         if (statusDataItems.isMessages()) {
-            final int messageCount = metaData.getMessageCount();
-            messages = new Long(messageCount);
+            messages = metaData.getMessageCount();
         } else {
             messages = null;
         }

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxMetaData.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxMetaData.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxMetaData.java
(original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxMetaData.java
Fri Aug 13 09:50:22 2010
@@ -32,18 +32,18 @@ import org.apache.james.imap.mailbox.Mai
  */
 public class MailboxMetaData implements Mailbox.MetaData {
 
-    private final int recentCount;
+    private final long recentCount;
     private final List<Long> recent;
     private final Flags premanentFlags;
     private final long uidValidity;
     private final long nextUid;
-    private final int messageCount;
-    private final int unseenCount;
+    private final long messageCount;
+    private final long unseenCount;
     private final Long firstUnseen;
     private final boolean writeable;
     
     public MailboxMetaData(final List<Long> recent, final Flags premanentFlags, final
long uidValidity, final long nextUid,
-            final int messageCount, final int unseenCount, final Long firstUnseen, final
boolean writeable) {
+            final long messageCount, final long unseenCount, final Long firstUnseen, final
boolean writeable) {
         super();
         if (recent == null) {
             this.recent = new ArrayList<Long>();
@@ -65,7 +65,7 @@ public class MailboxMetaData implements 
     /**
      * @see {@link Mailbox.MetaData#countRecent()()}
      */
-    public int countRecent() {
+    public long countRecent() {
         return recentCount;
     }
 
@@ -100,14 +100,14 @@ public class MailboxMetaData implements 
     /**
      * @see {@link Mailbox.MetaData#getMessageCount()}
      */
-    public int getMessageCount() {
+    public long getMessageCount() {
         return messageCount;
     }
 
     /**
      * @see {@link Mailbox.MetaData#getUnseenCount()}
      */
-    public int getUnseenCount() {
+    public long getUnseenCount() {
         return unseenCount;
     }
 

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java
(original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java
Fri Aug 13 09:50:22 2010
@@ -119,8 +119,8 @@ public abstract class StoreMessageManage
      * (non-Javadoc)
      * @see org.apache.james.imap.mailbox.Mailbox#getMessageCount(org.apache.james.imap.mailbox.MailboxSession)
      */
-    public int getMessageCount(MailboxSession mailboxSession) throws MailboxException {
-        return (int) messageMapper.countMessagesInMailbox(mailbox);
+    public long getMessageCount(MailboxSession mailboxSession) throws MailboxException {
+        return messageMapper.countMessagesInMailbox(mailbox);
     }
 
     /*
@@ -546,8 +546,8 @@ public abstract class StoreMessageManage
         final Flags permanentFlags = getPermanentFlags();
         final long uidValidity = getMailboxEntity().getUidValidity();
         final long uidNext = getUidNext(mailboxSession);
-        final int messageCount = getMessageCount(mailboxSession);
-        final int unseenCount;
+        final long messageCount = getMessageCount(mailboxSession);
+        final long unseenCount;
         final Long firstUnseen;
         switch (fetchGroup) {
             case UNSEEN_COUNT:

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=985146&r1=985145&r2=985146&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
(original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
Fri Aug 13 09:50:22 2010
@@ -26,6 +26,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
@@ -60,6 +61,7 @@ import org.apache.james.imap.mailbox.Sea
 import org.apache.james.imap.mailbox.SearchQuery.NumericRange;
 import org.apache.james.imap.mailbox.util.FetchGroupImpl;
 import org.apache.james.imap.mailbox.util.UidRange;
+import org.apache.james.imap.store.MailboxMetaData;
 import org.apache.james.imap.store.streaming.CRLFOutputStream;
 import org.apache.james.mailboxmanager.torque.om.MailboxRow;
 import org.apache.james.mailboxmanager.torque.om.MailboxRowPeer;
@@ -108,7 +110,7 @@ public class TorqueMailbox implements Ma
         return mailboxRow.getName();
     }
 
-    public int getMessageCount(MailboxSession mailboxSession)
+    public long getMessageCount(MailboxSession mailboxSession)
     throws MailboxException {
         lockForReading();
         try {
@@ -394,7 +396,7 @@ public class TorqueMailbox implements Ma
         return permanentFlags;
     }
 
-    public long[] recent(boolean reset, MailboxSession mailboxSession)
+    protected List<Long> recent(boolean reset, MailboxSession mailboxSession)
     throws MailboxException {
         lockForReading();
         try {
@@ -402,11 +404,10 @@ public class TorqueMailbox implements Ma
             final Criteria criterion = queryRecentFlagSet();
             final List messageRows = getMailboxRow().getMessageRows(
                     criterion);
-            final long[] results = new long[messageRows.size()];
-            int count = 0;
+            final List<Long> results = new ArrayList<Long>(messageRows.size());
             for (Iterator it = messageRows.iterator(); it.hasNext();) {
                 final MessageRow row = (MessageRow) it.next();
-                results[count++] = row.getUid();
+                results.add(row.getUid());
             }
 
             if (reset) {
@@ -832,11 +833,11 @@ public class TorqueMailbox implements Ma
      * @see org.apache.james.imap.mailbox.Mailbox#getMetaData(boolean, MailboxSession, org.apache.james.imap.mailbox.Mailbox.MetaData.FetchGroup)
      */
     public MetaData getMetaData(boolean resetRecent, MailboxSession mailboxSession, Mailbox.MetaData.FetchGroup
fetchGroup) throws MailboxException {
-        final long[] recent = recent(resetRecent, mailboxSession);
+        final List<Long> recent = recent(resetRecent, mailboxSession);
         final Flags permanentFlags = getPermanentFlags();
         final long uidValidity = getUidValidity(mailboxSession);
         final long uidNext = getUidNext(mailboxSession);
-        final int messageCount = getMessageCount(mailboxSession);
+        final long messageCount = getMessageCount(mailboxSession);
         final int unseenCount;
         final Long firstUnseen;
         switch (fetchGroup) {



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


Mime
View raw message