Index: torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
===================================================================
--- torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java	(Revision 961471)
+++ torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java	(Arbeitskopie)
@@ -242,8 +242,8 @@
             baseLength = base.length();
         }
 
-        final String search = mailboxExpression.getCombinedName(
-                MailboxConstants.DEFAULT_DELIMITER).replace(freeWildcard, SQL_WILDCARD_CHAR)
+        final String search = mailboxExpression.getCombinedName()
+                .replace(freeWildcard, SQL_WILDCARD_CHAR)
                 .replace(localWildcard, SQL_WILDCARD_CHAR);
 
         Criteria criteria = new Criteria();
Index: store/src/main/java/org/apache/james/imap/store/mail/model/Mailbox.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/mail/model/Mailbox.java	(Revision 961471)
+++ store/src/main/java/org/apache/james/imap/store/mail/model/Mailbox.java	(Arbeitskopie)
@@ -41,6 +41,30 @@
     public abstract Id getMailboxId();
 
     /**
+     * Gets the current namespace for this mailbox.
+     * @return not null
+     */
+    public abstract String getNamespace();
+    
+    /**
+     * Sets the current namespace for this mailbox.
+     * @param name not null
+     */
+    public abstract void setNamespace(String namespace);
+
+    /**
+     * Gets the current user for this mailbox.
+     * @return not null
+     */
+    public abstract String getUser();
+    
+    /**
+     * Sets the current user for this mailbox.
+     * @param name not null
+     */
+    public abstract void setuser(String user);
+
+    /**
      * Gets the current name for this mailbox.
      * @return not null
      */
Index: store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java	(Revision 961471)
+++ store/src/main/java/org/apache/james/imap/store/mail/MailboxMapper.java	(Arbeitskopie)
@@ -20,6 +20,7 @@
 
 import java.util.List;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
 import org.apache.james.imap.mailbox.StorageException;
 import org.apache.james.imap.store.mail.model.Mailbox;
@@ -63,7 +64,7 @@
      * @throws StorageException
      * @throws MailboxNotFoundException
      */
-    public abstract Mailbox<Id> findMailboxByName(String mailboxName)
+    public abstract Mailbox<Id> findMailboxByPath(MailboxPath mailboxName)
             throws StorageException, MailboxNotFoundException;
 
     /**
@@ -73,7 +74,7 @@
      * @return mailboxList
      * @throws StorageException
      */
-    public abstract List<Mailbox<Id>> findMailboxWithNameLike(String mailboxName)
+    public abstract List<Mailbox<Id>> findMailboxWithPathLike(MailboxPath mailboxPath)
             throws StorageException;
 
     /**
Index: store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java	(Revision 961471)
+++ store/src/main/java/org/apache/james/imap/store/StoreMessageManager.java	(Arbeitskopie)
@@ -273,7 +273,7 @@
                 }
             });
            
-            dispatcher.added(uid, mailboxSession.getSessionId(), getMailboxEntity().getName());
+            dispatcher.added(uid, mailboxSession.getSessionId(), new StoreMailboxPath<Id>(getMailboxEntity()));
             return uid;
         } catch (IOException e) {
             e.printStackTrace();
@@ -475,7 +475,7 @@
         
         Iterator<Long> uidIt = uids.iterator();
         while(uidIt.hasNext()) {
-            dispatcher.expunged(uidIt.next(), mailboxSession.getSessionId(), getMailboxEntity().getName());
+            dispatcher.expunged(uidIt.next(), mailboxSession.getSessionId(), new StoreMailboxPath<Id>(getMailboxEntity()));
         }
         return uids.iterator();
     }
@@ -520,7 +520,7 @@
         Iterator<Long> it = newFlagsByUid.keySet().iterator();
         while (it.hasNext()) {
             Long uid = it.next();
-            dispatcher.flagsUpdated(uid, mailboxSession.getSessionId(), getMailboxEntity().getName(), originalFlagsByUid.get(uid), newFlagsByUid.get(uid));
+            dispatcher.flagsUpdated(uid, mailboxSession.getSessionId(), new StoreMailboxPath<Id>(getMailboxEntity()), originalFlagsByUid.get(uid), newFlagsByUid.get(uid));
 
         }
         return newFlagsByUid;
@@ -596,7 +596,7 @@
             }
             // Wait until commit before issuing events
             for (MailboxMembership<Id> newMember:copiedRows) {
-                dispatcher.added(newMember.getUid(), session.getSessionId(), getMailboxEntity().getName());
+                dispatcher.added(newMember.getUid(), session.getSessionId(), new StoreMailboxPath<Id>(getMailboxEntity()));
             }
         } catch (MessagingException e) {
             throw new MailboxException(HumanReadableText.FAILURE_MAIL_PARSE, e);
Index: store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java	(Revision 0)
+++ store/src/main/java/org/apache/james/imap/store/StoreMailboxPath.java	(Revision 0)
@@ -0,0 +1,43 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.imap.store;
+
+import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.store.mail.model.Mailbox;
+
+public class StoreMailboxPath<Id> extends MailboxPath {
+
+    public StoreMailboxPath(String namespace, String user, String name) {
+        super(namespace, user, name);
+    }
+
+    public StoreMailboxPath(MailboxPath mailboxPath) {
+        super(mailboxPath);
+    }
+
+    public StoreMailboxPath(MailboxPath mailboxPath, String name) {
+        super(mailboxPath, name);
+    }
+    
+    public StoreMailboxPath(Mailbox<Id> mailbox) {
+        super(mailbox.getNamespace(), mailbox.getUser(), mailbox.getName());
+    }
+
+}
Index: store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java	(Revision 961471)
+++ store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java	(Arbeitskopie)
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.apache.commons.logging.Log;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxExistsException;
@@ -68,6 +69,7 @@
         this.consumer = consumer;
         this.mailboxSessionMapperFactory = mailboxSessionMapperFactory;
     }
+    
     /**
      * Create a {@link StoreMessageManager} for the given Mailbox
      * 
@@ -82,36 +84,35 @@
      * @param namespaceName
      * @throws MailboxException
      */
-    protected abstract void doCreateMailbox(String namespaceName, MailboxSession session) throws MailboxException;
+    protected abstract void doCreateMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
     
-    
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#getMailbox(java.lang.String, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#getMailbox(org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public org.apache.james.imap.mailbox.Mailbox getMailbox(String mailboxName, MailboxSession session)
+    public org.apache.james.imap.mailbox.Mailbox getMailbox(MailboxPath mailboxPath, MailboxSession session)
     throws MailboxException {
-        return doGetMailbox(mailboxName, session);
+        return doGetMailbox(mailboxPath, session);
     }
 
     /**
-     * Get the Mailbox for the given name. If non is found a MailboxException will get thrown
+     * Get the Mailbox for the given name. If none is found a MailboxException will get thrown
      * 
-     * @param mailboxName the name of the mailbox to return
+     * @param mailboxPath the name of the mailbox to return
      * @return mailbox the mailbox for the given name
      * @throws MailboxException get thrown if no Mailbox could be found for the given name
      */
-    private StoreMessageManager<Id> doGetMailbox(String mailboxName, MailboxSession session) throws MailboxException {
+    private StoreMessageManager<Id> doGetMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException {
         synchronized (mutex) {
             final MailboxMapper<Id> mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
-            Mailbox<Id> mailboxRow = mapper.findMailboxByName(mailboxName);
+            Mailbox<Id> mailboxRow = mapper.findMailboxByPath(mailboxPath);
             
             if (mailboxRow == null) {
-                getLog().info("Mailbox '" + mailboxName + "' not found.");
-                throw new MailboxNotFoundException(mailboxName);
+                getLog().info("Mailbox '" + mailboxPath + "' not found.");
+                throw new MailboxNotFoundException(mailboxPath);
 
             } else {
-                getLog().debug("Loaded mailbox " + mailboxName);
+                getLog().debug("Loaded mailbox " + mailboxPath);
 
                 StoreMessageManager<Id> result = createMessageManager(dispatcher, consumer, mailboxRow, session);
                 result.addListener(delegatingListener);
@@ -122,53 +123,38 @@
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#createMailbox(java.lang.String, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#createMailbox(org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public void createMailbox(String namespaceName, MailboxSession mailboxSession)
+    public void createMailbox(MailboxPath mailboxPath, MailboxSession mailboxSession)
     throws MailboxException {
-        getLog().debug("createMailbox " + namespaceName);
-        final int length = namespaceName.length();
+        getLog().debug("createMailbox " + mailboxPath);
+        final int length = mailboxPath.getName().length();
         if (length == 0) {
             getLog().warn("Ignoring mailbox with empty name");
-        } else if (namespaceName.charAt(length - 1) == MailboxConstants.DEFAULT_DELIMITER) {
-            createMailbox(namespaceName.substring(0, length - 1), mailboxSession);
-        } else {
+        }
+        else {
+            if (mailboxPath.getName().charAt(length - 1) == MailboxConstants.DEFAULT_DELIMITER)
+                mailboxPath.setName(mailboxPath.getName().substring(0, length - 1));
+            if (mailboxExists(mailboxPath, mailboxSession))
+                throw new MailboxExistsException(mailboxPath.toString()); 
             synchronized (mutex) {
-                // Create root first
-                // If any creation fails then mailbox will not be created
+                // Create parents first
+                // If any creation fails then the mailbox will not be created
                 // TODO: transaction
-                int index = namespaceName.indexOf(MailboxConstants.DEFAULT_DELIMITER);
-                int count = 0;
-                while (index >= 0) {
-                    // Until explicit namespace support is added,
-                    // this workaround prevents the namespaced elements being
-                    // created
-                    // TODO: add explicit support for namespaces
-                    if (index > 0 && count++ > 1) {
-                        final String mailbox = namespaceName
-                        .substring(0, index);
-                        if (!mailboxExists(mailbox, mailboxSession)) {
-                            doCreateMailbox(mailbox, mailboxSession);
-                        }
-                    }
-                    index = namespaceName.indexOf(MailboxConstants.DEFAULT_DELIMITER, ++index);
-                }
-                if (mailboxExists(namespaceName, mailboxSession)) {
-                    throw new MailboxExistsException(namespaceName); 
-                } else {
-                	doCreateMailbox(namespaceName, mailboxSession);
-                }
+                for (MailboxPath mailbox : mailboxPath.getHierarchyLevels(MailboxConstants.DEFAULT_DELIMITER))
+                    if (!mailboxExists(mailbox, mailboxSession))
+                        doCreateMailbox(mailbox, mailboxSession);
             }
         }
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#deleteMailbox(java.lang.String, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#deleteMailbox(org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public void deleteMailbox(final String mailboxName, final MailboxSession session)
+    public void deleteMailbox(final MailboxPath mailboxPath, final MailboxSession session)
     throws MailboxException {
-        session.getLog().info("deleteMailbox " + mailboxName);
+        session.getLog().info("deleteMailbox " + mailboxPath);
         synchronized (mutex) {
             // TODO put this into a serilizable transaction
             
@@ -177,7 +163,7 @@
             mapper.execute(new TransactionalMapper.Transaction() {
 
                 public void run() throws MailboxException {
-                    Mailbox<Id> mailbox = mapper.findMailboxByName(mailboxName);
+                    Mailbox<Id> mailbox = mapper.findMailboxByPath(mailboxPath);
                     if (mailbox == null) {
                         throw new MailboxNotFoundException("Mailbox not found");
                     }
@@ -186,21 +172,21 @@
                 
             });
             
-            dispatcher.mailboxDeleted(session.getSessionId(), mailboxName);
+            dispatcher.mailboxDeleted(session.getSessionId(), mailboxPath);
         }
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#renameMailbox(java.lang.String, java.lang.String, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#renameMailbox(org.apache.james.imap.api.MailboxPath, org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public void renameMailbox(final String from, final String to, final MailboxSession session)
+    public void renameMailbox(final MailboxPath from, final MailboxPath to, final MailboxSession session)
     throws MailboxException {
         final Log log = getLog();
         if (log.isDebugEnabled()) log.debug("renameMailbox " + from + " to " + to);
         synchronized (mutex) {
             if (mailboxExists(to, session)) {
-                throw new MailboxExistsException(to);
+                throw new MailboxExistsException(to.toString());
             }
 
             final MailboxMapper<Id> mapper = mailboxSessionMapperFactory.getMailboxMapper(session);                
@@ -208,25 +194,28 @@
 
                 public void run() throws MailboxException {
                     // TODO put this into a serilizable transaction
-                    final Mailbox<Id> mailbox = mapper.findMailboxByName(from);
-
+                    final Mailbox<Id> mailbox = mapper.findMailboxByPath(from);
                     if (mailbox == null) {
                         throw new MailboxNotFoundException(from);
                     }
-                    mailbox.setName(to);
+                    mailbox.setNamespace(to.getNamespace());
+                    mailbox.setuser(to.getUser());
+                    mailbox.setName(to.getName());
                     mapper.save(mailbox);
 
                     changeMailboxName(from, to, session);
 
-                    // rename submailbox
-                    final List<Mailbox<Id>> subMailboxes = mapper.findMailboxWithNameLike(from + MailboxConstants.DEFAULT_DELIMITER + "%");
+                    // rename submailboxes
+                    MailboxPath children = new MailboxPath(MailboxConstants.USER_NAMESPACE, from.getUser(), from.getName() + MailboxConstants.DEFAULT_DELIMITER + "%");
+                    final List<Mailbox<Id>> subMailboxes = mapper.findMailboxWithPathLike(children);
                     for (Mailbox<Id> sub:subMailboxes) {
                         final String subOriginalName = sub.getName();
-                        final String subNewName = to + subOriginalName.substring(from.length());
+                        final String subNewName = to.getName() + subOriginalName.substring(from.getName().length());
                         sub.setName(subNewName);
                         mapper.save(sub);
 
-                        changeMailboxName(subOriginalName, subNewName, session);
+                        changeMailboxName(new MailboxPath(children, subOriginalName),
+                                new MailboxPath(children, subNewName), session);
 
                         if (log.isDebugEnabled()) log.debug("Rename mailbox sub-mailbox " + subOriginalName + " to "
                                 + subNewName);
@@ -243,20 +232,19 @@
      * @param from not null
      * @param to not null
      */
-    private void changeMailboxName(String from, String to, MailboxSession session) {
+    private void changeMailboxName(MailboxPath from, MailboxPath to, MailboxSession session) {
         dispatcher.mailboxRenamed(from, to, session.getSessionId());
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#copyMessages(org.apache.james.imap.mailbox.MessageRange, java.lang.String, java.lang.String, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#copyMessages(org.apache.james.imap.mailbox.MessageRange, org.apache.james.imap.api.MailboxPath, org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public void copyMessages(MessageRange set, String from, String to,
-            MailboxSession session) throws MailboxException {
+    public void copyMessages(MessageRange set, MailboxPath from, MailboxPath to, MailboxSession session)
+    throws MailboxException {
         synchronized (mutex) {
-
-        StoreMessageManager<Id> toMailbox = doGetMailbox(to, session);
-        StoreMessageManager<Id> fromMailbox = doGetMailbox(from, session);
+            StoreMessageManager<Id> toMailbox = doGetMailbox(to, session);
+            StoreMessageManager<Id> fromMailbox = doGetMailbox(from, session);
             fromMailbox.copyTo(set, toMailbox, session);
         }
     }
@@ -269,50 +257,50 @@
     throws MailboxException {
         final char localWildcard = mailboxExpression.getLocalWildcard();
         final char freeWildcard = mailboxExpression.getFreeWildcard();
-        final String base = mailboxExpression.getBase();
+        final String baseName = mailboxExpression.getBase().getName();
         final int baseLength;
-        if (base == null) {
+        if (baseName == null) {
             baseLength = 0;
         } else {
-            baseLength = base.length();
+            baseLength = baseName.length();
         }
+        final String combinedName = mailboxExpression.getCombinedName()
+                                    .replace(freeWildcard, SQL_WILDCARD_CHAR)
+                                    .replace(localWildcard, SQL_WILDCARD_CHAR);
+        final MailboxPath search = new MailboxPath(mailboxExpression.getBase(), combinedName);
 
-        final String search = mailboxExpression.getCombinedName(
-                MailboxConstants.DEFAULT_DELIMITER).replace(freeWildcard, SQL_WILDCARD_CHAR)
-                .replace(localWildcard, SQL_WILDCARD_CHAR);
-
         final MailboxMapper<Id> mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
-        final List<Mailbox<Id>> mailboxes = mapper.findMailboxWithNameLike(search);
+        final List<Mailbox<Id>> mailboxes = mapper.findMailboxWithPathLike(search);
         final List<MailboxMetaData> results = new ArrayList<MailboxMetaData>(mailboxes.size());
         for (Mailbox<Id> mailbox: mailboxes) {
             final String name = mailbox.getName();
-            if (name.startsWith(base)) {
+            if (name.startsWith(baseName)) {
                 final String match = name.substring(baseLength);
-                if (mailboxExpression.isExpressionMatch(match, MailboxConstants.DEFAULT_DELIMITER)) {
+                if (mailboxExpression.isExpressionMatch(match)) {
                     final MailboxMetaData.Children inferiors; 
                     if (mapper.hasChildren(mailbox)) {
                         inferiors = MailboxMetaData.Children.HAS_CHILDREN;
                     } else {
                         inferiors = MailboxMetaData.Children.HAS_NO_CHILDREN;
                     }
-                    results.add(new SimpleMailboxMetaData(name, ".", inferiors, Selectability.NONE));
+                    MailboxPath mailboxPath = new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), name);
+                    results.add(new SimpleMailboxMetaData(mailboxPath, ".", inferiors, Selectability.NONE));
                 }
             }
         }
         Collections.sort(results, new StandardMailboxMetaDataComparator());
         return results;
-
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#mailboxExists(java.lang.String, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#mailboxExists(org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public boolean mailboxExists(String mailboxName, MailboxSession session) throws MailboxException {
+    public boolean mailboxExists(MailboxPath mailboxPath, MailboxSession session) throws MailboxException {
         synchronized (mutex) {
             try {
                 final MailboxMapper<Id> mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
-                mapper.findMailboxByName(mailboxName);
+                mapper.findMailboxByPath(mailboxPath);
                 return true;
             }
             catch (MailboxNotFoundException e) {
@@ -323,10 +311,10 @@
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#addListener(java.lang.String, org.apache.james.imap.mailbox.MailboxListener, org.apache.james.imap.mailbox.MailboxSession)
+     * @see org.apache.james.imap.mailbox.MailboxManager#addListener(org.apache.james.imap.api.MailboxPath, org.apache.james.imap.mailbox.MailboxListener, org.apache.james.imap.mailbox.MailboxSession)
      */
-    public void addListener(String mailboxName, MailboxListener listener, MailboxSession session) throws MailboxException {
-        delegatingListener.addListener(mailboxName, listener);
+    public void addListener(MailboxPath mailboxPath, MailboxListener listener, MailboxSession session) throws MailboxException {
+        delegatingListener.addListener(mailboxPath, listener);
     }
 
 }
Index: store/src/main/java/org/apache/james/imap/store/DelegatingMailboxManager.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/DelegatingMailboxManager.java	(Revision 961471)
+++ store/src/main/java/org/apache/james/imap/store/DelegatingMailboxManager.java	(Arbeitskopie)
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.AbstractLogEnabled;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.BadCredentialsException;
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
@@ -37,7 +38,7 @@
  * Abstract {@link MailboxManager} which delegates various stuff to the {@link Authenticator} and {@link Subscriber}
  *
  */
-public abstract class DelegatingMailboxManager extends AbstractLogEnabled implements MailboxManager{
+public abstract class DelegatingMailboxManager extends AbstractLogEnabled implements MailboxManager {
 
     private final Authenticator authenticator;
     private final Subscriber subscriper;
@@ -93,19 +94,6 @@
         return MailboxConstants.DEFAULT_DELIMITER;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxManager#resolve(java.lang.String, java.lang.String)
-     */
-    public String resolve(final String userName, String mailboxPath) {
-        if (mailboxPath.length() > 0 && mailboxPath.charAt(0) != MailboxConstants.DEFAULT_DELIMITER) {
-            mailboxPath = MailboxConstants.DEFAULT_DELIMITER + mailboxPath;
-        }
-        final String result = MailboxConstants.USER_NAMESPACE + MailboxConstants.DEFAULT_DELIMITER + userName
-        + mailboxPath;
-        return result;
-    }
-
     /**
      * Log in the user with the given userid and password
      * 
Index: store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java
===================================================================
--- store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java	(Revision 961471)
+++ store/src/main/java/org/apache/james/imap/store/DelegatingMailboxListener.java	(Arbeitskopie)
@@ -20,10 +20,10 @@
 package org.apache.james.imap.store;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
+import org.apache.james.imap.api.MailboxPath;
+import org.apache.james.imap.api.MailboxPathHashMap;
 import org.apache.james.imap.mailbox.MailboxListener;
 
 /**
@@ -32,13 +32,13 @@
  */
 public class DelegatingMailboxListener implements MailboxListener{
 
-    private Map<String,List<MailboxListener>> listeners = new HashMap<String, List<MailboxListener>>();
+    private MailboxPathHashMap<List<MailboxListener>> listeners = new MailboxPathHashMap<List<MailboxListener>>();
 
-    public synchronized void addListener(String name, MailboxListener listener) {
-        List<MailboxListener> mListeners = listeners.get(name);
+    public synchronized void addListener(MailboxPath path, MailboxListener listener) {
+        List<MailboxListener> mListeners = listeners.get(path);
         if (mListeners == null) {
             mListeners = new ArrayList<MailboxListener>();
-            listeners.put(name, mListeners);
+            listeners.put(path, mListeners);
         }
         if (mListeners.contains(listener) == false) {
             mListeners.add(listener);
@@ -51,7 +51,7 @@
      * @see org.apache.james.imap.mailbox.MailboxListener#event(org.apache.james.imap.mailbox.MailboxListener.Event)
      */
     public void event(Event event) {
-        List<MailboxListener> mListeners = listeners.get(event.getMailboxName());
+        List<MailboxListener> mListeners = listeners.get(event.getMailboxPath());
         if (mListeners != null && mListeners.isEmpty() == false) {
             for (int i = 0; i < mListeners.size(); i++) {
                 MailboxListener l = mListeners.get(i);
Index: seda/src/test/resources/org/apache/james/imap/scripts/ListNamespace.test
===================================================================
--- seda/src/test/resources/org/apache/james/imap/scripts/ListNamespace.test	(Revision 961471)
+++ seda/src/test/resources/org/apache/james/imap/scripts/ListNamespace.test	(Arbeitskopie)
@@ -29,11 +29,11 @@
 S: e1 OK LIST completed.
 
 # Rooted in users namespace
-C: e2 LIST "#mail" ""
-S: \* LIST \(\\Noselect\) \"\.\" \"\#mail\"
+C: e2 LIST "#private" ""
+S: \* LIST \(\\Noselect\) \"\.\" \"\#private\"
 S: e2 OK LIST completed.
-C: e3 LIST "#mail.someone" ""
-S: \* LIST \(\\Noselect\) \"\.\" \"\#mail\"
+C: e3 LIST "#private.someone" ""
+S: \* LIST \(\\Noselect\) \"\.\" \"\#private\"
 S: e3 OK LIST completed.
 
 # Rooted in shared namespace
Index: processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
===================================================================
--- processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java	(Revision 961471)
+++ processor/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java	(Arbeitskopie)
@@ -28,6 +28,7 @@
 
 import javax.mail.Flags;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
 import org.junit.Before;
 import org.junit.Test;
@@ -37,15 +38,15 @@
     private static final long BASE_SESSION_ID = 99;
 
     private MailboxEventAnalyser analyser;
-    private String name = "Mailbox Name";
+    MailboxPath mailboxPath = new MailboxPath("namespace", "user", "name");
     @Before
     public void setUp() throws Exception {
-        analyser = new MailboxEventAnalyser(BASE_SESSION_ID, name);
+        analyser = new MailboxEventAnalyser(BASE_SESSION_ID, mailboxPath);
     }
 
     @Test
     public void testShouldBeNoSizeChangeOnOtherEvent() throws Exception {
-        final MailboxListener.Event event = new MailboxListener.Event(0, name) {};
+        final MailboxListener.Event event = new MailboxListener.Event(0, mailboxPath) {};
       
         analyser.event(event);
         assertFalse(analyser.isSizeChanged());
@@ -53,13 +54,13 @@
 
     @Test
     public void testShouldBeNoSizeChangeOnAdded() throws Exception {
-        analyser.event(new FakeMailboxListenerAdded(78, 11, name));
+        analyser.event(new FakeMailboxListenerAdded(78, 11, mailboxPath));
         assertTrue(analyser.isSizeChanged());
     }
 
     @Test
     public void testShouldNoSizeChangeAfterReset() throws Exception {
-        analyser.event(new FakeMailboxListenerAdded(99, 11, name));
+        analyser.event(new FakeMailboxListenerAdded(99, 11, mailboxPath));
         analyser.reset();
         assertFalse(analyser.isSizeChanged());
     }
@@ -67,7 +68,7 @@
     @Test
     public void testShouldNotSetUidWhenNoSystemFlagChange() throws Exception {
         final FakeMailboxListenerFlagsUpdate update = new FakeMailboxListenerFlagsUpdate(
-                90, new Flags(), 11, name);
+                90, new Flags(), 11, mailboxPath);
         analyser.event(update);
         assertNotNull(analyser.flagUpdateUids());
         assertFalse(analyser.flagUpdateUids().iterator().hasNext());
@@ -77,7 +78,7 @@
     public void testShouldSetUidWhenSystemFlagChange() throws Exception {
         final long uid = 900L;
         final FakeMailboxListenerFlagsUpdate update = new FakeMailboxListenerFlagsUpdate(
-                uid, new Flags(), 11, name);
+                uid, new Flags(), 11, mailboxPath);
         update.flags.add(Flags.Flag.ANSWERED);
         analyser.event(update);
         final Iterator<Long> iterator = analyser.flagUpdateUids().iterator();
@@ -91,7 +92,7 @@
     public void testShouldClearFlagUidsUponReset() throws Exception {
         final long uid = 900L;
         final FakeMailboxListenerFlagsUpdate update = new FakeMailboxListenerFlagsUpdate(
-                uid, new Flags(), 11, name);
+                uid, new Flags(), 11, mailboxPath);
         update.flags.add(Flags.Flag.ANSWERED);
         analyser.event(update);
         analyser.reset();
@@ -104,7 +105,7 @@
             throws Exception {
         final long uid = 900L;
         final FakeMailboxListenerFlagsUpdate update = new FakeMailboxListenerFlagsUpdate(
-                uid, new Flags(), 11, name);
+                uid, new Flags(), 11, mailboxPath);
         update.flags.add(Flags.Flag.ANSWERED);
         analyser.setSilentFlagChanges(true);
         analyser.event(update);
@@ -119,7 +120,7 @@
     public void testShouldNotSetUidWhenSystemFlagChangeSameSessionInSilentMode()
             throws Exception {
         final FakeMailboxListenerFlagsUpdate update = new FakeMailboxListenerFlagsUpdate(
-                345, new Flags(), BASE_SESSION_ID, name);
+                345, new Flags(), BASE_SESSION_ID, mailboxPath);
         update.flags.add(Flags.Flag.ANSWERED);
         analyser.setSilentFlagChanges(true);
         analyser.event(update);
@@ -131,7 +132,7 @@
     @Test
     public void testShouldNotSetUidWhenOnlyRecentFlagUpdated() throws Exception {
         final FakeMailboxListenerFlagsUpdate update = new FakeMailboxListenerFlagsUpdate(
-                886, new Flags(), BASE_SESSION_ID ,name);
+                886, new Flags(), BASE_SESSION_ID ,mailboxPath);
         update.flags.add(Flags.Flag.RECENT);
         analyser.event(update);
         final Iterator<Long> iterator = analyser.flagUpdateUids().iterator();
Index: processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java
===================================================================
--- processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java	(Revision 961471)
+++ processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerFlagsUpdate.java	(Arbeitskopie)
@@ -26,6 +26,7 @@
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener.FlagsUpdated;
 
 public class FakeMailboxListenerFlagsUpdate extends FlagsUpdated {
@@ -37,8 +38,8 @@
     public Flags newFlags;
 
     public FakeMailboxListenerFlagsUpdate(long subjectUid, Flags newFlags,
-            long sessionId, String name) {
-        super(sessionId, name);
+            long sessionId, MailboxPath path) {
+        super(sessionId, path);
         this.subjectUid = subjectUid;
         this.newFlags = newFlags;
     }
Index: processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java
===================================================================
--- processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java	(Revision 961471)
+++ processor/src/test/java/org/apache/james/imap/processor/base/FakeMailboxListenerAdded.java	(Arbeitskopie)
@@ -19,6 +19,7 @@
 
 package org.apache.james.imap.processor.base;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
 
 public class FakeMailboxListenerAdded extends MailboxListener.Added {
@@ -27,8 +28,8 @@
 
     public long sessionId;
 
-    public FakeMailboxListenerAdded(long subjectUid, long sessionId, String name) {
-        super(sessionId, name);
+    public FakeMailboxListenerAdded(long subjectUid, long sessionId, MailboxPath path) {
+        super(sessionId, path);
         this.subjectUid = subjectUid;
     }
 
Index: processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
===================================================================
--- processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java	(Revision 961471)
+++ processor/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java	(Arbeitskopie)
@@ -27,6 +27,7 @@
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.request.DayMonthYear;
@@ -81,6 +82,8 @@
     private static final SearchQuery.NumericRange[] RANGES = {
             new SearchQuery.NumericRange(1),
             new SearchQuery.NumericRange(42, 1048) };
+    
+    private static final MailboxPath mailboxPath = new MailboxPath("namespace", "user", "name");
 
     SearchProcessor processor;
 
@@ -194,13 +197,12 @@
 
     private void expectsGetSelectedMailbox() throws Exception {
         mockery.checking(new Expectations() {{
-            atMost(1).of(mailboxManager).resolve(with(equal("user")), with(equal("name")));will(returnValue("user"));
-            atMost(1).of(mailboxManager).getMailbox(with(equal("user")),  with(same(mailboxSession)));will(returnValue(mailbox));
-            atMost(1).of(mailboxManager).getMailbox(with(equal("MailboxName")), with(same(mailboxSession)));will(returnValue(mailbox));
+            atMost(1).of(mailboxManager).getMailbox(with(equal(mailboxPath)),  with(same(mailboxSession)));will(returnValue(mailbox));
+            atMost(1).of(mailboxManager).getMailbox(with(equal(mailboxPath)), with(same(mailboxSession)));will(returnValue(mailbox));
             allowing(session).getSelected();will(returnValue(selectedMailbox));
             atMost(1).of(selectedMailbox).isRecentUidRemoved();will(returnValue(false));
             atLeast(1).of(selectedMailbox).isSizeChanged();will(returnValue(false));
-            atLeast(1).of(selectedMailbox).getName();will(returnValue("MailboxName"));
+            atLeast(1).of(selectedMailbox).getPath();will(returnValue(mailboxPath));
             atMost(1).of(selectedMailbox).flagUpdateUids();will(returnValue(Collections.EMPTY_LIST));
             atMost(1).of(selectedMailbox).resetEvents();
             oneOf(selectedMailbox).getRecent();will(returnValue(new ArrayList<Long>()));
Index: processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
===================================================================
--- processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java	(Revision 961471)
+++ processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java	(Arbeitskopie)
@@ -20,6 +20,7 @@
 package org.apache.james.imap.processor;
 
 import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
@@ -53,6 +54,8 @@
 
     StatusResponseFactory serverResponseFactory;
 
+    MailboxPath inboxPath = new MailboxPath("", "", "INBOX");
+
     private Mockery mockery = new JUnit4Mockery();
     
     @Before
@@ -80,67 +83,66 @@
     }
 
     void setUpResult(final MailboxMetaData.Children children, final MailboxMetaData.Selectability selectability,
-            final String hierarchyDelimiter, final String name) {
+            final String hierarchyDelimiter, final MailboxPath path) {
         mockery.checking(new Expectations() {{
             oneOf(result).inferiors();will(returnValue(children));
             oneOf(result).getSelectability();will(returnValue(selectability));
             oneOf(result).getHierarchyDelimiter();will(returnValue(hierarchyDelimiter));
-            oneOf(result).getName();will(returnValue(name));
+            oneOf(result).getPath();will(returnValue(path));
         }});
     }
     
     @Test
     public void testHasChildren() throws Exception {
-        setUpResult(MailboxMetaData.Children.HAS_CHILDREN, MailboxMetaData.Selectability.NONE, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.HAS_CHILDREN, MailboxMetaData.Selectability.NONE, ".", inboxPath);
         mockery.checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, false, false, false, true, false, ".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, false, false, false, true, false, ".", "INBOX"))));
         }});
-        processor.processResult(responder, false, 0, result);
+        processor.processResult(responder, false, result);
     }
 
     @Test
     public void testHasNoChildren() throws Exception {
-        setUpResult(MailboxMetaData.Children.HAS_NO_CHILDREN, MailboxMetaData.Selectability.NONE, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.HAS_NO_CHILDREN, MailboxMetaData.Selectability.NONE, ".", inboxPath);
         mockery.checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, false, false, false, false, true, ".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, false, false, false, false, true, ".", "INBOX"))));
         }});
-        processor.processResult(responder, false, 0, result);
+        processor.processResult(responder, false, result);
     }
     
     @Test
     public void testNoInferiors() throws Exception {
-        setUpResult(MailboxMetaData.Children.NO_INFERIORS, MailboxMetaData.Selectability.NONE, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.NO_INFERIORS, MailboxMetaData.Selectability.NONE, ".", inboxPath);
         mockery.checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(true, false, false, false, false, false, ".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(true, false, false, false, false, false, ".", "INBOX"))));
         }});
-        processor.processResult(responder, false, 0, result);
+        processor.processResult(responder, false, result);
     }
 
     @Test
     public void testNoSelect() throws Exception {
-        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.NOSELECT, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.NOSELECT, ".", inboxPath);
         mockery.checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, true, false, false, false, false, ".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, true, false, false, false, false, ".", "INBOX"))));
         }});
-        processor.processResult(responder, false, 0, result);
+        processor.processResult(responder, false, result);
     }
 
     @Test
     public void testUnMarked() throws Exception {
-        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.UNMARKED, ".",
-                "#INBOX");
+        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.UNMARKED, ".", inboxPath);
         mockery.checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, false, false, true, false, false, ".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, false, false, true, false, false, ".", "INBOX"))));
         }});
-        processor.processResult(responder, false, 0, result);
+        processor.processResult(responder, false, result);
     }
 
     @Test
     public void testMarked() throws Exception {
-        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.MARKED, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.MARKED, ".", inboxPath);
         mockery.checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, false, true, false, false, false, ".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, false, true, false, false, false, ".", "INBOX"))));
         }});
-        processor.processResult(responder, false, 0, result);
+        processor.processResult(responder, false, result);
     }
 }
Index: processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java	(Arbeitskopie)
@@ -25,6 +25,7 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.process.SelectedMailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
@@ -45,16 +46,16 @@
     private boolean recentUidRemoved;
 
     public SelectedMailboxImpl(final MailboxManager mailboxManager, final List<Long> uids,
-            final MailboxSession mailboxSession, final String name) throws MailboxException {
+            final MailboxSession mailboxSession, final MailboxPath path) throws MailboxException {
         recentUids = new TreeSet<Long>();
         recentUidRemoved = false;
         final long sessionId = mailboxSession.getSessionId();
-        events = new MailboxEventAnalyser(sessionId, name);
+        events = new MailboxEventAnalyser(sessionId, path);
         // Ignore events from our session
         events.setSilentFlagChanges(true);
-        mailboxManager.addListener(name, events, mailboxSession);
+        mailboxManager.addListener(path, events, mailboxSession);
         converter = new UidToMsnConverter(uids);
-        mailboxManager.addListener(name, converter, mailboxSession);
+        mailboxManager.addListener(path, converter, mailboxSession);
     }
 
     /**
@@ -138,12 +139,11 @@
         return recentUids.size();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.james.imap.api.process.SelectedMailbox#getName()
+    /* (non-Javadoc)
+     * @see org.apache.james.imap.api.process.SelectedMailbox#getPath()
      */
-    public String getName() {
-        return events.getMailboxName();
+    public MailboxPath getPath() {
+        return events.getMailboxPath();
     }
 
     private void checkExpungedRecents() {
Index: processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/base/MailboxEventAnalyser.java	(Arbeitskopie)
@@ -27,13 +27,13 @@
 
 import javax.mail.Flags;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
 
 /**
  * {@link MailboxListener} implementation which will listen for {@link Event} notifications and 
- * analyze these. It will only act on {@link Event} notifications whiche are send for the registered
- * Mailbox name
- *
+ * analyze these. It will only act on {@link Event} notifications which are sent for the registered
+ * MailboxPath
  */
 public class MailboxEventAnalyser implements MailboxListener {
 
@@ -45,16 +45,16 @@
     private boolean isDeletedByOtherSession = false;
     private boolean sizeChanged = false;
     private boolean silentFlagChanges = false;
-    private String mailboxName;
+    private MailboxPath mailboxPath;
     private boolean closed = false;
 
-    public MailboxEventAnalyser(final long sessionId, final String mailboxName) {
+    public MailboxEventAnalyser(final long sessionId, final MailboxPath mailboxPath) {
         super();
         this.sessionId = sessionId;
         flagUpdateUids = new TreeSet<Long>();
         expungedUids = new TreeSet<Long>();
         uninterestingFlag = Flags.Flag.RECENT;
-        this.mailboxName = mailboxName;
+        this.mailboxPath = mailboxPath;
     }
     
     /**
@@ -62,8 +62,8 @@
      * 
      * @return name
      */
-    public String getMailboxName() {
-        return mailboxName;
+    public MailboxPath getMailboxPath() {
+        return mailboxPath;
     }
 
     /**
@@ -71,8 +71,8 @@
      * 
      * @param mailboxName
      */
-    public void setMailboxName(String mailboxName) {
-        this.mailboxName = mailboxName;
+    public void setMailboxPath(MailboxPath mailboxPath) {
+        this.mailboxPath = mailboxPath;
     }
 
     /**
@@ -82,35 +82,35 @@
      * @see org.apache.james.imap.mailbox.MailboxListener#event(org.apache.james.imap.mailbox.MailboxListener.Event)
      */
     public void event(Event event) {
-        
+
         // Check if the event was for the mailbox we are observing
-        if (event.getMailboxName().equals(mailboxName)) {
-        final long eventSessionId = event.getSessionId();
-        if (event instanceof MessageEvent) {
-            final MessageEvent messageEvent = (MessageEvent) event;
-            final long uid = messageEvent.getSubjectUid();
-            if (messageEvent instanceof Added) {
-                sizeChanged = true;
-            } else if (messageEvent instanceof FlagsUpdated) {
-                FlagsUpdated updated = (FlagsUpdated) messageEvent;
-                if (interestingFlags(updated)
-                        && (sessionId != eventSessionId || !silentFlagChanges)) {
+        if (event.getMailboxPath().equals(mailboxPath)) {
+            final long eventSessionId = event.getSessionId();
+            if (event instanceof MessageEvent) {
+                final MessageEvent messageEvent = (MessageEvent) event;
+                final long uid = messageEvent.getSubjectUid();
+                if (messageEvent instanceof Added) {
+                    sizeChanged = true;
+                } else if (messageEvent instanceof FlagsUpdated) {
+                    FlagsUpdated updated = (FlagsUpdated) messageEvent;
+                    if (interestingFlags(updated)
+                            && (sessionId != eventSessionId || !silentFlagChanges)) {
+                        final Long uidObject = new Long(uid);
+                        flagUpdateUids.add(uidObject);
+                    }
+                } else if (messageEvent instanceof Expunged) {
                     final Long uidObject = new Long(uid);
-                    flagUpdateUids.add(uidObject);
+                    expungedUids.add(uidObject);
                 }
-            } else if (messageEvent instanceof Expunged) {
-                final Long uidObject = new Long(uid);
-                expungedUids.add(uidObject);
+            } else if (event instanceof MailboxDeletionEvent) {
+                if (eventSessionId != sessionId) {
+                    isDeletedByOtherSession = true;
+                }
+            } else if (event instanceof MailboxRenamed) {
+                final MailboxRenamed mailboxRenamed = (MailboxRenamed) event;
+                setMailboxPath(mailboxRenamed.getNewPath());
             }
-        } else if (event instanceof MailboxDeletionEvent) {
-            if (eventSessionId != sessionId) {
-                isDeletedByOtherSession = true;
-            }
-        } else if (event instanceof MailboxRenamed) {
-            final MailboxRenamed mailboxRenamed = (MailboxRenamed) event;
-            setMailboxName(mailboxRenamed.getNewName());
         }
-        }
     }
 
     private boolean interestingFlags(FlagsUpdated updated) {
Index: processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/StatusProcessor.java	(Arbeitskopie)
@@ -22,6 +22,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.message.StatusDataItems;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -50,22 +51,19 @@
     protected void doProcess(ImapRequest message, ImapSession session,
             String tag, ImapCommand command, Responder responder) {
         final StatusRequest request = (StatusRequest) message;
-        final String mailboxName = request.getMailboxName();
+        final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
         final StatusDataItems statusDataItems = request.getStatusDataItems();
         final Log logger = session.getLog();
-        final MailboxSession mailboxSession = ImapSessionUtils
-                .getMailboxSession(session);
+        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
 
         try {
-            String fullMailboxName = buildFullName(session, mailboxName);
-
             if (logger != null && logger.isDebugEnabled()) {
-                logger.debug("Status called on mailbox named " + mailboxName
-                        + " (" + fullMailboxName + ")");
+                logger.debug("Status called on mailbox named " + mailboxPath
+                        + " (" + mailboxPath + ")");
             }
 
             final MailboxManager mailboxManager = getMailboxManager();
-            final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName, ImapSessionUtils.getMailboxSession(session));
+            final Mailbox mailbox = mailboxManager.getMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             final Mailbox.MetaData.FetchGroup fetchGroup;
             if (statusDataItems.isUnseen()) {
                 fetchGroup = Mailbox.MetaData.FetchGroup.UNSEEN_COUNT;
@@ -81,7 +79,7 @@
             final Long unseen = unseen(statusDataItems, metaData);
 
             final MailboxStatusResponse response = new MailboxStatusResponse(messages,
-                    recent, uidNext, uidValidity, unseen, mailboxName);
+                    recent, uidNext, uidValidity, unseen, request.getMailboxName());
             responder.respond(response);
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
Index: processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/RenameProcessor.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -48,23 +49,17 @@
     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();
+        final MailboxPath existingPath = buildFullPath(session, request.getExistingName());
+        final MailboxPath newPath = buildFullPath(session, request.getNewName());
         try {
-
-            final String fullExistingName = buildFullName(session, existingName);
-            final String fullNewName = buildFullName(session, newName);
             final MailboxManager mailboxManager = getMailboxManager();
-            mailboxManager.renameMailbox(fullExistingName, fullNewName, ImapSessionUtils.getMailboxSession(session));
+            mailboxManager.renameMailbox(existingPath, newPath, ImapSessionUtils.getMailboxSession(session));
             okComplete(command, tag, responder);
             unsolicitedResponses(session, responder, false);
-
         } catch (MailboxExistsException e) {
-            no(command, tag, responder,
-                    HumanReadableText.FAILURE_MAILBOX_EXISTS);
+            no(command, tag, responder, HumanReadableText.FAILURE_MAILBOX_EXISTS);
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder,
-                    HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
         } catch (MailboxException e) {
             no(command, tag, responder, e, session);
         }
Index: processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -66,16 +67,15 @@
             try {
                 final MailboxSession mailboxSession = mailboxManager.login(userid, passwd, session.getLog());
                 session.authenticated();
-                session.setAttribute(
-                        ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY,
-                        mailboxSession);
-                final String inboxName = buildFullName(session, INBOX);
-                if (mailboxManager.mailboxExists(inboxName, mailboxSession)) {
+                session.setAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY,
+                                        mailboxSession);
+                final MailboxPath inboxPath = buildFullPath(session, INBOX);
+                if (mailboxManager.mailboxExists(inboxPath, mailboxSession)) {
                     session.getLog().debug("INBOX exists. No need to create it.");
                 } else {
                     try {
                         session.getLog().debug("INBOX does not exist. Creating it.");
-                        mailboxManager.createMailbox(inboxName, mailboxSession);
+                        mailboxManager.createMailbox(inboxPath, mailboxSession);
                     } catch (MailboxExistsException e) {
                         session.getLog().debug("Mailbox created by concurrent call. Safe to ignore this exception.");
                     }
Index: processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java	(Arbeitskopie)
@@ -25,6 +25,7 @@
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -69,74 +70,86 @@
                 hasChildren, hasNoChildren, hierarchyDelimiter, mailboxName);
     }
 
-    protected final void doProcess(final String baseReferenceName,
-            final String mailboxPattern, final ImapSession session,
+    /**
+     * (from rfc3501)
+     * The LIST command returns a subset of names from the complete set
+     * of all names available to the client.  Zero or more untagged LIST
+     * replies are returned, containing the name attributes, hierarchy
+     * delimiter, and name; see the description of the LIST reply for
+     * more detail.
+     * ...
+     * An empty ("" string) mailbox name argument is a special request to
+     * return the hierarchy delimiter and the root name of the name given
+     * in the reference.  The value returned as the root MAY be the empty
+     * string if the reference is non-rooted or is an empty string.
+     * 
+     * @param referenceName
+     * @param mailboxName
+     * @param session
+     * @param tag
+     * @param command
+     * @param responder
+     */
+    protected final void doProcess(final String referenceName,
+            final String mailboxName, 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?
-            final boolean removeUserPrefix;
+            // Should the namespace section be returned or not?
+            final boolean isRelative;
 
             final List<MailboxMetaData> results;
 
             final String user = ImapSessionUtils.getUserName(session);
-            final String personalNamespace = MailboxConstants.USER_NAMESPACE
-                    + ImapConstants.HIERARCHY_DELIMITER_CHAR + user;
 
-            if (mailboxPattern.length() == 0) {
-                // An empty mailboxPattern signifies a request for the hierarchy
-                // delimiter
-                // and root name of the referenceName argument
+            if (mailboxName.length() == 0) {
+                // An empty mailboxName signifies a request for the hierarchy
+                // delimiter and root name of the referenceName argument
 
                 String referenceRoot;
                 if (referenceName.startsWith(ImapConstants.NAMESPACE_PREFIX)) {
-                    // A qualified reference name - get the first element,
-                    // and don't remove the user prefix
-                    removeUserPrefix = false;
-                    int firstDelimiter = referenceName
-                            .indexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
+                    // A qualified reference name - get the root element
+                    isRelative = false;
+                    int firstDelimiter = referenceName.indexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
                     if (firstDelimiter == -1) {
                         referenceRoot = referenceName;
-                    } else {
-                        referenceRoot = referenceName.substring(0,
-                                firstDelimiter);
                     }
-                } else {
-                    // A relative reference name - need to remove user prefix
-                    // from
-                    // results.
+                    else {
+                        referenceRoot = referenceName.substring(0, firstDelimiter);
+                    }
+                }
+                else {
+                    // A relative reference name, return "" to indicate it is non-rooted
                     referenceRoot = "";
-                    removeUserPrefix = true;
-
+                    isRelative = true;
                 }
-
                 // Get the mailbox for the reference name.
+                MailboxPath rootPath = new MailboxPath(referenceRoot, "", "");
                 results = new ArrayList<MailboxMetaData>(1);
-                results.add(SimpleMailboxMetaData.createNoSelect(referenceRoot,
-                        ImapConstants.HIERARCHY_DELIMITER));
-            } else {
-
-                // If the mailboxPattern is fully qualified, ignore the
-                // reference name.
-                if (mailboxPattern.charAt(0) == ImapConstants.NAMESPACE_PREFIX_CHAR) {
-                    referenceName = "";
+                results.add(SimpleMailboxMetaData.createNoSelect(rootPath, ImapConstants.HIERARCHY_DELIMITER));
+            }
+            else {
+                // If the mailboxPattern is fully qualified, ignore the reference name.
+                String finalReferencename = referenceName;
+                if (mailboxName.charAt(0) == ImapConstants.NAMESPACE_PREFIX_CHAR) {
+                    finalReferencename = "";
                 }
+                // Is the interpreted (combined) pattern relative?
+                isRelative = ((finalReferencename + mailboxName).charAt(0) != ImapConstants.NAMESPACE_PREFIX_CHAR);
 
-                // If the search pattern is relative, need to remove user prefix
-                // from results.
-                removeUserPrefix = ((referenceName + mailboxPattern).charAt(0) != ImapConstants.NAMESPACE_PREFIX_CHAR);
-
-                if (removeUserPrefix) {
-                    referenceName = personalNamespace + "." + referenceName;
+                MailboxPath basePath = null;
+                if (isRelative) {
+                    basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, finalReferencename);
                 }
+                else {
+                    basePath = buildFullPath(session, finalReferencename);
+                }
 
-                results = doList(session, referenceName, mailboxPattern);
+                results = getMailboxManager().search(new MailboxQuery(basePath, mailboxName, '*', '%'),
+                                                     ImapSessionUtils.getMailboxSession(session));
             }
 
-            final int prefixLength = personalNamespace.length();
-
             for (final MailboxMetaData metaData: results) {
-                processResult(responder, removeUserPrefix, prefixLength, metaData);
+                processResult(responder, isRelative, metaData);
             }
 
             okComplete(command, tag, responder);
@@ -145,12 +158,9 @@
         }
     }
 
-    void processResult(final Responder responder,
-            final boolean removeUserPrefix, int prefixLength,
-            final MailboxMetaData listResult) {
+    void processResult(final Responder responder, final boolean relative, final MailboxMetaData listResult) {
         final String delimiter = listResult.getHierarchyDelimiter();
-        final String mailboxName = mailboxName(removeUserPrefix, prefixLength,
-                listResult);
+        final String mailboxName = mailboxName(relative, listResult.getPath());
 
         final Children inferiors = listResult.inferiors();
         final boolean noInferior = MailboxMetaData.Children.NO_INFERIORS.equals(inferiors);
@@ -174,27 +184,4 @@
                 unmarked, hasChildren, hasNoChildren, delimiter, mailboxName));
     }
 
-    private String mailboxName(final boolean removeUserPrefix,
-            int prefixLength, final MailboxMetaData listResult) {
-        final String mailboxName;
-        final String name = listResult.getName();
-        if (removeUserPrefix) {
-            if (name.length() <= prefixLength) {
-                mailboxName = "";
-            } else {
-                mailboxName = name.substring(prefixLength + 1);
-            }
-        } else {
-            mailboxName = name;
-        }
-        return mailboxName;
-    }
-
-    protected final List<MailboxMetaData> doList(ImapSession session, String base,
-            String pattern) throws MailboxException {
-        final MailboxManager mailboxManager = getMailboxManager();
-        final List<MailboxMetaData> results = mailboxManager.search(new MailboxQuery(
-                base, pattern, '*', '%'), ImapSessionUtils.getMailboxSession(session));
-        return results;
-    }
 }
Index: processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java	(Arbeitskopie)
@@ -25,11 +25,13 @@
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
+import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxQuery;
@@ -60,10 +62,8 @@
         try {
             if (mailboxPattern.length() == 0) {
                 respondWithHierarchyDelimiter(responder);
-
             } else {
-                listSubscriptions(session, responder, referenceName,
-                        mailboxPattern);
+                listSubscriptions(session, responder, referenceName, mailboxPattern);
             }
 
             okComplete(command, tag, responder);
@@ -86,42 +86,51 @@
     }
 
     private void listSubscriptions(ImapSession session, Responder responder,
-            final String referenceName, final String mailboxPattern)
+            final String referenceName, final String mailboxName)
             throws SubscriptionException, MailboxException {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final MailboxManager manager = getMailboxManager();
         final Collection<String> mailboxes = manager.subscriptions(mailboxSession);
-        final MailboxQuery expression = new MailboxQuery(
-                referenceName, mailboxPattern, '*', '%');
+        // If the mailboxName is fully qualified, ignore the reference name.
+        String finalReferencename = referenceName;
+        if (mailboxName.charAt(0) == ImapConstants.NAMESPACE_PREFIX_CHAR) {
+            finalReferencename = "";
+        }
+        // Is the interpreted (combined) pattern relative?
+        boolean isRelative = ((finalReferencename + mailboxName).charAt(0) != ImapConstants.NAMESPACE_PREFIX_CHAR);
+        MailboxPath basePath = null;
+        if (isRelative) {
+            basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE,
+                    mailboxSession.getUser().getUserName(), finalReferencename);
+        }
+        else {
+            basePath = buildFullPath(session, finalReferencename);
+        }
+        
+        final MailboxQuery expression = new MailboxQuery(basePath, mailboxName, '*', '%');
         final Collection<String> mailboxResponses = new ArrayList<String>();
-        for (final String mailboxName: mailboxes) {
-            respond(responder, expression, mailboxName, true, mailboxes,
-                    mailboxResponses);
+        for (final String mailbox: mailboxes) {
+            respond(responder, expression, mailbox, true, mailboxes, mailboxResponses);
         }
     }
 
-    private void respond(Responder responder,
-            final MailboxQuery expression, final String mailboxName,
-            final boolean originalSubscription, final Collection<String> mailboxes,
-            final Collection<String> mailboxResponses) {
-        if (expression.isExpressionMatch(mailboxName,
-                ImapConstants.HIERARCHY_DELIMITER_CHAR)) {
+    private void respond(Responder responder, final MailboxQuery expression,
+            final String mailboxName, final boolean originalSubscription,
+            final Collection<String> mailboxes, final Collection<String> mailboxResponses) {
+        if (expression.isExpressionMatch(mailboxName)) {
             if (!mailboxResponses.contains(mailboxName)) {
                 final LSubResponse response = new LSubResponse(mailboxName,
-                        ImapConstants.HIERARCHY_DELIMITER,
-                        !originalSubscription);
+                        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);
                 }
             }
         }
Index: processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -46,19 +47,16 @@
     protected void doProcess(ImapRequest message, ImapSession session,
             String tag, ImapCommand command, Responder responder) {
         final DeleteRequest request = (DeleteRequest) message;
-        final String mailboxName = request.getMailboxName();
+        final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
         try {
-            final String fullMailboxName = buildFullName(session, mailboxName);
             final SelectedMailbox selected = session.getSelected();
-            if (selected != null && selected.getName().equals(fullMailboxName)) {
+            if (selected != null && selected.getPath().equals(mailboxPath)) {
                 session.deselect();
             }
             final MailboxManager mailboxManager = getMailboxManager();
-            mailboxManager.deleteMailbox(fullMailboxName, ImapSessionUtils
-                    .getMailboxSession(session));
+            mailboxManager.deleteMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
-
         } catch (MailboxException e) {
             no(command, tag, responder, e, session);
         }
Index: processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/CreateProcessor.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -45,12 +46,10 @@
     protected void doProcess(ImapRequest message, ImapSession session,
             String tag, ImapCommand command, Responder responder) {
         final CreateRequest request = (CreateRequest) message;
-        final String mailboxName = request.getMailboxName();
+        final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
         try {
-
-            final String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager();
-            mailboxManager.createMailbox(fullMailboxName, ImapSessionUtils.getMailboxSession(session));
+            mailboxManager.createMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);
         } catch (MailboxException e) {
Index: processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.request.ImapRequest;
@@ -51,19 +52,16 @@
     protected void doProcess(ImapRequest message, ImapSession session,
             String tag, ImapCommand command, Responder responder) {
         final CopyRequest request = (CopyRequest) message;
-        final String mailboxName = request.getMailboxName();
+        final MailboxPath targetMailbox = buildFullPath(session, request.getMailboxName());
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
         final SelectedMailbox currentMailbox = session.getSelected();
         try {
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-            final String fullMailboxName = buildFullName(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager();
-            final boolean mailboxExists = mailboxManager
-                    .mailboxExists(fullMailboxName, mailboxSession);
+            final boolean mailboxExists = mailboxManager.mailboxExists(targetMailbox, mailboxSession);
             if (!mailboxExists) {
-                no(command, tag, responder,
-                        HumanReadableText.FAILURE_NO_SUCH_MAILBOX,
+                no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX,
                         ResponseCode.tryCreate());
             } else {
                 for (int i = 0; i < idSet.length; i++) {
@@ -79,8 +77,9 @@
                                 (int) idSet[i].getLowVal());
                     }
                     MessageRange messageSet = MessageRange.range(lowVal, highVal);
-                    mailboxManager.copyMessages(messageSet, currentMailbox
-                            .getName(), fullMailboxName, mailboxSession);
+
+                    mailboxManager.copyMessages(messageSet, currentMailbox.getPath(),
+                                                targetMailbox, mailboxSession);
                 }
                 unsolicitedResponses(session, responder, useUids);
                 okComplete(command, tag, responder);
Index: processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/AppendProcessor.java	(Arbeitskopie)
@@ -28,6 +28,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse;
@@ -68,11 +69,11 @@
         final Flags flags = request.getFlags();
         try {
 
-            final String fullMailboxName = buildFullName(session, mailboxName);
+            final MailboxPath mailboxPath = buildFullPath(session, mailboxName);
             final MailboxManager mailboxManager = getMailboxManager();
-            final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName, ImapSessionUtils.getMailboxSession(session));
+            final Mailbox mailbox = mailboxManager.getMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             appendToMailbox(messageIn, datetime, flags, session, tag,
-                    command, mailbox, responder, fullMailboxName);
+                    command, mailbox, responder, mailboxPath);
         } catch (MailboxNotFoundException e) {
             // consume message on exception
             cosume(messageIn);
@@ -122,18 +123,16 @@
         no(command, tag, responder,
                 HumanReadableText.FAILURE_NO_SUCH_MAILBOX,
                 StatusResponse.ResponseCode.tryCreate());
-       
     }
 
     private void appendToMailbox(final InputStream message, final Date datetime,
             final Flags flagsToBeSet, final ImapSession session, final String tag,
-            final ImapCommand command, final Mailbox mailbox, Responder responder, final String fullMailboxName) {
+            final ImapCommand command, final Mailbox mailbox, Responder responder, final MailboxPath mailboxPath) {
         try {
-            final MailboxSession mailboxSession = ImapSessionUtils
-                    .getMailboxSession(session);
+            final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
             final SelectedMailbox selectedMailbox = session.getSelected();
             final boolean isSelectedMailbox = selectedMailbox != null
-                    && fullMailboxName.equals(selectedMailbox.getName());
+                    && selectedMailbox.getPath().equals(mailboxPath);
             final long uid  = mailbox.appendMessage(message, datetime, mailboxSession, 
                     !isSelectedMailbox, flagsToBeSet);
             if (isSelectedMailbox) {
@@ -152,4 +151,6 @@
             no(command, tag, responder, e, session);
         }
     }
+    
+    
 }
Index: processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java	(Arbeitskopie)
@@ -26,6 +26,7 @@
 import javax.mail.Flags;
 
 import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse;
@@ -79,8 +80,8 @@
         final AbstractMailboxSelectionRequest request = (AbstractMailboxSelectionRequest) message;
         final String mailboxName = request.getMailboxName();
         try {
-            final String fullMailboxName = buildFullName(session, mailboxName);
-            final Mailbox.MetaData metaData = selectMailbox(fullMailboxName, session);
+            final MailboxPath fullMailboxPath = buildFullPath(session, mailboxName);
+            final Mailbox.MetaData metaData = selectMailbox(fullMailboxPath, session);
             respond(tag, command, session, metaData, responder);
         } catch (MailboxNotFoundException e) {
             responder.respond(statusResponseFactory.taggedNo(tag, command,
@@ -172,18 +173,17 @@
         responder.respond(existsResponse);
     }
 
-    private Mailbox.MetaData  selectMailbox(String mailboxName, ImapSession session)
+    private Mailbox.MetaData  selectMailbox(MailboxPath mailboxPath, ImapSession session)
             throws MailboxException {
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final Mailbox mailbox = mailboxManager.getMailbox(mailboxName, mailboxSession);
+        final Mailbox mailbox = mailboxManager.getMailbox(mailboxPath, mailboxSession);
 
         final SelectedMailbox sessionMailbox;
         final SelectedMailbox currentMailbox = session.getSelected();
         if (currentMailbox == null
-                || !currentMailbox.getName().equals(mailboxName)) {
-            sessionMailbox = createNewSelectedMailbox(mailbox, mailboxSession,
-                    session, mailboxName);
+                || !currentMailbox.getPath().equals(mailboxPath)) {
+            sessionMailbox = createNewSelectedMailbox(mailbox, mailboxSession, session, mailboxPath);
         } else {
             sessionMailbox = currentMailbox;
         }
@@ -193,9 +193,8 @@
     }
 
     private SelectedMailbox createNewSelectedMailbox(final Mailbox mailbox,
-            final MailboxSession mailboxSession, ImapSession session, String name)
+            final MailboxSession mailboxSession, ImapSession session, MailboxPath path)
             throws MailboxException {
-        final SelectedMailbox sessionMailbox;
         final Iterator<MessageResult> it = mailbox.getMessages(MessageRange.all(),
                 FetchGroupImpl.MINIMAL, mailboxSession);
 
@@ -205,8 +204,8 @@
             uids.add(result.getUid());
         }
         
-        sessionMailbox = new SelectedMailboxImpl(getMailboxManager(), uids,
-                mailboxSession, name);
+        final SelectedMailbox sessionMailbox = new SelectedMailboxImpl(getMailboxManager(), uids,
+                                                                        mailboxSession, path);
         session.selected(sessionMailbox);
         return sessionMailbox;
     }
Index: processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
===================================================================
--- processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java	(Revision 961471)
+++ processor/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java	(Arbeitskopie)
@@ -18,8 +18,6 @@
  ****************************************************************/
 package org.apache.james.imap.processor;
 
-import static org.apache.james.imap.api.ImapConstants.NAMESPACE_PREFIX;
-
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -28,7 +26,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.james.imap.api.ImapCommand;
+import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
@@ -38,6 +38,7 @@
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.api.process.SelectedMailbox;
 import org.apache.james.imap.mailbox.Mailbox;
+import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxManager;
@@ -229,9 +230,8 @@
     }
 
     private Mailbox getMailbox(final ImapSession session, final SelectedMailbox selected) throws MailboxException {
-        final String fullMailboxName = buildFullName(session, selected.getName());
         final MailboxManager mailboxManager = getMailboxManager();
-        final Mailbox mailbox = mailboxManager.getMailbox(fullMailboxName, ImapSessionUtils.getMailboxSession(session));
+        final Mailbox mailbox = mailboxManager.getMailbox(selected.getPath(), ImapSessionUtils.getMailboxSession(session));
         return mailbox;
     }
 
@@ -311,14 +311,58 @@
             ImapSession session, String tag, ImapCommand command,
             Responder responder);
 
-    public String buildFullName(final ImapSession session, String mailboxName)
-            throws MailboxException {
+    public MailboxPath buildFullPath(final ImapSession session, String mailboxName) {
+        String namespace = null;
+        String name = null;
+        if (mailboxName.charAt(0) == ImapConstants.NAMESPACE_PREFIX_CHAR) {
+            int namespaceLength = mailboxName.indexOf(MailboxConstants.DEFAULT_DELIMITER);
+            if (namespaceLength > -1) {
+                namespace = mailboxName.substring(0, namespaceLength);
+                if (mailboxName.length() > namespaceLength)
+                    name = mailboxName.substring(++namespaceLength);
+            }
+            else {
+                namespace = mailboxName;
+            }
+        }
+        else {
+            namespace = MailboxConstants.USER_NAMESPACE;
+            name = mailboxName;
+        }
         final String user = ImapSessionUtils.getUserName(session);
-        if (!mailboxName.startsWith(NAMESPACE_PREFIX)) {
-            mailboxName = getMailboxManager().resolve(user, mailboxName);
+        return new MailboxPath(namespace, user, name);
+    }
+    
+    /**
+     * Joins the elements of a mailboxPath together and returns them as a string
+     * @param mailboxPath
+     * @return
+     */
+    public String joinMailboxPath(MailboxPath mailboxPath) {
+        StringBuffer sb = new StringBuffer("");
+        if (mailboxPath.getNamespace() != null && !mailboxPath.getNamespace().equals("")) {
+            sb.append(mailboxPath.getNamespace());
         }
-        return mailboxName;
+        if (mailboxPath.getUser() != null && !mailboxPath.getUser().equals("")) {
+            if (sb.length() > 0)
+                sb.append(MailboxConstants.DEFAULT_DELIMITER);
+            sb.append(mailboxPath.getUser());
+        }
+        if (mailboxPath.getName() != null && !mailboxPath.getName().equals("")) {
+            if (sb.length() > 0)
+                sb.append(MailboxConstants.DEFAULT_DELIMITER);
+            sb.append(mailboxPath.getName());
+        }
+        return sb.toString();
     }
+
+    public String mailboxName(final boolean relative, final MailboxPath path) {
+        if (relative) {
+            return path.getName();
+        } else {
+            return joinMailboxPath(path);
+        }
+    }
     
     public MailboxManager getMailboxManager() {
         return mailboxManager;
@@ -330,9 +374,8 @@
         if (selectedMailbox == null) {
             result = null;
         } else {
-            final String mailboxName = selectedMailbox.getName();
             final MailboxManager mailboxManager = getMailboxManager();
-            result = mailboxManager.getMailbox(mailboxName, ImapSessionUtils.getMailboxSession(session));
+            result = mailboxManager.getMailbox(selectedMailbox.getPath(), ImapSessionUtils.getMailboxSession(session));
         }
         return result;
     }
Index: message/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java
===================================================================
--- message/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java	(Revision 961471)
+++ message/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java	(Arbeitskopie)
@@ -37,10 +37,8 @@
         final List<String> attributes = getNameAttributes(response);
 
         final String name = response.getName();
-        final String hierarchyDelimiter = response.getHierarchyDelimiter();
 
-        composer.listResponse(responseTypeName, attributes, hierarchyDelimiter,
-                name);
+        composer.listResponse(responseTypeName, attributes, ImapConstants.HIERARCHY_DELIMITER, name);
     }
 
     private static List<String> getNameAttributes(final AbstractListingResponse response) {
Index: memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java
===================================================================
--- memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java	(Revision 961471)
+++ memory/src/main/java/org/apache/james/imap/inmemory/mail/model/InMemoryMailbox.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.store.mail.model.Mailbox;
 
 /**
@@ -28,16 +29,20 @@
  */
 public class InMemoryMailbox implements Mailbox<Long> {
 
-    private final long id;    
+    private final long id;
     private final long uidValidity;
     private final AtomicLong nextUid;
+    private String namespace;
+    private String user;
     private String name;
     
-    public InMemoryMailbox(final long id, final String name, final long uidValidity) {
+    public InMemoryMailbox(final long id, final MailboxPath path, final long uidValidity) {
         super();
         this.nextUid = new AtomicLong(0);
         this.id = id;
-        this.name = name;
+        this.namespace = path.getNamespace();
+        this.user = path.getUser();
+        this.name = path.getName();
         this.uidValidity = uidValidity;
     }
 
@@ -53,16 +58,31 @@
         return id;
     }
 
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    public String getUser() {
+        return user;
+    }
+
+    public void setuser(String user) {
+        this.user = user;
+    }
+
     public String getName() {
         return name;
     }
 
+    public void setName(String name) {
+        this.name = name;
+    }
 
     public long getUidValidity() {
         return uidValidity;
     }
-
-    public void setName(String name) {
-        this.name = name;
-    }
 }
Index: memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java
===================================================================
--- memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java	(Revision 961471)
+++ memory/src/main/java/org/apache/james/imap/inmemory/mail/InMemoryMailboxMapper.java	(Arbeitskopie)
@@ -23,6 +23,7 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.inmemory.mail.model.InMemoryMailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
@@ -75,16 +76,17 @@
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxByName(java.lang.String)
      */
-    public synchronized Mailbox<Long> findMailboxByName(String name) throws StorageException, MailboxNotFoundException {
+    public synchronized Mailbox<Long> findMailboxByPath(MailboxPath path) throws StorageException, MailboxNotFoundException {
         Mailbox<Long> result = null;
         for (final InMemoryMailbox mailbox:mailboxesById.values()) {
-            if (mailbox.getName().equals(name)) {
+            MailboxPath mp = new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), mailbox.getName());
+            if (mp.equals(path)) {
                 result = mailbox;
                 break;
             }
         }
         if (result == null) {
-            throw new MailboxNotFoundException(name);
+            throw new MailboxNotFoundException(path);
         } else {
             return result;
         }
@@ -94,8 +96,8 @@
      * (non-Javadoc)
      * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxWithNameLike(java.lang.String)
      */
-    public List<Mailbox<Long>> findMailboxWithNameLike(String name) throws StorageException {
-        final String regex = name.replace("%", ".*");
+    public List<Mailbox<Long>> findMailboxWithPathLike(MailboxPath path) throws StorageException {
+        final String regex = path.getName().replace("%", ".*");
         List<Mailbox<Long>> results = new ArrayList<Mailbox<Long>>();
         for (final InMemoryMailbox mailbox:mailboxesById.values()) {
             if (mailbox.getName().matches(regex)) {
Index: memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java
===================================================================
--- memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java	(Revision 961471)
+++ memory/src/main/java/org/apache/james/imap/inmemory/InMemoryMailboxManager.java	(Arbeitskopie)
@@ -19,6 +19,7 @@
 
 package org.apache.james.imap.inmemory;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.inmemory.mail.model.InMemoryMailbox;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxSession;
@@ -50,8 +51,8 @@
     }
 
     @Override
-    protected void doCreateMailbox(String namespaceName, MailboxSession session) throws StorageException {
-        InMemoryMailbox mailbox = new InMemoryMailbox(randomId(), namespaceName, randomUidValidity());
+    protected void doCreateMailbox(MailboxPath mailboxPath, MailboxSession session) throws StorageException {
+        InMemoryMailbox mailbox = new InMemoryMailbox(randomId(), mailboxPath, randomUidValidity());
         try {
             mailboxSessionMapperFactory.getMailboxMapper(session).save(mailbox);
         } catch (MailboxException e) {
Index: mailbox/src/test/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcherFlagsTest.java
===================================================================
--- mailbox/src/test/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcherFlagsTest.java	(Revision 961471)
+++ mailbox/src/test/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcherFlagsTest.java	(Arbeitskopie)
@@ -25,6 +25,7 @@
 
 import javax.mail.Flags;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
 import org.apache.james.imap.mailbox.MessageResult;
 import org.jmock.Expectations;
@@ -48,7 +49,7 @@
 
     private Mockery mockery = new JUnit4Mockery();
 
-    private String name = "test";
+    private MailboxPath path = new MailboxPath(null, null, "test");
     @Before
     public void setUp() throws Exception {
         dispatcher = new MailboxEventDispatcher();
@@ -63,7 +64,7 @@
    
     @Test
     public void testShouldReturnNoChangesWhenOriginalNull() throws Exception {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, null, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, null, new Flags(
                 Flags.Flag.DELETED));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -76,7 +77,7 @@
 
     @Test
     public void testShouldReturnNoChangesWhenSystemFlagsUnchanged() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId,name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.DELETED), new Flags(Flags.Flag.DELETED));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -89,7 +90,7 @@
 
     @Test
     public void testShouldShowAnsweredAdded() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(),
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(),
                 new Flags(Flags.Flag.ANSWERED));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -104,7 +105,7 @@
 
     @Test
     public void testShouldShowAnsweredRemoved() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.ANSWERED), new Flags());
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -119,7 +120,7 @@
 
     @Test
     public void testShouldShowDeletedAdded() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(),
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(),
                 new Flags(Flags.Flag.DELETED));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -134,7 +135,7 @@
 
     @Test
     public void testShouldShowDeletedRemoved() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.DELETED), new Flags());
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -149,7 +150,7 @@
 
     @Test
     public void testShouldShowDraftAdded() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(),
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(),
                 new Flags(Flags.Flag.DRAFT));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -164,7 +165,7 @@
 
     @Test
     public void testShouldShowDraftRemoved() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.DRAFT), new Flags());
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -179,7 +180,7 @@
 
     @Test
     public void testShouldShowFlaggedAdded() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(),
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(),
                 new Flags(Flags.Flag.FLAGGED));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -194,7 +195,7 @@
 
     @Test
     public void testShouldShowFlaggedRemoved() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.FLAGGED), new Flags());
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -209,7 +210,7 @@
 
     @Test
     public void testShouldShowRecentAdded() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(),
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(),
                 new Flags(Flags.Flag.RECENT));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -224,7 +225,7 @@
 
     @Test
     public void testShouldShowRecentRemoved() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.RECENT), new Flags());
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -239,7 +240,7 @@
 
     @Test
     public void testShouldShowSeenAdded() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(),
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(),
                 new Flags(Flags.Flag.SEEN));
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -254,7 +255,7 @@
 
     @Test
     public void testShouldShowSeenRemoved() {
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, new Flags(
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, new Flags(
                 Flags.Flag.SEEN), new Flags());
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
@@ -277,7 +278,7 @@
         updated.add(Flags.Flag.DRAFT);
         updated.add(Flags.Flag.SEEN);
 
-        dispatcher.flagsUpdated(result.getUid(), sessionId, name, originals, updated);
+        dispatcher.flagsUpdated(result.getUid(), sessionId, path, originals, updated);
         assertEquals(1, collector.events.size());
         assertTrue(collector.events.get(0) instanceof MailboxListener.FlagsUpdated);
         MailboxListener.FlagsUpdated event = (MailboxListener.FlagsUpdated) collector.events
Index: mailbox/src/test/java/org/apache/james/imap/mailbox/MailboxExpressionTest.java
===================================================================
--- mailbox/src/test/java/org/apache/james/imap/mailbox/MailboxExpressionTest.java	(Revision 961471)
+++ mailbox/src/test/java/org/apache/james/imap/mailbox/MailboxExpressionTest.java	(Arbeitskopie)
@@ -21,6 +21,7 @@
 
 import static org.junit.Assert.*;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.junit.Test;
 
 public class MailboxExpressionTest {
@@ -30,10 +31,11 @@
     private static final String SECOND_PART = "sub";
 
     private static final String BASE = "BASE";
+    private static final MailboxPath BASE_PATH = new MailboxPath(null, null, BASE);
 
 
     private MailboxQuery create(String expression) {
-        return new MailboxQuery(BASE, expression, '*', '%');
+        return new MailboxQuery(BASE_PATH, expression, '*', '%');
     }
 
     @Test
@@ -53,204 +55,178 @@
 
     @Test
     public void testCombinedNameEmptyPart() throws Exception {
-        MailboxQuery expression = new MailboxQuery(BASE, "", '*', '%');
-        assertEquals(BASE, expression.getCombinedName('.'));
-
+        MailboxQuery expression = new MailboxQuery(BASE_PATH, "", '*', '%');
+        assertEquals(BASE, expression.getCombinedName());
     }
 
     @Test
     public void testNullCombinedName() throws Exception {
-        MailboxQuery expression = new MailboxQuery(null, null, '*',
-                '%');
-        assertNotNull(expression.getCombinedName('.'));
-
+        MailboxQuery expression = new MailboxQuery(new MailboxPath(null, null, null), null, '*', '%');
+        assertNotNull(expression.getCombinedName());
     }
 
     @Test
     public void testSimpleCombinedName() throws Exception {
         MailboxQuery expression = create(PART);
-        assertEquals(BASE + "." + PART, expression.getCombinedName('.'));
-        assertEquals(BASE + "/" + PART, expression.getCombinedName('/'));
+        assertEquals(BASE + "." + PART, expression.getCombinedName());
     }
 
     @Test
     public void testCombinedNamePartStartsWithDelimiter() throws Exception {
         MailboxQuery expression = create("." + PART);
-        assertEquals(BASE + "." + PART, expression.getCombinedName('.'));
-        assertEquals(BASE + "/." + PART, expression.getCombinedName('/'));
+        assertEquals(BASE + "." + PART, expression.getCombinedName());
     }
 
     @Test
     public void testCombinedNameBaseEndsWithDelimiter() throws Exception {
-        MailboxQuery expression = new MailboxQuery(BASE + '.', PART,
-                '*', '%');
-        assertEquals(BASE + "." + PART, expression.getCombinedName('.'));
-        assertEquals(BASE + "./" + PART, expression.getCombinedName('/'));
+        MailboxQuery expression = new MailboxQuery(new MailboxPath(null, null, BASE + '.'), PART, '*', '%');
+        assertEquals(BASE + "." + PART, expression.getCombinedName());
     }
 
     @Test
     public void testCombinedNameBaseEndsWithDelimiterPartStarts()
             throws Exception {
-        MailboxQuery expression = new MailboxQuery(BASE + '.',
-                '.' + PART, '*', '%');
-        assertEquals(BASE + "." + PART, expression.getCombinedName('.'));
-        assertEquals(BASE + "./." + PART, expression.getCombinedName('/'));
+        MailboxQuery expression = new MailboxQuery(new MailboxPath(null, null, BASE + '.'), '.' + PART, '*', '%');
+        assertEquals(BASE + "." + PART, expression.getCombinedName());
     }
 
     @Test
     public void testSimpleExpression() throws Exception {
         MailboxQuery expression = create(PART);
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '/'));
-        assertFalse(expression.isExpressionMatch('.' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART + '.', '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertFalse(expression.isExpressionMatch('.' + PART));
+        assertFalse(expression.isExpressionMatch(PART + '.'));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
     }
 
     @Test
     public void testEmptyExpression() throws Exception {
         MailboxQuery expression = create("");
-        assertTrue(expression.isExpressionMatch("", '.'));
-        assertTrue(expression.isExpressionMatch("", '/'));
-        assertFalse(expression.isExpressionMatch("whatever", '.'));
-        assertFalse(expression.isExpressionMatch(BASE + '.' + "whatever", '.'));
-        assertFalse(expression.isExpressionMatch(BASE + "whatever", '.'));
+        assertTrue(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch("whatever"));
+        assertFalse(expression.isExpressionMatch(BASE + '.' + "whatever"));
+        assertFalse(expression.isExpressionMatch(BASE + "whatever"));
     }
 
     @Test
     public void testOnlyLocalWildcard() throws Exception {
         MailboxQuery expression = create("%");
-        assertTrue(expression.isExpressionMatch("", '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + SECOND_PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '/' + SECOND_PART, '.'));
+        assertTrue(expression.isExpressionMatch(""));
+        assertTrue(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(PART + SECOND_PART));
+        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART));
     }
 
     @Test
     public void testOnlyFreeWildcard() throws Exception {
         MailboxQuery expression = create("*");
-        assertTrue(expression.isExpressionMatch("", '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '/' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
+        assertTrue(expression.isExpressionMatch(""));
+        assertTrue(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(PART + SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART));
     }
 
     @Test
     public void testEndsWithLocalWildcard() throws Exception {
         MailboxQuery expression = create(PART + '%');
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + SECOND_PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '/' + SECOND_PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(PART + SECOND_PART));
+        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART));
+        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART));
     }
 
     @Test
     public void testStartsWithLocalWildcard() throws Exception {
         MailboxQuery expression = create('%' + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART + '.'
-                + SECOND_PART, '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART + '.' + SECOND_PART));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
     }
 
     @Test
     public void testContainsLocalWildcard() throws Exception {
         MailboxQuery expression = create(SECOND_PART + '%' + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '/' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART, '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r"
-                + PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(PART));
+        assertFalse(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
     }
 
     @Test
     public void testEndsWithFreeWildcard() throws Exception {
         MailboxQuery expression = create(PART + '*');
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '/' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(PART + SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART));
     }
 
     @Test
     public void testStartsWithFreeWildcard() throws Exception {
         MailboxQuery expression = create('*' + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
     }
 
     @Test
     public void testContainsFreeWildcard() throws Exception {
         MailboxQuery expression = create(SECOND_PART + '*' + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '/' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r"
-                + PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
     }
 
     @Test
     public void testDoubleFreeWildcard() throws Exception {
         MailboxQuery expression = create(SECOND_PART + "**" + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '/' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r"
-                + PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
     }
 
     @Test
     public void testFreeLocalWildcard() throws Exception {
         MailboxQuery expression = create(SECOND_PART + "*%" + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '/' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r"
-                + PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
     }
 
     @Test
     public void testLocalFreeWildcard() throws Exception {
         MailboxQuery expression = create(SECOND_PART + "%*" + PART);
-        assertFalse(expression.isExpressionMatch("", '.'));
-        assertFalse(expression.isExpressionMatch(SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + '/' + PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART, '.'));
-        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r"
-                + PART, '.'));
+        assertFalse(expression.isExpressionMatch(""));
+        assertFalse(expression.isExpressionMatch(SECOND_PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
+        assertFalse(expression.isExpressionMatch(PART));
+        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
     }
 
     @Test
@@ -258,26 +234,26 @@
         MailboxQuery expression = create(SECOND_PART + '*' + PART + '*'
                 + SECOND_PART + "**");
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART + '.'
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + "tosh.bosh"
-                + PART + "tosh.bosh" + SECOND_PART + "boshtosh", '.'));
+                + PART + "tosh.bosh" + SECOND_PART + "boshtosh"));
         assertFalse(expression.isExpressionMatch(SECOND_PART + '.'
-                + PART.substring(1) + '.' + SECOND_PART, '.'));
+                + PART.substring(1) + '.' + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + '.'
                 + PART.substring(1) + '.' + SECOND_PART + PART + '.'
-                + SECOND_PART + "toshbosh", '.'));
+                + SECOND_PART + "toshbosh"));
         assertFalse(expression.isExpressionMatch(SECOND_PART + '.'
                 + PART.substring(1) + '.' + SECOND_PART + PART + '.'
-                + SECOND_PART.substring(1), '.'));
+                + SECOND_PART.substring(1)));
         assertTrue(expression.isExpressionMatch(SECOND_PART + "tosh.bosh"
                 + PART + "tosh.bosh" + PART + SECOND_PART + "boshtosh" + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertFalse(expression.isExpressionMatch(SECOND_PART.substring(1)
                 + "tosh.bosh" + PART + "tosh.bosh" + SECOND_PART
                 + PART.substring(1) + SECOND_PART + "boshtosh" + PART
-                + SECOND_PART.substring(1), '.'));
+                + SECOND_PART.substring(1)));
     }
 
     @Test
@@ -285,15 +261,15 @@
         MailboxQuery expression = create(SECOND_PART + '%' + PART + '*'
                 + SECOND_PART);
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART + '.'
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART
-                + SECOND_PART + "Whatever", '.'));
+                + SECOND_PART + "Whatever"));
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART
-                + SECOND_PART + ".Whatever.", '.'));
+                + SECOND_PART + ".Whatever."));
     }
 
     @Test
@@ -301,28 +277,28 @@
         MailboxQuery expression = create(SECOND_PART + '*' + PART + '%'
                 + SECOND_PART);
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertFalse(expression.isExpressionMatch(SECOND_PART + PART + '.'
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + PART + "Whatever"
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertFalse(expression.isExpressionMatch(SECOND_PART + PART
-                + SECOND_PART + ".Whatever.", '.'));
+                + SECOND_PART + ".Whatever."));
         assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART
-                + SECOND_PART, '.'));
+                + SECOND_PART));
         assertFalse(expression.isExpressionMatch(SECOND_PART + '.' + PART
-                + SECOND_PART + '.' + SECOND_PART, '.'));
+                + SECOND_PART + '.' + SECOND_PART));
         assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART + '.'
-                + SECOND_PART + PART + SECOND_PART, '.'));
+                + SECOND_PART + PART + SECOND_PART));
     }
     
     @Test
     public void testTwoLocalWildcardsShouldMatchMailboxs() throws Exception {
         MailboxQuery expression = create("%.%");
-        assertFalse(expression.isExpressionMatch(PART, '.'));
-        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART + '.' + SECOND_PART, '.'));
-        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART, '.'));
+        assertFalse(expression.isExpressionMatch(PART));
+        assertFalse(expression.isExpressionMatch(PART + '.' + SECOND_PART + '.' + SECOND_PART));
+        assertTrue(expression.isExpressionMatch(PART + '.' + SECOND_PART));
     }
 }
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/util/SimpleMailboxMetaData.java	(Arbeitskopie)
@@ -19,16 +19,17 @@
 
 package org.apache.james.imap.mailbox.util;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxMetaData;
 import org.apache.james.imap.mailbox.StandardMailboxMetaDataComparator;
 
 public class SimpleMailboxMetaData implements MailboxMetaData, Comparable<MailboxMetaData> {
 
-    public static MailboxMetaData createNoSelect(String name, String delimiter) {
-        return new SimpleMailboxMetaData(name, delimiter, Children.CHILDREN_ALLOWED_BUT_UNKNOWN, Selectability.NOSELECT);
+    public static MailboxMetaData createNoSelect(MailboxPath path, String delimiter) {
+        return new SimpleMailboxMetaData(path, delimiter, Children.CHILDREN_ALLOWED_BUT_UNKNOWN, Selectability.NOSELECT);
     }
 
-    private final String name;
+    private final MailboxPath path;
 
     private final String delimiter;
 
@@ -36,14 +37,14 @@
 
     private final Selectability selectability;
 
-    public SimpleMailboxMetaData(String name, String delimiter) {
-        this(name, delimiter, Children.CHILDREN_ALLOWED_BUT_UNKNOWN, Selectability.NONE);
+    public SimpleMailboxMetaData(MailboxPath path, String delimiter) {
+        this(path, delimiter, Children.CHILDREN_ALLOWED_BUT_UNKNOWN, Selectability.NONE);
     }
 
-    public SimpleMailboxMetaData(final String name, final String delimiter,
+    public SimpleMailboxMetaData(final MailboxPath path, final String delimiter,
             final Children inferiors, final Selectability selectability) {
         super();
-        this.name = name;
+        this.path = path;
         this.delimiter = delimiter;
         this.inferiors = inferiors;
         this.selectability = selectability;
@@ -75,10 +76,10 @@
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.imap.mailbox.MailboxMetaData#getName()
+     * @see org.apache.james.imap.mailbox.MailboxMetaData#getPath()
      */
-    public String getName() {
-        return name;
+    public MailboxPath getPath() {
+        return path;
     }
 
     /*
@@ -86,7 +87,7 @@
      * @see java.lang.Object#toString()
      */
     public String toString() {
-        return "ListResult: " + name;
+        return "ListResult: " + path;
     }
 
     /**
@@ -95,7 +96,7 @@
     public int hashCode() {
         final int PRIME = 31;
         int result = 1;
-        result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+        result = PRIME * result + ((path == null) ? 0 : path.hashCode());
         return result;
     }
 
@@ -110,10 +111,10 @@
         if (getClass() != obj.getClass())
             return false;
         final SimpleMailboxMetaData other = (SimpleMailboxMetaData) obj;
-        if (name == null) {
-            if (other.name != null)
+        if (path == null) {
+            if (other.path != null)
                 return false;
-        } else if (!name.equals(other.name))
+        } else if (!path.equals(other.path))
             return false;
         return true;
     }
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java	(Arbeitskopie)
@@ -29,6 +29,7 @@
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.MailboxListener;
 
 public class MailboxEventDispatcher implements MailboxListener {
@@ -52,20 +53,20 @@
         listeners.add(mailboxListener);
     }
 
-    public void added(long uid, long sessionId, String name) {
+    public void added(long uid, long sessionId, MailboxPath path) {
         pruneClosed();
-        final AddedImpl added = new AddedImpl(sessionId, name, uid);
+        final AddedImpl added = new AddedImpl(sessionId, path, uid);
         event(added);
     }
 
-    public void expunged(final long uid, long sessionId, String name) {
-        final ExpungedImpl expunged = new ExpungedImpl(sessionId, name, uid);
+    public void expunged(final long uid, long sessionId, MailboxPath path) {
+        final ExpungedImpl expunged = new ExpungedImpl(sessionId, path, uid);
         event(expunged);
     }
 
-    public void flagsUpdated(final long uid, long sessionId, final String name,
+    public void flagsUpdated(final long uid, long sessionId, final MailboxPath path,
             final Flags original, final Flags updated) {
-        final FlagsUpdatedImpl flags = new FlagsUpdatedImpl(sessionId, name, uid,
+        final FlagsUpdatedImpl flags = new FlagsUpdatedImpl(sessionId, path, uid,
                 original, updated);
         event(flags);
     }
@@ -85,7 +86,7 @@
         return listeners.size();
     }
     
-    public void mailboxRenamed(String from, String to, long sessionId) {
+    public void mailboxRenamed(MailboxPath from, MailboxPath to, long sessionId) {
         event(new MailboxRenamedEventImpl(from, to, sessionId));
     }
 
@@ -93,8 +94,8 @@
 
         private final long subjectUid;
 
-        public AddedImpl(final long sessionId, final String name, final long subjectUid) {
-            super(sessionId, name);
+        public AddedImpl(final long sessionId, final MailboxPath path, final long subjectUid) {
+            super(sessionId, path);
             this.subjectUid = subjectUid;
         }
 
@@ -111,8 +112,8 @@
 
         private final long subjectUid;
 
-        public ExpungedImpl(final long sessionId, final String name, final long subjectUid) {
-            super(sessionId, name);
+        public ExpungedImpl(final long sessionId, final MailboxPath path, final long subjectUid) {
+            super(sessionId, path);
             this.subjectUid = subjectUid;
         }
 
@@ -142,9 +143,9 @@
 
         private final Flags newFlags;
 
-        public FlagsUpdatedImpl(final long sessionId, final String name, final long subjectUid,
+        public FlagsUpdatedImpl(final long sessionId, final MailboxPath path, final long subjectUid,
                 final Flags original, final Flags updated) {
-            this(sessionId, name, subjectUid, updated, isChanged(original, updated,
+            this(sessionId, path, subjectUid, updated, isChanged(original, updated,
                     Flags.Flag.ANSWERED), isChanged(original, updated,
                     Flags.Flag.DELETED), isChanged(original, updated,
                     Flags.Flag.DRAFT), isChanged(original, updated,
@@ -153,12 +154,12 @@
                     Flags.Flag.SEEN));
         }
 
-        public FlagsUpdatedImpl(final long sessionId, final String name, final long subjectUid,
+        public FlagsUpdatedImpl(final long sessionId, final MailboxPath path, final long subjectUid,
                 final Flags newFlags, boolean answeredUpdated,
                 boolean deletedUpdated, boolean draftUpdated,
                 boolean flaggedUpdated, boolean recentUpdated,
                 boolean seenUpdated) {
-            super(sessionId, name);
+            super(sessionId, path);
             this.subjectUid = subjectUid;
             this.modifiedFlags = new boolean[NUMBER_OF_SYSTEM_FLAGS];
             this.modifiedFlags[0] = answeredUpdated;
@@ -242,33 +243,33 @@
         }
     }
 
-    public void mailboxDeleted(long sessionId, String name) {
+    public void mailboxDeleted(long sessionId, MailboxPath path) {
         final MailboxDeletionEventImpl event = new MailboxDeletionEventImpl(
-                sessionId, name);
+                sessionId, path);
         event(event);
     }
 
     private static final class MailboxDeletionEventImpl extends
             MailboxListener.MailboxDeletionEvent {
-        public MailboxDeletionEventImpl(final long sessionId, String name) {
-            super(sessionId, name);
+        public MailboxDeletionEventImpl(final long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
     }
 
     private static final class MailboxRenamedEventImpl extends MailboxListener.MailboxRenamed {
-        private final String newName;
+        private final MailboxPath newPath;
 
-        public MailboxRenamedEventImpl(final String name, final String newName, final long sessionId) {
-            super(sessionId, name);
-            this.newName = newName;
+        public MailboxRenamedEventImpl(final MailboxPath path, final MailboxPath newPath, final long sessionId) {
+            super(sessionId, path);
+            this.newPath = newPath;
         }
 
         /*
          * (non-Javadoc)
          * @see org.apache.james.imap.mailbox.MailboxListener.MailboxRenamed#getNewName()
          */
-        public String getNewName() {
-            return newName;
+        public MailboxPath getNewPath() {
+            return newPath;
         }
     }
 
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/StandardMailboxMetaDataComparator.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/StandardMailboxMetaDataComparator.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/StandardMailboxMetaDataComparator.java	(Arbeitskopie)
@@ -33,9 +33,9 @@
      * @return {@link Comparator#compare(Object, Object)}
      */
     public static int order(MailboxMetaData one, MailboxMetaData two) {
-        final String nameTwo = two.getName();
+        final String nameTwo = two.getPath().getName();
         final int result;
-        final String nameOne = one.getName();
+        final String nameOne = one.getPath().getName();
         if (INBOX.equals(nameOne)) {
             result = INBOX.equals(nameTwo) ? 0 : -1;
         } else if (INBOX.equals(nameTwo)) {
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxQuery.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxQuery.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxQuery.java	(Arbeitskopie)
@@ -19,12 +19,14 @@
 
 package org.apache.james.imap.mailbox;
 
+import org.apache.james.imap.api.MailboxPath;
+
 /**
  * Expresses select criteria for mailboxes.
  */
 public class MailboxQuery {
 
-    private final String base;
+    private final MailboxPath base;
 
     private final String expression;
 
@@ -47,14 +49,12 @@
      *            matches any sequence of characters up to the next hierarchy
      *            delimiter
      */
-    public MailboxQuery(final String base, final String expression,
+    public MailboxQuery(final MailboxPath base, final String expression,
             final char freeWildcard, final char localWildcard) {
         super();
-        if (base == null) {
-            this.base = "";
-        } else {
-            this.base = base;
-        }
+        this.base = base;
+        if (base.getName() == null)
+            this.base.setName("");
         if (expression == null) {
             this.expression = "";
         } else {
@@ -66,11 +66,11 @@
     }
 
     /**
-     * Gets the base reference name for the search.
+     * Gets the base reference for the search.
      * 
      * @return the base
      */
-    public final String getBase() {
+    public final MailboxPath getBase() {
         return base;
     }
 
@@ -112,13 +112,13 @@
      *            mailbox hierarchy delimiter
      * @return true if the given name matches this expression, false otherwise
      */
-    public final boolean isExpressionMatch(String name, char hierarchyDelimiter) {
+    public final boolean isExpressionMatch(String name) {
         final boolean result;
         if (isWild()) {
             if (name == null) {
                 result = false;
             } else {
-                result = isWildcardMatch(name, 0, 0, hierarchyDelimiter);
+                result = isWildcardMatch(name, 0, 0);
             }
         } else {
             result = expression.equals(name);
@@ -127,23 +127,20 @@
     }
 
     private final boolean isWildcardMatch(final String name,
-            final int nameIndex, final int expressionIndex,
-            final char hierarchyDelimiter) {
+            final int nameIndex, final int expressionIndex) {
         final boolean result;
         if (expressionIndex < expressionLength) {
             final char expressionNext = expression.charAt(expressionIndex);
             if (expressionNext == freeWildcard) {
-                result = isFreeWildcardMatch(name, nameIndex, expressionIndex,
-                        hierarchyDelimiter);
+                result = isFreeWildcardMatch(name, nameIndex, expressionIndex);
             } else if (expressionNext == localWildcard) {
-                result = isLocalWildcardMatch(name, nameIndex, expressionIndex,
-                        hierarchyDelimiter);
+                result = isLocalWildcardMatch(name, nameIndex, expressionIndex);
             } else {
                 if (nameIndex < name.length()) {
                     final char nameNext = name.charAt(nameIndex);
                     if (nameNext == expressionNext) {
                         result = isWildcardMatch(name, nameIndex + 1,
-                                expressionIndex + 1, hierarchyDelimiter);
+                                expressionIndex + 1);
                     } else {
                         result = false;
                     }
@@ -161,26 +158,23 @@
     }
 
     private boolean isLocalWildcardMatch(final String name,
-            final int nameIndex, final int expressionIndex,
-            final char hierarchyDelimiter) {
+            final int nameIndex, final int expressionIndex) {
         final boolean result;
         if (expressionIndex < expressionLength) {
             final char expressionNext = expression.charAt(expressionIndex);
             if (expressionNext == localWildcard) {
                 result = isLocalWildcardMatch(name, nameIndex,
-                        expressionIndex + 1, hierarchyDelimiter);
+                        expressionIndex + 1);
             } else if (expressionNext == freeWildcard) {
-                result = isFreeWildcardMatch(name, nameIndex,
-                        expressionIndex + 1, hierarchyDelimiter);
+                result = isFreeWildcardMatch(name, nameIndex, expressionIndex + 1);
             } else {
                 boolean matchRest = false;
                 for (int i = nameIndex; i < name.length(); i++) {
                     final char tasteNextName = name.charAt(i);
                     if (expressionNext == tasteNextName) {
-                        matchRest = isLocalWildcardMatch(name, i + 1, expressionIndex + 1,
-                                hierarchyDelimiter);
+                        matchRest = isLocalWildcardMatch(name, i + 1, expressionIndex + 1);
                         break;
-                    } else if (tasteNextName == hierarchyDelimiter) {
+                    } else if (tasteNextName == MailboxConstants.DEFAULT_DELIMITER) {
                         matchRest = false;
                         break;
                     }
@@ -191,7 +185,7 @@
             boolean containsDelimiter = false;
             for (int i = nameIndex; i < name.length(); i++) {
                 final char nextRemaining = name.charAt(i);
-                if (nextRemaining == hierarchyDelimiter) {
+                if (nextRemaining == MailboxConstants.DEFAULT_DELIMITER) {
                     containsDelimiter = true;
                     break;
                 }
@@ -206,7 +200,7 @@
     }
 
     private boolean isFreeWildcardMatch(final String name, final int nameIndex,
-            final int expressionIndex, final char hierarchyDelimiter) {
+            final int expressionIndex) {
         final boolean result;
         int nextNormal = expressionIndex;
         while (nextNormal < expressionLength
@@ -219,7 +213,7 @@
             for (int i = nameIndex; i < name.length(); i++) {
                 final char tasteNextName = name.charAt(i);
                 if (expressionNextNormal == tasteNextName) {
-                    if (isWildcardMatch(name, i, nextNormal, hierarchyDelimiter)) {
+                    if (isWildcardMatch(name, i, nextNormal)) {
                         matchRest = true;
                         break;
                     }
@@ -234,39 +228,35 @@
     }
 
     /**
-     * Get combined name formed by adding expression to base using the given
+     * Get combined name formed by adding the expression to the base using the given
      * hierarchy delimiter. Note that the wildcards are retained in the combined
      * name.
      * 
-     * @param hierarchyDelimiter
-     *            delimiter for mailbox hierarchy
-     * @return {@link #getBase()} combined with {@link #getExpression()}, not
-     *         null
+     * @return {@link #getBase()} combined with {@link #getExpression()}, notnull
      */
-    public String getCombinedName(char hierarchyDelimiter) {
+    public String getCombinedName() {
         final String result;
-        final int baseLength = base.length();
-        if (base != null && baseLength > 0) {
-            final int lastChar = baseLength - 1;
-            if (base.charAt(lastChar) == hierarchyDelimiter) {
+        if (base != null && base.getName() != null && base.getName().length() > 0) {
+            final int baseLength = base.getName().length();
+            if (base.getName().charAt(baseLength - 1) == MailboxConstants.DEFAULT_DELIMITER) {
                 if (expression != null && expression.length() > 0) {
-                    if (expression.charAt(0) == hierarchyDelimiter) {
-                        result = base + expression.substring(1);
+                    if (expression.charAt(0) == MailboxConstants.DEFAULT_DELIMITER) {
+                        result = base.getName() + expression.substring(1);
                     } else {
-                        result = base + expression;
+                        result = base.getName() + expression;
                     }
                 } else {
-                    result = base;
+                    result = base.getName();
                 }
             } else {
                 if (expression != null && expression.length() > 0) {
-                    if (expression.charAt(0) == hierarchyDelimiter) {
-                        result = base + expression;
+                    if (expression.charAt(0) == MailboxConstants.DEFAULT_DELIMITER) {
+                        result = base.getName() + expression;
                     } else {
-                        result = base + hierarchyDelimiter + expression;
+                        result = base.getName() + MailboxConstants.DEFAULT_DELIMITER + expression;
                     }
                 } else {
-                    result = base;
+                    result = base.getName();
                 }
             }
         } else {
@@ -282,26 +272,21 @@
      */
     public boolean isWild() {
         return expression != null
-                && (expression.indexOf(freeWildcard) >= 0 || expression
-                        .indexOf(localWildcard) >= 0);
+                && (expression.indexOf(freeWildcard) >= 0
+                    || expression.indexOf(localWildcard) >= 0);
     }
 
     /**
-     * Renders a string sutable for logging.
+     * Renders a string suitable for logging.
      * 
      * @return a <code>String</code> representation of this object.
      */
     public String toString() {
         final String TAB = " ";
-
-        String retValue = "";
-
-        retValue = "MailboxExpression [ " + "base = " + this.base + TAB
+        return "MailboxExpression [ " + "base = " + this.base + TAB
                 + "expression = " + this.expression + TAB + "freeWildcard = "
                 + this.freeWildcard + TAB + "localWildcard = "
                 + this.localWildcard + TAB + " ]";
-
-        return retValue;
     }
 
 }
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxNotFoundException.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxNotFoundException.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxNotFoundException.java	(Arbeitskopie)
@@ -19,6 +19,7 @@
 
 package org.apache.james.imap.mailbox;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 
 /**
@@ -59,6 +60,16 @@
         this.mailboxName = mailboxName;
         this.id = 0;
     }
+    
+    /**
+     * @param mailboxPath
+     *            name of the mailbox, not null
+     */
+    public MailboxNotFoundException(MailboxPath mailboxPath) {
+        super(HumanReadableText.MAILBOX_NOT_FOUND, message(mailboxPath.toString()));
+        this.mailboxName = mailboxPath.toString();
+        this.id = 0;
+    }
 
     /**
      * Gets the name of the mailbox which cannot be found.
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java	(Arbeitskopie)
@@ -19,7 +19,9 @@
 
 package org.apache.james.imap.mailbox;
 
+import org.apache.james.imap.api.MailboxPath;
 
+
 /**
  * Returned by the list method of MailboxRepository and others
  */
@@ -70,7 +72,7 @@
     String getHierarchyDelimiter();
 
     /**
-     * @return full namespace-name
+     * @return full mailbox path
      */
-    String getName();
+    MailboxPath getPath();
 }
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java	(Arbeitskopie)
@@ -23,6 +23,7 @@
 import java.util.List;
 
 import org.apache.commons.logging.Log;
+import org.apache.james.imap.api.MailboxPath;
 
 
 /**
@@ -41,7 +42,7 @@
  * <p>
  * Internally MailboxManager deals with named repositories that could have
  * different implementations. E.g. JDBC connections to different hosts or
- * Maildir / Mbox like stores. This repositories are identified by its names and
+ * Maildir / Mbox like stores. These repositories are identified by their names and
  * maybe are configured in config.xml. The names of the mailboxes have to be
  * mapped to the corresponding repository name. For user mailboxes this could be
  * done by a "User.getRepositoryName()" property. It is imaginable that
@@ -66,21 +67,11 @@
      * @return delimiter
      */
     char getDelimiter();
-    
-    /**
-     * <p>
-     * Resolves a path for the given user.
-     * </p>
-     * TODO: Think about replacing this operation TODO: More elegant to pass in
-     * the username TODO: Or switch to URLs
-     */
-    String resolve(String userName, String mailboxPath);
 
     /**
      * Gets an session suitable for IMAP.
      * 
-     * @param mailboxName
-     *            the name of the mailbox, not null
+     * @param mailboxPath the Path of the mailbox, not null
      * @param session the context for this call, not null
      * @return <code>ImapMailboxSession</code>, not null
      * @throws MailboxException
@@ -88,35 +79,34 @@
      * @throws MailboxNotFoundException
      *             when the given mailbox does not exist
      */
-    Mailbox getMailbox(String mailboxName, MailboxSession session) throws MailboxException;
+    Mailbox getMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
 
     /**
      * Creates a new mailbox. Any intermediary mailboxes missing from the
      * hierarchy should be created.
      * 
-     * @param mailboxName
-     *            name, not null
+     * @param mailboxPath
      * @param mailboxSession the context for this call, not null
      * @throws MailboxException when creation fails
      */
-    void createMailbox(String mailboxName, MailboxSession mailboxSession) throws MailboxException;
+    void createMailbox(MailboxPath mailboxPath, MailboxSession mailboxSession) throws MailboxException;
 
     /**
      * Delete the mailbox with the name
      * 
-     * @param mailboxName
+     * @param mailboxPath
      * @param session
      * @throws MailboxException
      */
-    void deleteMailbox(String mailboxName, MailboxSession session) throws MailboxException;
+    void deleteMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
 
     /**
      * Renames a mailbox.
      * 
      * @param from
-     *            original name for the mailbox
+     *            original mailbox
      * @param to
-     *            new name for the mailbox
+     *            new mailbox
      * @param session the context for this call, not nul
      * @throws MailboxException otherwise
      * @throws MailboxExistsException
@@ -124,7 +114,7 @@
      * @throws MailboxNotFound
      *             when the <code>from</code> mailbox does not exist
      */
-    void renameMailbox(String from, String to, MailboxSession session) throws MailboxException;
+    void renameMailbox(MailboxPath from, MailboxPath to, MailboxSession session) throws MailboxException;
 
     /**
      * this is done by the MailboxRepository because maybe this operation could
@@ -139,8 +129,7 @@
      * @param session
      *            <code>MailboxSession</code>, not null
      */
-    void copyMessages(MessageRange set, String from, String to,
-            MailboxSession session) throws MailboxException;
+    void copyMessages(MessageRange set, MailboxPath from, MailboxPath to, MailboxSession session) throws MailboxException;
 
     /**
      * Searches for mailboxes matching the given query.
@@ -157,7 +146,7 @@
      * @return true when the mailbox exists and is accessible for the given user, false otherwise
      * @throws MailboxException
      */
-    boolean mailboxExists(String mailboxName, MailboxSession session) throws MailboxException;
+    boolean mailboxExists(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
 
     /**
      * Creates a new system session.
@@ -245,12 +234,12 @@
      * Listeners should return true from {@link MailboxListener#isClosed()}
      * when they are ready to be removed.
      * </p>
-     * @param mailboxName not null
+     * @param mailboxPath not null
      * @param listener not null
      * @param session not null
      * @throws MailboxException
      */
-    void addListener(String mailboxName, MailboxListener listener, MailboxSession session) throws MailboxException;
+    void addListener(MailboxPath mailboxPath, MailboxListener listener, MailboxSession session) throws MailboxException;
     
     /**
      * Start the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxListener.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxListener.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxListener.java	(Arbeitskopie)
@@ -23,6 +23,8 @@
 
 import javax.mail.Flags;
 
+import org.apache.james.imap.api.MailboxPath;
+
 /**
  * Listens to <code>Mailbox</code> events.
  * Note that listeners may be removed asynchronously.
@@ -49,12 +51,12 @@
     /**
      * A mailbox event.
      */
-    public abstract class Event {
+    public class Event {
         private final long sessionId;
-        private final String name;
-        public Event(final long sessionId, final String name) {
+        private final MailboxPath path;
+        public Event(final long sessionId, final MailboxPath path) {
             this.sessionId = sessionId;
-            this.name = name;
+            this.path = path;
         }
         
         /**
@@ -67,22 +69,22 @@
         }
         
         /**
-         * Return the name of the Mailbox this event belongs to. 
+         * Return the path of the Mailbox this event belongs to. 
          * 
-         * @return name
+         * @return path
          */
-        public String getMailboxName() {
-            return name;
+        public MailboxPath getMailboxPath() {
+            return path;
         }
     }
 
     /**
      * Indicates that mailbox has been deleted.
      */
-    public abstract class MailboxDeletionEvent extends Event {
+    public class MailboxDeletionEvent extends Event {
 
-        public MailboxDeletionEvent(long sessionId, String name) {
-            super(sessionId, name);
+        public MailboxDeletionEvent(long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
     }
     
@@ -91,15 +93,15 @@
      * Indicates that a mailbox has been renamed.
      */
     public abstract class MailboxRenamed extends Event {
-        public MailboxRenamed(long sessionId, String name) {
-            super(sessionId, name);
+        public MailboxRenamed(long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
         /**
          * Gets the new name for this mailbox.
          * 
          * @return name, not null
          */
-        public abstract String getNewName();
+        public abstract MailboxPath getNewPath();
     }
 
     /**
@@ -107,8 +109,8 @@
      */
     public abstract class MessageEvent extends Event {
 
-        public MessageEvent(long sessionId, String name) {
-            super(sessionId, name);
+        public MessageEvent(long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
 
         /**
@@ -121,8 +123,8 @@
 
     public abstract class Expunged extends MessageEvent {
 
-        public Expunged(long sessionId, String name) {
-            super(sessionId, name);
+        public Expunged(long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
     }
 
@@ -133,8 +135,8 @@
      */
     public abstract class FlagsUpdated extends MessageEvent {
 
-        public FlagsUpdated(long sessionId, String name) {
-            super(sessionId, name);
+        public FlagsUpdated(long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
 
         /**
@@ -157,8 +159,8 @@
      */
     public abstract class Added extends MessageEvent {
 
-        public Added(long sessionId, String name) {
-            super(sessionId, name);
+        public Added(long sessionId, MailboxPath path) {
+            super(sessionId, path);
         }
     }
 
Index: mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java
===================================================================
--- mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java	(Revision 961471)
+++ mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java	(Arbeitskopie)
@@ -35,4 +35,9 @@
      */
     public static final char DEFAULT_DELIMITER = '.';
 
+    /**
+     * The default delimiter used to seperated parent/child folders
+     */
+    public static final String DEFAULT_DELIMITER_STRING = ".";
+
 }
Index: jpa/src/main/java/org/apache/james/imap/jpa/mail/JPAMailboxMapper.java
===================================================================
--- jpa/src/main/java/org/apache/james/imap/jpa/mail/JPAMailboxMapper.java	(Revision 961471)
+++ jpa/src/main/java/org/apache/james/imap/jpa/mail/JPAMailboxMapper.java	(Arbeitskopie)
@@ -27,6 +27,7 @@
 import javax.persistence.PersistenceException;
 import javax.persistence.RollbackException;
 
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.jpa.JPATransactionalMapper;
 import org.apache.james.imap.jpa.mail.model.JPAMailbox;
@@ -84,9 +85,9 @@
     }
 
     /**
-     * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxByName(java.lang.String)
+     * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxByPath(java.lang.String)
      */
-    public Mailbox<Long> findMailboxByName(String name) throws StorageException, MailboxNotFoundException {
+    public Mailbox<Long> findMailboxByPath(MailboxPath mailboxPath) throws StorageException, MailboxNotFoundException {
         try {
             return (JPAMailbox) getEntityManager().createNamedQuery("findMailboxByName").setParameter("nameParam", name).getSingleResult();
         } catch (NoResultException e) {
@@ -110,10 +111,10 @@
     }
 
     /**
-     * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxWithNameLike(java.lang.String)
+     * @see org.apache.james.imap.store.mail.MailboxMapper#findMailboxWithPathLike(java.lang.String)
      */
     @SuppressWarnings("unchecked")
-    public List<Mailbox<Long>> findMailboxWithNameLike(String name) throws StorageException {
+    public List<Mailbox<Long>> findMailboxWithPathLike(String name) throws StorageException {
         try {
             return getEntityManager().createNamedQuery("findMailboxWithNameLike").setParameter("nameParam", SQL_WILDCARD_CHAR + name + SQL_WILDCARD_CHAR).getResultList();
         } catch (PersistenceException e) {
Index: jcr/src/main/java/org/apache/james/imap/jcr/mail/JCRMailboxMapper.java
===================================================================
--- jcr/src/main/java/org/apache/james/imap/jcr/mail/JCRMailboxMapper.java	(Revision 961471)
+++ jcr/src/main/java/org/apache/james/imap/jcr/mail/JCRMailboxMapper.java	(Arbeitskopie)
@@ -140,7 +140,7 @@
      * org.apache.james.imap.store.mail.MailboxMapper#findMailboxWithNameLike
      * (java.lang.String)
      */
-    public List<Mailbox<String>> findMailboxWithNameLike(String name) throws StorageException {
+    public List<Mailbox<String>> findMailboxWithPathLike(String name) throws StorageException {
         List<Mailbox<String>> mailboxList = new ArrayList<Mailbox<String>>();
         try {
             QueryManager manager = getSession().getWorkspace().getQueryManager();
Index: deployment/src/test/java/org/apache/james/imap/functional/AbstractStressTest.java
===================================================================
--- deployment/src/test/java/org/apache/james/imap/functional/AbstractStressTest.java	(Revision 961471)
+++ deployment/src/test/java/org/apache/james/imap/functional/AbstractStressTest.java	(Arbeitskopie)
@@ -28,6 +28,7 @@
 import javax.mail.Flags;
 
 import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.james.imap.api.MailboxPath;
 import org.apache.james.imap.mailbox.Mailbox;
 import org.apache.james.imap.mailbox.MailboxConstants;
 import org.apache.james.imap.mailbox.MailboxException;
@@ -50,7 +51,8 @@
         
         MailboxSession session = getMailboxManager().createSystemSession("test", new SimpleLog("Test"));
         getMailboxManager().startProcessingRequest(session);
-        getMailboxManager().createMailbox(MailboxConstants.USER_NAMESPACE +".username.INBOX", session);
+        final MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, "username", "INBOX");
+        getMailboxManager().createMailbox(path, session);
         getMailboxManager().endProcessingRequest(session);
         getMailboxManager().logout(session, false);
         final AtomicBoolean fail = new AtomicBoolean(false);
@@ -69,7 +71,7 @@
 
                     try {
                         getMailboxManager().startProcessingRequest(session);
-                        Mailbox m = getMailboxManager().getMailbox(MailboxConstants.USER_NAMESPACE +".username.INBOX", session);
+                        Mailbox m = getMailboxManager().getMailbox(path, session);
                         
                         System.out.println("Append message with uid=" + m.appendMessage(new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), session, false, new Flags()));
                         getMailboxManager().endProcessingRequest(session);
Index: api/src/main/java/org/apache/james/imap/api/process/SelectedMailbox.java
===================================================================
--- api/src/main/java/org/apache/james/imap/api/process/SelectedMailbox.java	(Revision 961471)
+++ api/src/main/java/org/apache/james/imap/api/process/SelectedMailbox.java	(Arbeitskopie)
@@ -21,7 +21,9 @@
 
 import java.util.Collection;
 
+import org.apache.james.imap.api.MailboxPath;
 
+
 /**
  * Interface which represent a selected Mailbox during the selected state
  *
@@ -78,11 +80,11 @@
     public int recentCount();
 
     /**
-     * Return the name of the selected Mailbox
+     * Return the path of the selected Mailbox
      * 
-     * @return mailboxName
+     * @return path
      */
-    public String getName();
+    public MailboxPath getPath();
 
     /**
      * Is the given uid recent ?
Index: api/src/main/java/org/apache/james/imap/api/MailboxPathHashMap.java
===================================================================
--- api/src/main/java/org/apache/james/imap/api/MailboxPathHashMap.java	(Revision 0)
+++ api/src/main/java/org/apache/james/imap/api/MailboxPathHashMap.java	(Revision 0)
@@ -0,0 +1,49 @@
+package org.apache.james.imap.api;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * This special map uses MailboxPath objects as keys.
+ *
+ * @param <T> The type of objects to store.
+ */
+public class MailboxPathHashMap<T> extends HashMap<MailboxPath, T> {
+
+    private static final long serialVersionUID = -7424356447437920137L;
+
+    @Override
+    public T get(Object object) {
+        if (!(object instanceof MailboxPath))
+            throw new IllegalArgumentException("Instance of type MailboxPath expected as key.");
+        MailboxPath path = (MailboxPath) object;
+        Iterator<MailboxPath> iteraror = this.keySet().iterator();
+        while (iteraror.hasNext()) {
+            MailboxPath iterPath = iteraror.next();
+            if (iterPath.equals(path))
+                return super.get(iterPath);
+        }
+        return null;
+    }
+    
+    @Override
+    public T put(MailboxPath mailboxPath, T object) {
+        MailboxPath previousKey = null;
+        T previousValue = null;
+        Iterator<MailboxPath> iteraror = this.keySet().iterator();
+        while (iteraror.hasNext()) {
+            MailboxPath iterPath = iteraror.next();
+            if (iterPath.equals(mailboxPath)) {
+                previousKey = iterPath;
+                previousValue = super.get(iterPath);
+                break;
+            }
+        }
+        if (previousKey == null)
+            super.put(mailboxPath, object);
+        else
+            super.put(previousKey, object);
+        return previousValue;
+    }
+    
+}
Index: api/src/main/java/org/apache/james/imap/api/MailboxPath.java
===================================================================
--- api/src/main/java/org/apache/james/imap/api/MailboxPath.java	(Revision 0)
+++ api/src/main/java/org/apache/james/imap/api/MailboxPath.java	(Revision 0)
@@ -0,0 +1,160 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.imap.api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The path to a mailbox.
+ */
+public class MailboxPath {
+
+    private String namespace;
+    private String user;
+    private String name;
+
+    public MailboxPath(String namespace, String user, String name) {
+        this.namespace = namespace;
+        this.user = user;
+        this.name = name;
+    }
+    
+    public MailboxPath(MailboxPath mailboxPath) {
+        this.namespace = mailboxPath.getNamespace();
+        this.user = mailboxPath.getUser();
+        this.name = mailboxPath.getName();
+    }
+    
+    public MailboxPath(MailboxPath mailboxPath, String name) {
+        this.namespace = mailboxPath.getNamespace();
+        this.user = mailboxPath.getUser();
+        this.name = name;
+    }
+    
+    /**
+     * Get the namespace this mailbox is in
+     * @return The namespace
+     */
+    public String getNamespace() {
+        return namespace;
+    }
+    
+    /**
+     * Set the namespace this mailbox is in
+     */
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+    
+    /**
+     * Get the name of the user who owns the mailbox.
+     * This can be null e.g. for shared mailboxes.
+     * @return The username
+     */
+    public String getUser() {
+        return user;
+    }
+    
+    /**
+     * Set the name of the user who owns the mailbox.
+     */
+    public void setUser(String user) {
+        this.user = user;
+    }
+    
+    /**
+     * Get the name of the mailbox. This is the pure name without
+     * user or namespace, so this is what a user would see in his client.
+     * @return The name string
+     */
+    public String getName() {
+        return name;
+    }
+    
+    /**
+     * Set the name of the mailbox. This is the pure name without
+     * user or namespace, so this is what a user would see in his client.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    /**
+     * Return a list of MailboxPath representing the hierarchy levels
+     * of this MailboxPath. E.g. INBOX.main.sub would yield
+     * INBOX
+     * INBOX.main
+     * INBOX.main.sub
+     * @param delimiter
+     * @return
+     */
+    public List<MailboxPath> getHierarchyLevels(char delimiter) {
+        ArrayList<MailboxPath> levels = new ArrayList<MailboxPath>();
+        int index = name.indexOf(delimiter);
+        while (index >= 0) {
+            final String levelname = name.substring(0, index);
+            levels.add(new MailboxPath(namespace, user, levelname));
+            index = name.indexOf(delimiter, ++index);
+        }
+        levels.add(this);
+        return levels;
+    }
+    
+    /* 
+     * (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return namespace + ":" + user + ":" + name;
+    }
+    
+    /* 
+     * (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object mailboxPath) {
+        if (!(mailboxPath instanceof MailboxPath))
+            return false;
+        MailboxPath mp = (MailboxPath) mailboxPath;
+        if (namespace == null) {
+            if (mp.getNamespace() != null)
+                return false;
+        }
+        else if (!namespace.equals(mp.getNamespace()))
+                return false;
+        if (user == null) {
+            if (mp.getUser() != null)
+                return false;
+        }
+        else if (!user.equals(mp.getUser()))
+                return false;
+        if (name == null) {
+            if (mp.getName() != null)
+                return false;
+        }
+        else if (!name.equals(mp.getName()))
+                return false;
+        return true;
+    }
+    
+}
