james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r773259 - in /james/imap/trunk: mailbox/src/main/java/org/apache/james/imap/mailbox/ processor/src/main/java/org/apache/james/imap/processor/ store/src/main/java/org/apache/james/imap/store/ torque/src/main/java/org/apache/james/mailboxmana...
Date Sat, 09 May 2009 18:39:18 GMT
Author: rdonkin
Date: Sat May  9 18:39:17 2009
New Revision: 773259

URL: http://svn.apache.org/viewvc?rev=773259&view=rev
Log:
Consolidate message count into a single MetaData for the Mailbox. IMAP-79 https://issues.apache.org/jira/browse/IMAP-79

Modified:
    james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.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/StoreMailbox.java
    james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MailboxMetaData.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=773259&r1=773258&r2=773259&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 Sat
May  9 18:39:17 2009
@@ -159,5 +159,11 @@
          * @throws MailboxException
          */
         long getUidNext();
+        
+        /**
+         * Gets the number of messages that this mailbox contains.
+         * @return number of messages contained
+         */
+        int getMessageCount();
     }
 }

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=773259&r1=773258&r2=773259&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
Sat May  9 18:39:17 2009
@@ -101,7 +101,7 @@
         // TODO: compact this into a single API call for meta-data about the
         // repository
         flags(responder);
-        exists(responder, mailbox, mailboxSession);
+        exists(responder, metaData);
         recent(responder, selected);
         uidValidity(responder, metaData);
         unseen(responder, mailbox, mailboxSession, selected);
@@ -172,9 +172,8 @@
         responder.respond(recentResponse);
     }
 
-    private void exists(Responder responder, Mailbox mailbox,
-            final MailboxSession mailboxSession) throws MailboxException {
-        final int messageCount = mailbox.getMessageCount(mailboxSession);
+    private void exists(Responder responder, Mailbox.MetaData metaData) throws MailboxException
{
+        final int 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=773259&r1=773258&r2=773259&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
Sat May  9 18:39:17 2009
@@ -69,8 +69,8 @@
             final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName, ImapSessionUtils.getMailboxSession(session));
             final Mailbox.MetaData metaData = mailbox.getMetaData(false, mailboxSession);
             
-            final Long messages = messages(statusDataItems, mailboxSession, mailbox);
-            final Long recent = recent(statusDataItems, metaData, mailbox);
+            final Long messages = messages(statusDataItems, metaData);
+            final Long recent = recent(statusDataItems, metaData);
             final Long uidNext = uidNext(statusDataItems, metaData);
             final Long uidValidity = uidValidity(statusDataItems, metaData);
             final Long unseen = unseen(statusDataItems, mailboxSession, mailbox);
@@ -123,8 +123,7 @@
         return uidNext;
     }
 
-    private Long recent(final StatusDataItems statusDataItems,
-            final Mailbox.MetaData metaData, final Mailbox mailbox)
+    private Long recent(final StatusDataItems statusDataItems, final Mailbox.MetaData metaData)
             throws MailboxException {
         final Long recent;
         if (statusDataItems.isRecent()) {
@@ -136,12 +135,11 @@
         return recent;
     }
 
-    private Long messages(final StatusDataItems statusDataItems,
-            final MailboxSession mailboxSession, final Mailbox mailbox)
+    private Long messages(final StatusDataItems statusDataItems, final Mailbox.MetaData metaData)
             throws MailboxException {
         final Long messages;
         if (statusDataItems.isMessages()) {
-            final int messageCount = mailbox.getMessageCount(mailboxSession);
+            final int messageCount = metaData.getMessageCount();
             messages = new Long(messageCount);
         } 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=773259&r1=773258&r2=773259&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
Sat May  9 18:39:17 2009
@@ -34,8 +34,10 @@
     private final Flags premanentFlags;
     private final long uidValidity;
     private final long nextUid;
+    private final int messageCount;
     
-    public MailboxMetaData(final long[] recent, final Flags premanentFlags, final long uidValidity,
final long nextUid) {
+    public MailboxMetaData(final long[] recent, final Flags premanentFlags, final long uidValidity,
final long nextUid,
+            final int messageCount) {
         super();
         if (recent == null) {
             recentCount = 0;
@@ -46,6 +48,7 @@
         this.premanentFlags = premanentFlags;
         this.uidValidity = uidValidity;
         this.nextUid = nextUid;
+        this.messageCount = messageCount;
     }
 
     /**
@@ -82,4 +85,8 @@
     public long getUidNext() {
         return nextUid;
     }
+
+    public int getMessageCount() {
+        return messageCount;
+    }
 }

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java?rev=773259&r1=773258&r2=773259&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java Sat
May  9 18:39:17 2009
@@ -478,6 +478,7 @@
         final Flags permanentFlags = getPermanentFlags();
         final long uidValidity = getUidValidity(mailboxSession);
         final long uidNext = getUidNext(mailboxSession);
-        return new MailboxMetaData(recent, permanentFlags, uidValidity, uidNext);
+        final int messageCount = getMessageCount(mailboxSession);
+        return new MailboxMetaData(recent, permanentFlags, uidValidity, uidNext, messageCount);
     }
 }

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MailboxMetaData.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MailboxMetaData.java?rev=773259&r1=773258&r2=773259&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MailboxMetaData.java
(original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MailboxMetaData.java
Sat May  9 18:39:17 2009
@@ -23,6 +23,7 @@
 
 import org.apache.james.imap.mailbox.Mailbox;
 
+
 /**
  * Describes the current state of a mailbox.
  */
@@ -33,8 +34,10 @@
     private final Flags premanentFlags;
     private final long uidValidity;
     private final long nextUid;
+    private final int messageCount;
     
-    public MailboxMetaData(final long[] recent, final Flags premanentFlags, final long uidValidity,
final long nextUid) {
+    public MailboxMetaData(final long[] recent, final Flags premanentFlags, final long uidValidity,
final long nextUid,
+            final int messageCount) {
         super();
         if (recent == null) {
             recentCount = 0;
@@ -45,6 +48,7 @@
         this.premanentFlags = premanentFlags;
         this.uidValidity = uidValidity;
         this.nextUid = nextUid;
+        this.messageCount = messageCount;
     }
 
     /**
@@ -82,4 +86,7 @@
         return nextUid;
     }
 
+    public int getMessageCount() {
+        return messageCount;
+    }
 }

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=773259&r1=773258&r2=773259&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
Sat May  9 18:39:17 2009
@@ -816,6 +816,7 @@
         final Flags permanentFlags = getPermanentFlags();
         final long uidValidity = getUidValidity(mailboxSession);
         final long uidNext = getUidNext(mailboxSession);
-        return new MailboxMetaData(recent, permanentFlags, uidValidity, uidNext);
+        final int messageCount = getMessageCount(mailboxSession);
+        return new MailboxMetaData(recent, permanentFlags, uidValidity, uidNext, messageCount);
     }
 }



---------------------------------------------------------------------
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