james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r762674 - in /james/imap/trunk: mailbox/src/main/java/org/apache/james/imap/mailbox/ mailbox/src/main/java/org/apache/james/imap/mailbox/util/ processor/src/main/java/org/apache/james/imap/processor/ processor/src/test/java/org/apache/james...
Date Wed, 08 Apr 2009 04:09:57 GMT
Author: rdonkin
Date: Tue Apr  7 10:19:51 2009
New Revision: 762674

URL: http://svn.apache.org/viewvc?rev=762674&view=rev
Log:
Switch API to return enumeration of possible inferior states. IMAP-73 https://issues.apache.org/jira/browse/IMAP-73

Modified:
    james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
    james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
    james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java

Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java?rev=762674&r1=762673&r2=762674&view=diff
==============================================================================
--- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
(original)
+++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
Tue Apr  7 10:19:51 2009
@@ -31,11 +31,36 @@
     }
     
     /**
-     * Is this mailbox <code>\Noinferiors</code> as per RFC3501.
-     * 
-     * @return true if marked, false otherwise
+     * Indicates whether this mailbox allows
+     * children and - if so - whether it has 
+     * any.
      */
-    public boolean isNoInferiors();
+    public enum Children {
+        /**
+         * No children allowed.
+         */
+        NO_INFERIORS,
+        /**
+         * Children allowed by this mailbox 
+         * but it is unknown whether this mailbox has children.
+         */
+        CHILDREN_ALLOWED_BUT_UNKNOWN,
+        /**
+         * Indicates that this mailbox has children.
+         */
+        HAS_CHILDREN,
+        /**
+         * Indicates that this mailbox allows interiors
+         * but currently has no children.
+         */
+        HAS_NO_CHILDREN
+    }
+    
+    /**
+     * Gets the inferiors status of this mailbox.
+     * @return not null
+     */
+    public Children inferiors();
 
     /**
      * Gets the RFC3501 Selectability flag.

Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java?rev=762674&r1=762673&r2=762674&view=diff
==============================================================================
--- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java
(original)
+++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java
Tue Apr  7 10:19:51 2009
@@ -25,27 +25,27 @@
 public class SimpleMailboxMetaData implements MailboxMetaData, Comparable {
 
     public static MailboxMetaData createNoSelect(String name, String delimiter) {
-        return new SimpleMailboxMetaData(name, delimiter, false, Selectability.NOSELECT);
+        return new SimpleMailboxMetaData(name, delimiter, Children.CHILDREN_ALLOWED_BUT_UNKNOWN,
Selectability.NOSELECT);
     }
 
     private final String name;
 
     private final String delimiter;
 
-    private final boolean noInferiors;
+    private final Children inferiors;
 
     private final Selectability selectability;
 
     public SimpleMailboxMetaData(String name, String delimiter) {
-        this(name, delimiter, false, Selectability.NONE);
+        this(name, delimiter, Children.CHILDREN_ALLOWED_BUT_UNKNOWN, Selectability.NONE);
     }
 
     public SimpleMailboxMetaData(final String name, final String delimiter,
-            final boolean noInferiors, final Selectability selectability) {
+            final Children inferiors, final Selectability selectability) {
         super();
         this.name = name;
         this.delimiter = delimiter;
-        this.noInferiors = noInferiors;
+        this.inferiors = inferiors;
         this.selectability = selectability;
     }
 
@@ -54,8 +54,8 @@
      * 
      * @return true if marked, false otherwise
      */
-    public final boolean isNoInferiors() {
-        return noInferiors;
+    public final Children inferiors() {
+        return inferiors;
     }
 
     /**

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java?rev=762674&r1=762673&r2=762674&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
Tue Apr  7 10:19:51 2009
@@ -151,7 +151,7 @@
         final String mailboxName = mailboxName(removeUserPrefix, prefixLength,
                 listResult);
 
-        final boolean noInferior = listResult.isNoInferiors();
+        final boolean noInferior = MailboxMetaData.Children.NO_INFERIORS.equals(listResult.inferiors());
         boolean noSelect = false;
         boolean marked = false;
         boolean unmarked = false;

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java?rev=762674&r1=762673&r2=762674&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
(original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
Tue Apr  7 10:19:51 2009
@@ -78,7 +78,7 @@
     void setUpResult(final boolean isNoinferiors, final MailboxMetaData.Selectability selectability,
             final String hierarchyDelimiter, final String name) {
         checking(new Expectations() {{
-            oneOf(result).isNoInferiors();will(returnValue(isNoinferiors));
+            oneOf(result).inferiors();will(returnValue(isNoinferiors?MailboxMetaData.Children.NO_INFERIORS:MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN));
             oneOf(result).getSelectability();will(returnValue(selectability));
             oneOf(result).getHierarchyDelimiter();will(returnValue(hierarchyDelimiter));
             oneOf(result).getName();will(returnValue(name));



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