james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r762791 - in /james/imap/trunk: seda/src/test/resources/org/apache/james/imap/scripts/ store/src/main/java/org/apache/james/imap/store/ torque/src/main/java/org/apache/james/mailboxmanager/torque/
Date Wed, 08 Apr 2009 04:11:03 GMT
Author: rdonkin
Date: Tue Apr  7 14:31:14 2009
New Revision: 762791

URL: http://svn.apache.org/viewvc?rev=762791&view=rev
Log:
Basic (slow) implementation for torque and other mailbox stores IMAP-73 https://issues.apache.org/jira/browse/IMAP-73

Modified:
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Create.test
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListMailboxes.test
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPercentWildcard.test
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPlus.test
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameHierarchy.test
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameSelected.test
    james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
    james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java

Modified: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Create.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Create.test?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Create.test (original)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Create.test Tue
Apr  7 14:31:14 2009
@@ -38,8 +38,8 @@
 C: 15 CREATE another.test.
 S: 15 OK CREATE completed.
 C: 16 LIST "" another*
-S: \* LIST \(\) "." "another"
-S: \* LIST \(\) "." "another.test"
+S: \* LIST \(\\HasChildren\) "." "another"
+S: \* LIST \(\\HasNoChildren\) "." "another.test"
 S: 16 OK LIST completed.
 #
 # RFC3501@6.3.3p2
@@ -47,9 +47,9 @@
 C: 17 CREATE alpha.beta.gamma
 S: 17 OK CREATE completed.
 C: 18 LIST "" alpha*
-S: \* LIST \(\) "." "alpha"
-S: \* LIST \(\) "." "alpha.beta"
-S: \* LIST \(\) "." "alpha.beta.gamma"
+S: \* LIST \(\\HasChildren\) "." "alpha"
+S: \* LIST \(\\HasChildren\) "." "alpha.beta"
+S: \* LIST \(\\HasNoChildren\) "." "alpha.beta.gamma"
 S: 18 OK LIST completed.
 
 #

Modified: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListMailboxes.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListMailboxes.test?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListMailboxes.test
(original)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListMailboxes.test
Tue Apr  7 14:31:14 2009
@@ -28,27 +28,27 @@
 
 # Empty 1st arg searches default context (#mail)
 C: 10 LIST "" listtest
-S: \* LIST \(\) \"\.\" "listtest"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest"
 S: 10 OK LIST completed.
 
 # % returns all mailboxes matching
 C: a1 LIST "" %
 SUB {
-S: \* LIST \(\) \"\.\" "listtest"
-S: \* LIST \(\) \"\.\" "listtest1"
-S: \* LIST \(\) \"\.\" "INBOX"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest1"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "INBOX"
 }
 S: a1 OK LIST completed.
 C: a2 LIST "" INBOX%
-S: \* LIST \(\) \"\.\" "INBOX"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "INBOX"
 S: a2 OK LIST completed.
 C: a3 LIST "" I%
-S: \* LIST \(\) \"\.\" "INBOX"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "INBOX"
 S: a3 OK LIST completed.
 C: a4 LIST "" l%
 SUB {
-S: \* LIST \(\) \"\.\" "listtest"
-S: \* LIST \(\) \"\.\" "listtest1"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest1"
 }
 S: a4 OK LIST completed.
 
@@ -56,25 +56,25 @@
 # * returns all folders and subfolders
 C: b1 LIST "" *
 SUB {
-S: \* LIST \(\) \"\.\" "listtest"
-S: \* LIST \(\) \"\.\" "listtest1"
-S: \* LIST \(\) \"\.\" "listtest.subfolder"
-S: \* LIST \(\) \"\.\" "listtest1.subfolder1"
-S: \* LIST \(\) \"\.\" "INBOX"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest1"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "listtest.subfolder"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "listtest1.subfolder1"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "INBOX"
 }
 S: b1 OK LIST completed.
 C: b2 LIST "" INBOX*
-S: \* LIST \(\) \"\.\" "INBOX"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "INBOX"
 S: b2 OK LIST completed.
 C: b3 LIST "" I*
-S: \* LIST \(\) \"\.\" "INBOX"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "INBOX"
 S: b3 OK LIST completed.
 C: b4 LIST "" l*
 SUB {
-S: \* LIST \(\) \"\.\" "listtest"
-S: \* LIST \(\) \"\.\" "listtest1"
-S: \* LIST \(\) \"\.\" "listtest.subfolder"
-S: \* LIST \(\) \"\.\" "listtest1.subfolder1"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest1"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "listtest.subfolder"
+S: \* LIST \(\\HasNoChildren\) \"\.\" "listtest1.subfolder1"
 }
 S: b4 OK LIST completed.
 

Modified: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPercentWildcard.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPercentWildcard.test?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPercentWildcard.test
(original)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPercentWildcard.test
Tue Apr  7 14:31:14 2009
@@ -29,30 +29,30 @@
 
 C: A06 LIST "" %
 SUB {
-S: \* LIST \(\) \"\.\" \"one\"
-S: \* LIST \(\) \"\.\" \"two\"
-S: \* LIST \(\) \"\.\" \"three\"
-S: \* LIST \(\) \"\.\" \"four\"
-S: \* LIST \(\) \"\.\" \"five\"
-S: \* LIST \(\) \"\.\" \"INBOX\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"one\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"two\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"three\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"four\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"five\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"INBOX\"
 }
 S: A06 OK LIST completed.
 
 C: A07 LIST "" "%"
 SUB {
-S: \* LIST \(\) \"\.\" \"one\"
-S: \* LIST \(\) \"\.\" \"two\"
-S: \* LIST \(\) \"\.\" \"three\"
-S: \* LIST \(\) \"\.\" \"four\"
-S: \* LIST \(\) \"\.\" \"five\"
-S: \* LIST \(\) \"\.\" \"INBOX\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"one\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"two\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"three\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"four\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"five\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"INBOX\"
 }
 S: A07 OK LIST completed.
 
 C: A08 LIST "" "%.%"
 SUB {
-S: \* LIST \(\) \"\.\" \"three.sub\"
-S: \* LIST \(\) \"\.\" \"four.sub\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"three.sub\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"four.sub\"
 }
 S: A08 OK LIST completed.
 

Modified: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPlus.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPlus.test?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPlus.test (original)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/ListPlus.test Tue
Apr  7 14:31:14 2009
@@ -36,45 +36,45 @@
 
 # Empty 1st arg searches default context (#mail)
 C: 10 LIST "" listtest
-S: \* LIST \(\) \"\.\" "listtest"
+S: \* LIST \(\\HasChildren\) \"\.\" "listtest"
 S: 10 OK LIST completed.
 
 # % returns all mailboxes matching
 C: a1 LIST "" %
 SUB {
-S: \* LIST \(\) \"\.\" \"listtest\"
-S: \* LIST \(\) \"\.\" \"listtest1\"
-S: \* LIST \(\) \"\.\" \"INBOX\"
-S: \* LIST \(\) \"\.\" \"funny\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"listtest\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"listtest1\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"INBOX\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"funny\"
 }
 S: a1 OK LIST completed.
 
 C: a2 list "" funny.%
 SUB {
-S: \* LIST \(\) \"\.\" \"funny.name with gaps\"
-S: \* LIST \(\) \"\.\" \"funny.name\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"funny.name with gaps\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"funny.name\"
 }
 S: a2 OK LIST completed.
 
 C: a3 LIST "" *
 SUB {
-S: \* LIST \(\) \"\.\" \"listtest\"
-S: \* LIST \(\) \"\.\" \"listtest.subfolder\"
-S: \* LIST \(\) \"\.\" \"listtest1\"
-S: \* LIST \(\) \"\.\" \"listtest1.subfolder1\"
-S: \* LIST \(\) \"\.\" \"INBOX\"
-S: \* LIST \(\) \"\.\" \"funny\"
-S: \* LIST \(\) \"\.\" \"funny.name with gaps\"
-S: \* LIST \(\) \"\.\" \"funny.name with gaps\.more\"
-S: \* LIST \(\) \"\.\" \"funny.name\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"listtest\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"listtest.subfolder\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"listtest1\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"listtest1.subfolder1\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"INBOX\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"funny\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"funny.name with gaps\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"funny.name with gaps\.more\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"funny.name\"
 }
 S: a3 OK LIST completed.
 
 C: a4 LIST "" funny.*
 SUB {
-S: \* LIST \(\) \"\.\" \"funny.name with gaps\"
-S: \* LIST \(\) \"\.\" \"funny.name with gaps\.more\"
-S: \* LIST \(\) \"\.\" \"funny.name\"
+S: \* LIST \(\\HasChildren\) \"\.\" \"funny.name with gaps\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"funny.name with gaps\.more\"
+S: \* LIST \(\\HasNoChildren\) \"\.\" \"funny.name\"
 }
 S: a4 OK LIST completed.
 

Modified: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameHierarchy.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameHierarchy.test?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameHierarchy.test
(original)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameHierarchy.test
Tue Apr  7 14:31:14 2009
@@ -25,73 +25,73 @@
 C: A5 CREATE one.two.three.four
 S: A5 OK CREATE completed\.
 C: A6 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "one"
-S: \* LIST \(\) "\." "one\.two"
-S: \* LIST \(\) "\." "one\.two\.three"
-S: \* LIST \(\) "\." "one\.two\.three\.four"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "one"
+S: \* LIST \(\\HasChildren\) "\." "one\.two"
+S: \* LIST \(\\HasChildren\) "\." "one\.two\.three"
+S: \* LIST \(\\HasNoChildren\) "\." "one\.two\.three\.four"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A6 OK LIST completed\.
 C: A7 RENAME one.two alpha.beta
 S: A7 OK RENAME completed\.
 C: A8 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "alpha\.beta"
-S: \* LIST \(\) "\." "alpha\.beta\.three"
-S: \* LIST \(\) "\." "alpha\.beta\.three\.four"
-S: \* LIST \(\) "\." "one"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta\.three"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.three\.four"
+S: \* LIST \(\\HasNoChildren\) "\." "one"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A8 OK LIST completed\.
 C: A9 RENAME alpha.beta.three.four alpha.beta.gamma.delta
 S: A9 OK RENAME completed\.
 C: A10 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "alpha\.beta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta"
-S: \* LIST \(\) "\." "alpha\.beta\.three"
-S: \* LIST \(\) "\." "one"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.three"
+S: \* LIST \(\\HasNoChildren\) "\." "one"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A10 OK LIST completed\.
 C: A11 RENAME alpha.beta.three aleph
 S: A11 OK RENAME completed\.
 C: A12 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "aleph"
-S: \* LIST \(\) "\." "alpha\.beta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta"
-S: \* LIST \(\) "\." "one"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasNoChildren\) "\." "aleph"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "one"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A12 OK LIST completed\.
 C: A13 RENAME aleph alpha.beta.gamma.delta.epsilon
 S: A13 OK RENAME completed\.
 C: A14 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "alpha\.beta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
-S: \* LIST \(\) "\." "one"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
+S: \* LIST \(\\HasNoChildren\) "\." "one"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A14 OK LIST completed\.
 C: A15 RENAME alpha.beta.gamma one
 S: A15 NO RENAME failed. Mailbox already exists\.
 C: A16 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "alpha\.beta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
-S: \* LIST \(\) "\." "one"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
+S: \* LIST \(\\HasNoChildren\) "\." "one"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A16 OK LIST completed\.
 C: A17 DELETE one
 S: A17 OK DELETE completed\.
 C: A18 DELETE alpha
 S: A18 NO DELETE failed. No such mailbox\.
 C: A19 LIST "" "*"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "alpha\.beta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta"
-S: \* LIST \(\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta"
+S: \* LIST \(\\HasChildren\) "\." "alpha\.beta\.gamma\.delta"
+S: \* LIST \(\\HasNoChildren\) "\." "alpha\.beta\.gamma\.delta\.epsilon"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 S: A19 OK LIST completed\.
 C: A20 DELETE aleph
 S: A20 NO DELETE failed. No such mailbox\.

Modified: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameSelected.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameSelected.test?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameSelected.test
(original)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/RenameSelected.test
Tue Apr  7 14:31:14 2009
@@ -124,18 +124,18 @@
 S: A10 OK FETCH completed\.
 C: A11 LIST "" "*"
 SUB {
-S: \* LIST \(\) "\." "testmailbox"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "testmailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 }
 S: A11 OK LIST completed\.
 C: A12 RENAME testmailbox anothermailbox
 S: A12 OK RENAME completed.
 C: A13 LIST "" "*"
 SUB {
-S: \* LIST \(\) "\." "anothermailbox"
-S: \* LIST \(\) "\." "INBOX"
-S: \* LIST \(\) "\." "selected"
+S: \* LIST \(\\HasNoChildren\) "\." "anothermailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+S: \* LIST \(\\HasNoChildren\) "\." "selected"
 }
 S: A13 OK LIST completed\.
 C: A14 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
(original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
Tue Apr  7 14:31:14 2009
@@ -39,7 +39,9 @@
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.MessageRange;
 import org.apache.james.imap.mailbox.StandardMailboxMetaDataComparator;
+import org.apache.james.imap.mailbox.StorageException;
 import org.apache.james.imap.mailbox.SubscriptionException;
+import org.apache.james.imap.mailbox.MailboxMetaData.Selectability;
 import org.apache.james.imap.mailbox.util.SimpleMailboxMetaData;
 import org.apache.james.imap.store.mail.MailboxMapper;
 import org.apache.james.imap.store.mail.model.Mailbox;
@@ -234,9 +236,14 @@
             final String name = mailbox.getName();
             if (name.startsWith(base)) {
                 final String match = name.substring(baseLength);
-                if (mailboxExpression.isExpressionMatch(match,
-                        HIERARCHY_DELIMITER)) {
-                    results.add(new SimpleMailboxMetaData(name, "."));
+                if (mailboxExpression.isExpressionMatch(match, HIERARCHY_DELIMITER)) {
+                    final MailboxMetaData.Children inferiors; 
+                    if (hasChildren(name, mapper)) {
+                        inferiors = MailboxMetaData.Children.HAS_CHILDREN;
+                    } else {
+                        inferiors = MailboxMetaData.Children.HAS_NO_CHILDREN;
+                    }
+                    results.add(new SimpleMailboxMetaData(name, ".", inferiors, Selectability.NONE));
                 }
             }
         }
@@ -245,6 +252,18 @@
 
     }
 
+    /**
+     * Does the mailbox with the given name have inferior child mailboxes?
+     * @param name not null
+     * @return true when the mailbox has children, false otherwise
+     * @throws StorageException 
+     * @throws TorqueException
+     */
+    private boolean hasChildren(String name, final MailboxMapper mapper) throws StorageException
{
+        final String search = name + HIERARCHY_DELIMITER + SQL_WILDCARD_CHAR;
+        return !mapper.findMailboxWithNameLike(search).isEmpty();
+    }
+
     public boolean mailboxExists(String mailboxName) throws MailboxException {
         synchronized (mailboxes) {
             final MailboxMapper mapper = createMailboxMapper();

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java?rev=762791&r1=762790&r2=762791&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
(original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
Tue Apr  7 14:31:14 2009
@@ -43,6 +43,7 @@
 import org.apache.james.imap.mailbox.MessageRange;
 import org.apache.james.imap.mailbox.StandardMailboxMetaDataComparator;
 import org.apache.james.imap.mailbox.SubscriptionException;
+import org.apache.james.imap.mailbox.MailboxMetaData.Selectability;
 import org.apache.james.imap.mailbox.util.SimpleMailboxMetaData;
 import org.apache.james.mailboxmanager.torque.om.MailboxRow;
 import org.apache.james.mailboxmanager.torque.om.MailboxRowPeer;
@@ -263,9 +264,14 @@
                 final String name = mailboxRow.getName();
                 if (name.startsWith(base)) {
                     final String match = name.substring(baseLength);
-                    if (mailboxExpression.isExpressionMatch(match,
-                            HIERARCHY_DELIMITER)) {
-                        results.add(new SimpleMailboxMetaData(name, "."));
+                    if (mailboxExpression.isExpressionMatch(match, HIERARCHY_DELIMITER))
{
+                        final MailboxMetaData.Children inferiors; 
+                        if (hasChildren(name)) {
+                            inferiors = MailboxMetaData.Children.HAS_CHILDREN;
+                        } else {
+                            inferiors = MailboxMetaData.Children.HAS_NO_CHILDREN;
+                        }
+                        results.add(new SimpleMailboxMetaData(name, ".", inferiors, Selectability.NONE));
                     }
                 }
             }
@@ -277,6 +283,19 @@
 
     }
 
+    /**
+     * Does the mailbox with the given name have inferior child mailboxes?
+     * @param name not null
+     * @return true when the mailbox has children, false otherwise
+     * @throws TorqueException
+     */
+    private boolean hasChildren(String name) throws TorqueException {
+        final Criteria criteria = new Criteria();
+        criteria.add(MailboxRowPeer.NAME, (Object)(name + HIERARCHY_DELIMITER + SQL_WILDCARD_CHAR),
Criteria.LIKE);
+        final List mailboxes = MailboxRowPeer.doSelect(criteria);
+        return !mailboxes.isEmpty();
+    }
+
     public void setSubscription(String mailboxName, boolean value) {
         // TODO implement subscriptions
     }



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