You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2006/10/10 10:35:02 UTC

svn commit: r454662 [11/15] - in /james/server/sandbox/imap-integration: ./ src/java/org/apache/james/imapserver/ src/java/org/apache/james/imapserver/commands/ src/java/org/apache/james/imapserver/debug/ src/java/org/apache/james/imapserver/store/ src...

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/AclManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/EffectiveRightsComputer.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/EffectiveRightsComputer.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/EffectiveRightsComputer.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/EffectiveRightsComputer.java Tue Oct 10 01:34:56 2006
@@ -15,18 +15,18 @@
 
 public interface EffectiveRightsComputer {
 
-	public void setUserAcl(UserAcl userAcl);
+    public void setUserAcl(UserAcl userAcl);
 
-	public void setGroupAcls(GroupAcl[] groupAcl);
+    public void setGroupAcls(GroupAcl[] groupAcl);
 
-	/**
-	 * used to filter the groups to retain only the ones the user is member of.<br 7>
-	 * TODO just a draft...
-	 * 
-	 * @param groups
-	 */
-	public void retainGroups(String[] groupMemberships);
+    /**
+     * used to filter the groups to retain only the ones the user is member of.<br 7>
+     * TODO just a draft...
+     * 
+     * @param groups
+     */
+    public void retainGroups(String[] groupMemberships);
 
-	public MailboxRights computeEffective();
+    public MailboxRights computeEffective();
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/EffectiveRightsComputer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAcl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAcl.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAcl.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAcl.java Tue Oct 10 01:34:56 2006
@@ -8,12 +8,12 @@
  */
 
 public interface GroupAcl extends Acl {
-	
-	/**
-	 * 
-	 * could be enviroment specific. e.g. a unix group or a ldap dn
-	 */
-	
-	public String getGroupName();
+    
+    /**
+     * 
+     * could be enviroment specific. e.g. a unix group or a ldap dn
+     */
+    
+    public String getGroupName();
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAcl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAwareUser.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAwareUser.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAwareUser.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAwareUser.java Tue Oct 10 01:34:56 2006
@@ -3,9 +3,9 @@
 import org.apache.james.services.User;
 
 public interface GroupAwareUser extends User {
-	/**
-	 * could be enviroment specific. e.g. a unix group or a ldap dn
-	 */
-	String[] getGroups();
+    /**
+     * could be enviroment specific. e.g. a unix group or a ldap dn
+     */
+    String[] getGroups();
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/GroupAwareUser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/MailboxRights.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/MailboxRights.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/MailboxRights.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/MailboxRights.java Tue Oct 10 01:34:56 2006
@@ -10,57 +10,57 @@
 
 public class MailboxRights {
 
-	public MailboxRights() {
+    public MailboxRights() {
 
-	}
+    }
 
-	public void add(Right right) {
-		;
-	}
+    public void add(Right right) {
+        ;
+    }
 
-	/**
-	 * returns a string representation like defined in RFC 2086. Rights not
-	 * supported by RFC 2086 will be omitted.
-	 * 
-	 */
-	public String toImapString() {
-		return null;
+    /**
+     * returns a string representation like defined in RFC 2086. Rights not
+     * supported by RFC 2086 will be omitted.
+     * 
+     */
+    public String toImapString() {
+        return null;
 
-	}
+    }
 
 
-	
-	public void remove(Right right) {
-		;
-	}
+    
+    public void remove(Right right) {
+        ;
+    }
 
-	public boolean contains(Right right) {
-		return false;
-	}
+    public boolean contains(Right right) {
+        return false;
+    }
 /**
  * 
  * draft an incomplete. Idea is to internally use String representives. The list of possible rights
  * could increase a lot. That would make it impossible to find an appropriate char.
  *
  */
-	public static final class Right {
+    public static final class Right {
 
-		private static HashMap allRights = new HashMap();
+        private static HashMap allRights = new HashMap();
 
-		public static final Right WRITE = getInstance("w");
+        public static final Right WRITE = getInstance("w");
 
-		private Right(String representative) {
+        private Right(String representative) {
 
-		}
+        }
 
-		private synchronized static final Right getInstance(String s) {
-			Right right = (Right) allRights.get(s);
-			if (right == null) {
-				right = new Right(s);
-			}
-			return right;
-		}
+        private synchronized static final Right getInstance(String s) {
+            Right right = (Right) allRights.get(s);
+            if (right == null) {
+                right = new Right(s);
+            }
+            return right;
+        }
 
-	}
+    }
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/MailboxRights.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/UserAcl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/UserAcl.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/UserAcl.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/UserAcl.java Tue Oct 10 01:34:56 2006
@@ -2,7 +2,7 @@
 
 
 public interface UserAcl extends Acl {
-	
-	public String getUserName();
+    
+    public String getUserName();
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/acl/UserAcl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/GeneralMessageSetImpl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/GeneralMessageSetImpl.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/GeneralMessageSetImpl.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/GeneralMessageSetImpl.java Tue Oct 10 01:34:56 2006
@@ -117,19 +117,19 @@
 
     }
 
-	public static GeneralMessageSet msnRange(int from, int to) {
+    public static GeneralMessageSet msnRange(int from, int to) {
         GeneralMessageSetImpl gms = new GeneralMessageSetImpl();
         gms.type = TYPE_MSN;
         gms.msnFrom = from;
         gms.msnTo = to;
         return gms;
-	}
+    }
 
-	public static GeneralMessageSet oneMsn(int msn) {
+    public static GeneralMessageSet oneMsn(int msn) {
         GeneralMessageSetImpl gms = new GeneralMessageSetImpl();
         gms.type = TYPE_MSN;
         gms.msnFrom = msn;
         gms.msnTo = msn;
         return gms;
-	}
+    }
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/GeneralMessageSetImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/ListResultImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java Tue Oct 10 01:34:56 2006
@@ -21,35 +21,35 @@
 
     public void added(MessageResult result) {
         for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-			MailboxListener mailboxListener = (MailboxListener) iter.next();
-			mailboxListener.added(result);
-		}
+            MailboxListener mailboxListener = (MailboxListener) iter.next();
+            mailboxListener.added(result);
+        }
     }
 
     public void expunged(MessageResult mr) {
         for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-			MailboxListener mailboxListener = (MailboxListener) iter.next();
+            MailboxListener mailboxListener = (MailboxListener) iter.next();
             mailboxListener.expunged(mr);
         }
     }
 
     public void flagsUpdated(MessageResult result, MailboxListener silentListener) {
         for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-			MailboxListener mailboxListener = (MailboxListener) iter.next();
+            MailboxListener mailboxListener = (MailboxListener) iter.next();
             mailboxListener.flagsUpdated(result, silentListener);
         }
     }
 
     public void mailboxDeleted() {
         for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-			MailboxListener mailboxListener = (MailboxListener) iter.next();
+            MailboxListener mailboxListener = (MailboxListener) iter.next();
             mailboxListener.mailboxDeleted();
         }
     }
 
     public void mailboxRenamed(String origName, String newName) {
         for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-			MailboxListener mailboxListener = (MailboxListener) iter.next();
+            MailboxListener mailboxListener = (MailboxListener) iter.next();
             mailboxListener.mailboxRenamed(origName,origName);
         }
     }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxEventDispatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MailboxListenerCollector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/MessageResultImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespaceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespacesImpl.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespacesImpl.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespacesImpl.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespacesImpl.java Tue Oct 10 01:34:56 2006
@@ -4,47 +4,47 @@
 import org.apache.james.mailboxmanager.Namespaces;
 
 public class NamespacesImpl implements Namespaces {
-	
-	private Namespace[] personal;
-	
-	private Namespace[] shared;
-	
-	private Namespace[] user;
-	
-	private Namespace personalDefault;
-	
-	public Namespace[] getPersonal() {
-		return personal;
-	}
-
-	public Namespace getPersonalDefault() {
-		return personalDefault;
-	}
-
-	public Namespace[] getShared() {
-		return shared;
-	}
-
-	public Namespace[] getUser() {
-		return user;
-	}
-
-	public void setPersonal(Namespace[] personal) {
-		this.personal = personal;
-	}
-
-	public void setPersonalDefault(Namespace personalDefault) {
-		this.personalDefault = personalDefault;
-	}
-
-	public void setShared(Namespace[] shared) {
-		this.shared = shared;
-	}
-
-	public void setUser(Namespace[] user) {
-		this.user = user;
-	}
-	
-	
+    
+    private Namespace[] personal;
+    
+    private Namespace[] shared;
+    
+    private Namespace[] user;
+    
+    private Namespace personalDefault;
+    
+    public Namespace[] getPersonal() {
+        return personal;
+    }
+
+    public Namespace getPersonalDefault() {
+        return personalDefault;
+    }
+
+    public Namespace[] getShared() {
+        return shared;
+    }
+
+    public Namespace[] getUser() {
+        return user;
+    }
+
+    public void setPersonal(Namespace[] personal) {
+        this.personal = personal;
+    }
+
+    public void setPersonalDefault(Namespace personalDefault) {
+        this.personalDefault = personalDefault;
+    }
+
+    public void setShared(Namespace[] shared) {
+        this.shared = shared;
+    }
+
+    public void setUser(Namespace[] user) {
+        this.user = user;
+    }
+    
+    
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/impl/NamespacesImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java Tue Oct 10 01:34:56 2006
@@ -7,22 +7,22 @@
 
 public interface BasicMailbox {
 
-	/** @return the key */
-	String store(MimeMessage message) throws MessagingException;
+    /** @return the key */
+    String store(MimeMessage message) throws MessagingException;
 
-	/** @return keys */
-	Collection list() throws MessagingException;
+    /** @return keys */
+    Collection list() throws MessagingException;
 
-	MimeMessage retrieve(String key);
+    MimeMessage retrieve(String key);
 
-	/**
-	 * key changes by updating
-	 *  
-	 * @param key the current key
-	 * @return the new key
-	 */
-	String update(String key, MimeMessage message)
-			throws MessagingException;
+    /**
+     * key changes by updating
+     *  
+     * @param key the current key
+     * @return the new key
+     */
+    String update(String key, MimeMessage message)
+            throws MessagingException;
 
-	void remove(String key);
+    void remove(String key);
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/BasicMailboxSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventQueueingSessionMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventQueueingSessionMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventQueueingSessionMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventQueueingSessionMailbox.java Tue Oct 10 01:34:56 2006
@@ -6,9 +6,9 @@
 import org.apache.james.mailboxmanager.MessageResult;
 
 public interface EventQueueingSessionMailbox {
-	
-	MessageResult[] getFlagEvents(boolean reset) throws MailboxManagerException;
-	
+    
+    MessageResult[] getFlagEvents(boolean reset) throws MailboxManagerException;
+    
     MessageResult[] getExpungedEvents(boolean reset) throws MailboxManagerException;
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventQueueingSessionMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventTriggerMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventTriggerMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventTriggerMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventTriggerMailbox.java Tue Oct 10 01:34:56 2006
@@ -15,18 +15,18 @@
  */
 public interface EventTriggerMailbox {
 
-	/**
-	 * Implementations of Mailbox may interpret the fact that someone is
-	 * listening and do some caching and even postpone persistence until
-	 * everyone has removed itself.
-	 * 
-	 * @param listener
-	 * @param result
-	 *            which fields to be returned in MessageResult
-	 * @throws MailboxManagerException 
-	 */
-	void addListener(MailboxListener listener, int result) throws MailboxManagerException;
+    /**
+     * Implementations of Mailbox may interpret the fact that someone is
+     * listening and do some caching and even postpone persistence until
+     * everyone has removed itself.
+     * 
+     * @param listener
+     * @param result
+     *            which fields to be returned in MessageResult
+     * @throws MailboxManagerException 
+     */
+    void addListener(MailboxListener listener, int result) throws MailboxManagerException;
 
-	void removeListener(MailboxListener listener);
+    void removeListener(MailboxListener listener);
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/EventTriggerMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java Tue Oct 10 01:34:56 2006
@@ -8,62 +8,62 @@
 import org.apache.james.mailboxmanager.MessageResult;
 
 public interface FlaggedMailbox extends GeneralMailbox {
-	
-	/**
-	 * @return Flags that can be stored
-	 */
+    
+    /**
+     * @return Flags that can be stored
+     */
 
-	Flags getPermanentFlags();
-	
+    Flags getPermanentFlags();
+    
 
-	int getRecentCount(boolean reset) throws MailboxManagerException;
-	
-	int getUnseenCount() throws MailboxManagerException;
+    int getRecentCount(boolean reset) throws MailboxManagerException;
+    
+    int getUnseenCount() throws MailboxManagerException;
     
     MessageResult getFirstUnseen(int result) throws MailboxManagerException;
-	
-	/**
-	 * 
-	 * @param set
-	 *            <ul>
-	 *            <li> IMAP, Javamail: not required, always expunge all</li>
-	 *            <li> UIDPLUS: requires the possibility of defining a uid range</li>
-	 *            </ul>
-	 * 
-	 * @param result
-	 *            which fields to be returned in MessageResult
-	 * @return MessageResult with the fields defined by <b>result</b><br />
-	 *         <ul>
-	 *         <li> IMAP, UIDPLUS: nothing required </li>
-	 *         <li> Javamail Folder: requires the expunged Message[]</li>
-	 *         </ul>
-	 * @throws MailboxManagerException
-	 *             if anything went wrong
-	 */
-	MessageResult[] expunge(GeneralMessageSet set, int result)
-			throws MailboxManagerException;
-	
+    
+    /**
+     * 
+     * @param set
+     *            <ul>
+     *            <li> IMAP, Javamail: not required, always expunge all</li>
+     *            <li> UIDPLUS: requires the possibility of defining a uid range</li>
+     *            </ul>
+     * 
+     * @param result
+     *            which fields to be returned in MessageResult
+     * @return MessageResult with the fields defined by <b>result</b><br />
+     *         <ul>
+     *         <li> IMAP, UIDPLUS: nothing required </li>
+     *         <li> Javamail Folder: requires the expunged Message[]</li>
+     *         </ul>
+     * @throws MailboxManagerException
+     *             if anything went wrong
+     */
+    MessageResult[] expunge(GeneralMessageSet set, int result)
+            throws MailboxManagerException;
+    
 
-	/**
-	 * this is much more straight forward for IMAP instead of setting Flags of
-	 * an array of lazy-loading MimeMessages. <br />
-	 * required by IMAP
-	 * 
-	 * @param flags
-	 *            Flags to be set
-	 * @param value
-	 *            true = set, false = unset
-	 * @param replace
-	 *            replace all Flags with this flags, value has to be true
-	 * @param set
-	 *            the range of messages
-	 * @param silentListener
-	 *            IMAP requires the ability of setting Flags without getting an
-	 *            acknowledge TODO this may be handled only inside of a session
-	 * @throws MailboxManagerException
-	 */
+    /**
+     * this is much more straight forward for IMAP instead of setting Flags of
+     * an array of lazy-loading MimeMessages. <br />
+     * required by IMAP
+     * 
+     * @param flags
+     *            Flags to be set
+     * @param value
+     *            true = set, false = unset
+     * @param replace
+     *            replace all Flags with this flags, value has to be true
+     * @param set
+     *            the range of messages
+     * @param silentListener
+     *            IMAP requires the ability of setting Flags without getting an
+     *            acknowledge TODO this may be handled only inside of a session
+     * @throws MailboxManagerException
+     */
 
-	void setFlags(Flags flags, boolean value, boolean replace, GeneralMessageSet set,
-			MailboxListener silentListener) throws MailboxManagerException;
+    void setFlags(Flags flags, boolean value, boolean replace, GeneralMessageSet set,
+            MailboxListener silentListener) throws MailboxManagerException;
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/FlaggedMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java Tue Oct 10 01:34:56 2006
@@ -9,77 +9,77 @@
 import org.apache.james.mailboxmanager.MessageResult;
 
 public interface GeneralMailbox {
-	
-	/**
-	 * 
-	 * What the Mailbox is able to put out as an result. e.g.: message number, uid, key, MimeMessage, Size, internal Date, flags
-	 * @see MessageResult
-	 */
-	int getMessageResultTypes();
-	
-	/**
-	 * 
-	 * which queries could be made to select a set of messages, e.g.: range of uid or message numbers, a key, a MimeMessage object
-	 * @see GeneralMessageSet
-	 */
-	int getMessageSetTypes();
-	
-	/**
-	 * Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)
-	 * 
-	 * @return Full folder name with namespace
-	 * @throws MailboxManagerException 
-	 */
+    
+    /**
+     * 
+     * What the Mailbox is able to put out as an result. e.g.: message number, uid, key, MimeMessage, Size, internal Date, flags
+     * @see MessageResult
+     */
+    int getMessageResultTypes();
+    
+    /**
+     * 
+     * which queries could be made to select a set of messages, e.g.: range of uid or message numbers, a key, a MimeMessage object
+     * @see GeneralMessageSet
+     */
+    int getMessageSetTypes();
+    
+    /**
+     * Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)
+     * 
+     * @return Full folder name with namespace
+     * @throws MailboxManagerException 
+     */
 
-	String getName() throws MailboxManagerException;
+    String getName() throws MailboxManagerException;
 
-	int getMessageCount() throws MailboxManagerException;
-	
+    int getMessageCount() throws MailboxManagerException;
+    
 
-	/**
-	 * @param internalDate
-	 *            <p>IMAP defines this as the time when the message has arrived to
-	 *            this server (by smtp). Clients are also allowed to set the
-	 *            internalDate on apppend.</p><p>Is this Mail.getLastUpdates() for 
-	 *            James delivery? Should we use MimeMessage.getReceivedDate()?
-	 * @param result
-	 *            which fields to be returned in MessageResult
-	 * @return MessageResult with the fields defined by <b>result</b>
-	 *         <ul>
-	 *         <li> IMAP, Javamail Folder: nothing required </li>
-	 *         <li> UIDPlusFolder: requires to return appended Message or uid</li>
-	 *         <li> UIDPLUS: requires to return appended uid</li>
-	 *         </ul>
-	 * @throws MailboxManagerException
-	 *             if anything went wrong
-	 */
-	MessageResult appendMessage(MimeMessage message, Date internalDate,
-			int result) throws MailboxManagerException;
-	
-	/**
-	 * 
-	 * @param messageSet TODO
-	 * @param message has to belong to this mailbox and either come as the result from an appendMessage or
-	 * getMessages operation
-	 * @param result uid and msn will change TODO should key change, too?
-	 * @return
-	 */
-	
-	MessageResult updateMessage(GeneralMessageSet messageSet, MimeMessage message, int result) throws MailboxManagerException;
-	
-	/**
-	 * 
-	 * @param set
-	 * @return MessageResult with the fields defined by <b>result</b>
-	 *         <ul>
-	 *         <li> IMAP: a set of msn, uid, Flags, header lines, content, mime
-	 *         parts...</li>
-	 *         <li> Javamail Folder: Message[]</li>
-	 *         </ul>
-	 * @throws MailboxManagerException 
-	 */
+    /**
+     * @param internalDate
+     *            <p>IMAP defines this as the time when the message has arrived to
+     *            this server (by smtp). Clients are also allowed to set the
+     *            internalDate on apppend.</p><p>Is this Mail.getLastUpdates() for 
+     *            James delivery? Should we use MimeMessage.getReceivedDate()?
+     * @param result
+     *            which fields to be returned in MessageResult
+     * @return MessageResult with the fields defined by <b>result</b>
+     *         <ul>
+     *         <li> IMAP, Javamail Folder: nothing required </li>
+     *         <li> UIDPlusFolder: requires to return appended Message or uid</li>
+     *         <li> UIDPLUS: requires to return appended uid</li>
+     *         </ul>
+     * @throws MailboxManagerException
+     *             if anything went wrong
+     */
+    MessageResult appendMessage(MimeMessage message, Date internalDate,
+            int result) throws MailboxManagerException;
+    
+    /**
+     * 
+     * @param messageSet TODO
+     * @param message has to belong to this mailbox and either come as the result from an appendMessage or
+     * getMessages operation
+     * @param result uid and msn will change TODO should key change, too?
+     * @return
+     */
+    
+    MessageResult updateMessage(GeneralMessageSet messageSet, MimeMessage message, int result) throws MailboxManagerException;
+    
+    /**
+     * 
+     * @param set
+     * @return MessageResult with the fields defined by <b>result</b>
+     *         <ul>
+     *         <li> IMAP: a set of msn, uid, Flags, header lines, content, mime
+     *         parts...</li>
+     *         <li> Javamail Folder: Message[]</li>
+     *         </ul>
+     * @throws MailboxManagerException 
+     */
 
-	MessageResult[] getMessages(GeneralMessageSet set, int result) throws MailboxManagerException;
+    MessageResult[] getMessages(GeneralMessageSet set, int result) throws MailboxManagerException;
 
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/GeneralMailboxSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailbox.java Tue Oct 10 01:34:56 2006
@@ -1,12 +1,12 @@
-package org.apache.james.mailboxmanager.mailbox;
-
-
-
-/**
- * Provides access to a single Folder.<br />
- */
-
-public interface ImapMailbox extends GeneralMailbox, FlaggedMailbox, EventTriggerMailbox, UidMailbox, SearchableMailbox {
-
-
-}
+package org.apache.james.mailboxmanager.mailbox;
+
+
+
+/**
+ * Provides access to a single Folder.<br />
+ */
+
+public interface ImapMailbox extends GeneralMailbox, FlaggedMailbox, EventTriggerMailbox, UidMailbox, SearchableMailbox {
+
+
+}

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailboxSession.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailboxSession.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailboxSession.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailboxSession.java Tue Oct 10 01:34:56 2006
@@ -16,19 +16,19 @@
  */
 
 public interface ImapMailboxSession extends ImapMailbox, MailboxListener, GeneralMailboxSession, EventQueueingSessionMailbox {
-	
-	
-	/**
-	 *
-	 * @return the effective rights to this mailbox
-	 */
-	MailboxRights myRights();
-	/**
-	 * 
-	 * @return the quota that is assigned to this mailbox
-	 */
-	Quota[] getQuota();
+    
+    
+    /**
+     *
+     * @return the effective rights to this mailbox
+     */
+    MailboxRights myRights();
+    /**
+     * 
+     * @return the quota that is assigned to this mailbox
+     */
+    Quota[] getQuota();
 
-	boolean isSelectable();
+    boolean isSelectable();
     
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/ImapMailboxSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailMailbox.java Tue Oct 10 01:34:56 2006
@@ -20,9 +20,9 @@
 
 public interface MailMailbox {
 
-	MessageResult appendMail(Mail mail, Date internalDate, int result)
-			throws MailboxManagerException;
+    MessageResult appendMail(Mail mail, Date internalDate, int result)
+            throws MailboxManagerException;
 
-	MessageResult updateMail(Mail mail, Date internalDate, int result)
-			throws MailboxManagerException;
+    MessageResult updateMail(Mail mail, Date internalDate, int result)
+            throws MailboxManagerException;
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/Mailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/MailboxSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/SearchableMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/SearchableMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/SearchableMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/SearchableMailbox.java Tue Oct 10 01:34:56 2006
@@ -7,16 +7,16 @@
 import org.apache.james.mailboxmanager.MessageResult;
 
 public interface SearchableMailbox {
-	/**
-	 * @param result
-	 *            which fields to be returned in MessageResult
-	 * @return MessageResult with the fields defined by <b>result</b>
-	 *         <ul>
-	 *         <li> IMAP: msn or (msn and uid)</li>
-	 *         <li> Javamail Folder: Message[]</li>
-	 *         </ul>
-	 * @throws MailboxManagerException
-	 *             if anything went wrong
-	 */
-	MessageResult[] search(GeneralMessageSet set,SearchTerm searchTerm, int result) throws MailboxManagerException;
+    /**
+     * @param result
+     *            which fields to be returned in MessageResult
+     * @return MessageResult with the fields defined by <b>result</b>
+     *         <ul>
+     *         <li> IMAP: msn or (msn and uid)</li>
+     *         <li> Javamail Folder: Message[]</li>
+     *         </ul>
+     * @throws MailboxManagerException
+     *             if anything went wrong
+     */
+    MessageResult[] search(GeneralMessageSet set,SearchTerm searchTerm, int result) throws MailboxManagerException;
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/SearchableMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/UidMailbox.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/UidMailbox.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/UidMailbox.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/UidMailbox.java Tue Oct 10 01:34:56 2006
@@ -3,16 +3,16 @@
 import org.apache.james.mailboxmanager.MailboxManagerException;
 
 public interface UidMailbox {
-	
-	
-	long getUidValidity() throws MailboxManagerException;
-	
-	/**
-	 * 
-	 * @return the uid that will be assigned to the next appended message
-	 * @throws MailboxManagerException 
-	 */
+    
+    
+    long getUidValidity() throws MailboxManagerException;
+    
+    /**
+     * 
+     * @return the uid that will be assigned to the next appended message
+     * @throws MailboxManagerException 
+     */
 
-	long getUidNext() throws MailboxManagerException;
+    long getUidNext() throws MailboxManagerException;
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/mailbox/UidMailbox.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java Tue Oct 10 01:34:56 2006
@@ -5,12 +5,12 @@
 
 public interface BasicManager {
 
-	/**
-	 * 
-	 * @param user
-	 * @return
-	 */
-	BasicMailboxSession getInbox(User user);
-	
-	void deleteAllUserData(User user);
+    /**
+     * 
+     * @param user
+     * @return
+     */
+    BasicMailboxSession getInbox(User user);
+    
+    void deleteAllUserData(User user);
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/BasicManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java Tue Oct 10 01:34:56 2006
@@ -47,99 +47,99 @@
 
 public interface GeneralManager extends MailboxManager {
 
-	/**
-	 * get a session mailbox 
-	 * 
-	 * @param nameSpaceName
-	 * @param user
-	 * @return
-	 * @throws MailboxManagerException 
-	 */
-	MailboxSession getMailboxSession(String mailboxName,Class neededInterface,int[] setTypes,int resultTypes) throws MailboxManagerException;
-	
-	/**
-	 * Supports 
-	 * 
-	 * @param mailboxName
-	 * @return
-	 * @throws MailboxManagerException
-	 */
-	
-	GeneralMailboxSession getGenericGeneralMailboxSession(String mailboxName) throws MailboxManagerException;
-	
-	ImapMailboxSession getGenericImapMailboxSession(String mailboxName) throws MailboxManagerException;
-
-	/**
-	 * The Namespaces a user has access to.
-	 * @param forUser TODO
-	 * @param user
-	 * 
-	 * @return
-	 */
-	Namespaces getNamespaces(User forUser);
-
-	/**
-	 * To get the Inbox you can just to a mailbox
-	 * defaultNameSpace=ImapMailboxRepository.getPersonalDefaultNameSpace(user)
-	 * inbox=defaultNameSpace.getName()+defaultNameSpace.getHierarchyDelimter()+"INBOX";
-	 * TODO add a convinience method to get directly a session mailbox for a users inbox
-	 * @param forUser TODO
-	 * 
-	 * @return
-	 */
-	Namespace getPersonalDefaultNamespace(User forUser);
-	
-	
-
-	void createMailbox(String mailboxName) throws MailboxManagerException;
-
-	void deleteMailbox(String mailboxName) throws MailboxManagerException;
-
-	void renameMailbox(String from, String to) throws MailboxManagerException;
-
-	/**
-	 * this is done by the MailboxRepository because maybe this operation could
-	 * be optimized in the corresponding store.
-	 * 
-	 * @param from
-	 * @param set
-	 *            messages to copy
-	 * @param to
-	 *            name of the destination mailbox
-	 */
-	void copyMessages(GeneralMailbox from, GeneralMessageSet set, String to) throws MailboxManagerException;
-
-	/**
-	 * 
-	 * @param base
-	 *            hierarchy starting point like #mail.user1 to list mailboxes of
-	 *            user1
-	 * @param expression
-	 *            allows the use of wildcards
-	 * @param subscribed
-	 *            if true, only list subscribed mailboxes (needs interaction
-	 *            with the user-object)
-	 * @param user
-	 * @return
-	 * @throws MailboxManagerException 
-	 */
-
-	ListResult[] list(String base, String expression, boolean subscribed) throws MailboxManagerException;
-
-	/**
-	 * could be implemented later. There could be enviroments where
-	 * subscribtions are stored in the mailbox database. Another possibility is
-	 * to manage subscribtions in the user repository, e.g. a ldap attribute,
-	 * 
-	 * @param mailboxName
-	 * @param value
-	 * @param user
-	 */
+    /**
+     * get a session mailbox 
+     * 
+     * @param nameSpaceName
+     * @param user
+     * @return
+     * @throws MailboxManagerException 
+     */
+    MailboxSession getMailboxSession(String mailboxName,Class neededInterface,int[] setTypes,int resultTypes) throws MailboxManagerException;
+    
+    /**
+     * Supports 
+     * 
+     * @param mailboxName
+     * @return
+     * @throws MailboxManagerException
+     */
+    
+    GeneralMailboxSession getGenericGeneralMailboxSession(String mailboxName) throws MailboxManagerException;
+    
+    ImapMailboxSession getGenericImapMailboxSession(String mailboxName) throws MailboxManagerException;
+
+    /**
+     * The Namespaces a user has access to.
+     * @param forUser TODO
+     * @param user
+     * 
+     * @return
+     */
+    Namespaces getNamespaces(User forUser);
+
+    /**
+     * To get the Inbox you can just to a mailbox
+     * defaultNameSpace=ImapMailboxRepository.getPersonalDefaultNameSpace(user)
+     * inbox=defaultNameSpace.getName()+defaultNameSpace.getHierarchyDelimter()+"INBOX";
+     * TODO add a convinience method to get directly a session mailbox for a users inbox
+     * @param forUser TODO
+     * 
+     * @return
+     */
+    Namespace getPersonalDefaultNamespace(User forUser);
+    
+    
+
+    void createMailbox(String mailboxName) throws MailboxManagerException;
+
+    void deleteMailbox(String mailboxName) throws MailboxManagerException;
+
+    void renameMailbox(String from, String to) throws MailboxManagerException;
+
+    /**
+     * this is done by the MailboxRepository because maybe this operation could
+     * be optimized in the corresponding store.
+     * 
+     * @param from
+     * @param set
+     *            messages to copy
+     * @param to
+     *            name of the destination mailbox
+     */
+    void copyMessages(GeneralMailbox from, GeneralMessageSet set, String to) throws MailboxManagerException;
+
+    /**
+     * 
+     * @param base
+     *            hierarchy starting point like #mail.user1 to list mailboxes of
+     *            user1
+     * @param expression
+     *            allows the use of wildcards
+     * @param subscribed
+     *            if true, only list subscribed mailboxes (needs interaction
+     *            with the user-object)
+     * @param user
+     * @return
+     * @throws MailboxManagerException 
+     */
+
+    ListResult[] list(String base, String expression, boolean subscribed) throws MailboxManagerException;
+
+    /**
+     * could be implemented later. There could be enviroments where
+     * subscribtions are stored in the mailbox database. Another possibility is
+     * to manage subscribtions in the user repository, e.g. a ldap attribute,
+     * 
+     * @param mailboxName
+     * @param value
+     * @param user
+     */
 
-	void setSubscription(String mailboxName, boolean value) throws MailboxManagerException;
+    void setSubscription(String mailboxName, boolean value) throws MailboxManagerException;
 
     boolean existsMailbox(String mailboxName) throws MailboxManagerException;
 
-	void close();
+    void close();
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/GeneralManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/MailboxManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/MailboxManagerProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/QuotaManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/QuotaManager.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/QuotaManager.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/QuotaManager.java Tue Oct 10 01:34:56 2006
@@ -20,81 +20,81 @@
 
 public interface QuotaManager {
 
-	/**
-	 * Get the quotas that are associated to this mailbox
-	 * 
-	 * @param requestingUser
-	 *            to check credentials
-	 */
-
-	Quota[] getQuotas(String mailboxName, User requestingUser);
-
-	/**
-	 * list the available repositories
-	 * 
-	 * @return names of the repositories
-	 */
-	String[] listRepositories();
-
-	/**
-	 * List the mailboxes that exist in this repository.
-	 * 
-	 * @param repositoryName
-	 * @param base
-	 * @param expression
-	 * @param user
-	 * @return
-	 */
-
-	ListResult[] listForRepository(String repositoryName, String base,
-			String expression, User user);
-
-	/**
-	 * Lists quotas the user is allowed to manage. Via base and expression the
-	 * user is able to browse quotas that are bound to a root mailbox.
-	 * 
-	 * @param repositoryName
-	 * @param base
-	 *            like in list()
-	 * @param expression
-	 *            like in list(), if empty only namespace-root quotas will be
-	 *            listet
-	 * @param user
-	 * @return
-	 */
-	Quota[] listQuotas(String repositoryName, String base, String expression,
-			User requestingUser);
-
-	/**
-	 * <p>
-	 * create a new quota in the given repository
-	 * </p>
-	 * <p>
-	 * An example sitatuation where users create quotas could be setting up auto
-	 * purge for their Trash mailbox. User may be limited to the store where
-	 * theier mailbox resists. To avoid chaos a naming schema should be used.
-	 * </p>
-	 * Changing/updating quotas will be done in quota object itself by calling
-	 * save() method
-	 * 
-	 * @param repositoryName
-	 * @param rootMailbox
-	 *            the root mailbox the quota will be bound to, maybe an empty
-	 *            String for a namespace root quota
-	 * @param quotaName
-	 *            free chosen, has to be unique for the root mailbox
-	 * @param user
-	 *            to check credentials
-	 * @return a new quota object that can be populated with values
-	 */
+    /**
+     * Get the quotas that are associated to this mailbox
+     * 
+     * @param requestingUser
+     *            to check credentials
+     */
+
+    Quota[] getQuotas(String mailboxName, User requestingUser);
+
+    /**
+     * list the available repositories
+     * 
+     * @return names of the repositories
+     */
+    String[] listRepositories();
+
+    /**
+     * List the mailboxes that exist in this repository.
+     * 
+     * @param repositoryName
+     * @param base
+     * @param expression
+     * @param user
+     * @return
+     */
+
+    ListResult[] listForRepository(String repositoryName, String base,
+            String expression, User user);
+
+    /**
+     * Lists quotas the user is allowed to manage. Via base and expression the
+     * user is able to browse quotas that are bound to a root mailbox.
+     * 
+     * @param repositoryName
+     * @param base
+     *            like in list()
+     * @param expression
+     *            like in list(), if empty only namespace-root quotas will be
+     *            listet
+     * @param user
+     * @return
+     */
+    Quota[] listQuotas(String repositoryName, String base, String expression,
+            User requestingUser);
+
+    /**
+     * <p>
+     * create a new quota in the given repository
+     * </p>
+     * <p>
+     * An example sitatuation where users create quotas could be setting up auto
+     * purge for their Trash mailbox. User may be limited to the store where
+     * theier mailbox resists. To avoid chaos a naming schema should be used.
+     * </p>
+     * Changing/updating quotas will be done in quota object itself by calling
+     * save() method
+     * 
+     * @param repositoryName
+     * @param rootMailbox
+     *            the root mailbox the quota will be bound to, maybe an empty
+     *            String for a namespace root quota
+     * @param quotaName
+     *            free chosen, has to be unique for the root mailbox
+     * @param user
+     *            to check credentials
+     * @return a new quota object that can be populated with values
+     */
 
-	Quota createQuota(String repositoryName, String rootMailbox,
-			String quotaName, User user);
+    Quota createQuota(String repositoryName, String rootMailbox,
+            String quotaName, User user);
 
-	Quota getQuota(String repositoryName, String rootMailbox, String quotaName,
-			User user);
+    Quota getQuota(String repositoryName, String rootMailbox, String quotaName,
+            User user);
 
-	void removeQuota(String repositoryName, String quotaName,
-			User requestingUser);
+    void removeQuota(String repositoryName, String quotaName,
+            User requestingUser);
 
 }

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/manager/QuotaManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/package.html
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/package.html?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/package.html (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/package.html Tue Oct 10 01:34:56 2006
@@ -16,4 +16,4 @@
       integration should be done like using namespaces in whole james, because it makes no
       sense to deal with two different approaches which blows up code base.</p>
   </body>
-</html>
\ No newline at end of file
+</html>

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AbstractMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AbstractMailRepository.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AbstractMailRepository.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AbstractMailRepository.java Tue Oct 10 01:34:56 2006
@@ -1,20 +1,20 @@
-/****************************************************************
- * 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.                                           *
+/****************************************************************
+ * 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.mailboxmanager.repository;
@@ -47,7 +47,7 @@
      */
     protected final static boolean DEEP_DEBUG = true;
 
-	private static Random random;
+    private static Random random;
 
     protected Log log;
     
@@ -59,9 +59,9 @@
     
 
     protected Log getLogger() {
-    	if (log==null) {
-    		log=new SimpleLog("AbstractMailRepository");
-    	}
+        if (log==null) {
+            log=new SimpleLog("AbstractMailRepository");
+        }
         return log;
     }
 

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AbstractMailRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/AvalonMailStore.xinfo
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java Tue Oct 10 01:34:56 2006
@@ -1,20 +1,20 @@
-/****************************************************************
- * 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.                                           *
+/****************************************************************
+ * 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.mailboxmanager.repository;
@@ -59,401 +59,401 @@
  * TODO examine for thread-safety
  */
 public class MailboxManagerMailRepository extends AbstractMailRepository
-		implements Configurable, Serviceable {
+        implements Configurable, Serviceable {
 
-	/**
-	 * used to map keys to uid and vice versa
-	 */
-	private UidToKeyBidiMap uidToKeyBidiMap = null;
-
-	private GeneralManager mailboxManager;
-
-	private MailboxGateKeeper mailboxGateKeeper;
-
-	private MailboxManagerProvider mailboxManagerProvider;
-
-	private User user;
-
-	protected long addUIDMessage(MimeMessage message) throws MessagingException {
-		try {
-			MessageResult mr = getMailboxGateKeeper().getMailbox().appendMessage(message,
-					new Date(), MessageResult.UID);
-			return mr.getUid();
-		} catch (MailboxManagerException e) {
-			throw new MessagingException(e.getMessage(), e);
-		}
-
-	}
-
-	/**
-	 * Does nothing
-	 * 
-	 * @see Initializable#initialize()
-	 */
-	public void initialize() throws Exception {
-		getLogger().debug("MailboxManagerMailRepository initialized");
-	}
-
-	/**
-	 * Stores a message in this repository.
-	 * 
-	 * @param mc
-	 *            the mail message to store
-	 * @throws MessagingException
-	 */
-	public synchronized void store(Mail mc) throws MessagingException {
-		MimeMessage message = mc.getMessage();
-		String key = mc.getName();
-		
-		getLogger().debug("store key:" + mc.getName());
-		if (!message.isSet(Flag.RECENT)) {
-			getLogger().debug("Message didn't have RECENT flag");
-			message.setFlag(Flag.RECENT, true);
-		}
-
-		boolean wasLocked = true;
-		try {
-			getMailboxGateKeeper().use();
-			
-			synchronized (this) {
-				wasLocked = getLock().isLocked(key);
-				if (!wasLocked) {
-					// If it wasn't locked, we want a lock during the store
-					lock(key);
-				}
-			}
-
-			// insert or update, don't call remove(key) because of locking
-			if (getUidToKeyBidiMap().containsKey(key)) {
-				getLogger().info("remove message because of update Key:" + mc.getName());
-				doRemove(key,true);
-			}
-			long uid = addUIDMessage(message);
-			getUidToKeyBidiMap().put(key, uid);
-
-			getLogger().info("message stored: UID: " + uid + " Key:" + mc.getName());
-		} finally {
-
-			if (!wasLocked) {
-				// If it wasn't locked, we need to unlock now
-				unlock(key);
-				synchronized (this) {
-					notify();
-				}
-			}
-			getMailboxGateKeeper().free();
-		}
-	}
-
-	/**
-	 * lazy loads UidToKeyBidiMap
-	 * 
-	 * @return
-	 */
-	protected UidToKeyBidiMap getUidToKeyBidiMap() {
-		if (uidToKeyBidiMap == null) {
-			uidToKeyBidiMap = new UidToKeyBidiMapImpl();
-		}
-		return uidToKeyBidiMap;
-	}
-
-	/**
-	 * Used for testing
-	 * 
-	 * @param uidToKeyBidiMap
-	 */
-	void setUidToKeyBidiMap(UidToKeyBidiMap uidToKeyBidiMap) {
-		this.uidToKeyBidiMap = uidToKeyBidiMap;
-	}
-
-	/**
-	 * Retrieves a message given a key. At the moment, keys can be obtained from
-	 * list() in superinterface Store.Repository
-	 * 
-	 * @param key
-	 *            the key of the message to retrieve
-	 * @return the mail corresponding to this key, null if none exists
-	 * @throws MessagingException
-	 */
-
-	public Mail retrieve(String key) throws MessagingException {
-		getLogger().info("retrieve " + key);
-		MimeMessage mm = getMessageFromInbox(key);
-		if (mm == null)
-			return null;
-		Mail mail = new MailImpl(mm);
-		mail.setName(key);
-		return mail;
-	}
-
-	/**
-	 * Removes a message identified by key.
-	 * 
-	 * @param key
-	 *            the key of the message to be removed from the repository
-	 */
-	public synchronized void remove(String key) throws MessagingException {
-		getLogger().info(" remove key:" + key);
-		doLockedRemove(key,true);
-	}
-
-	protected void doLockedRemove(String key,boolean expunge) throws MessagingException {
-		if (lock(key)) {
-			try {
-				doRemove(key,expunge);
-			} finally {
-				unlock(key);
-			}
-		} else {
-			getLogger().info("could not optain lock to remove key:" + key);
-			throw new MessagingException("could not optain lock for remove");
-		}
-	}
-	protected void doRemove(String key,boolean expunge) throws MessagingException {
-		try {
-			getMailboxGateKeeper().use();
-			if (getUidToKeyBidiMap().containsKey(key)) {
-				long uid = getUidToKeyBidiMap().getByKey(key);
-				getMailboxGateKeeper().getMailbox().setFlags(
-						new Flags(Flags.Flag.DELETED), true, false,
-						GeneralMessageSetImpl.oneUid(uid), null);
-				getUidToKeyBidiMap().removeByKey(key);
-				if (expunge) {
-					doExpunge();
-				}
-			}
-		} catch (MailboxManagerException e) {
-			throw new MessagingException(e.getMessage(), e);
-		} finally {
-			getMailboxGateKeeper().free();
-		}
-	}
-
-	protected void doExpunge() {
-		try {
-			getLogger().debug("Expunge");
-			getMailboxGateKeeper().getMailbox().expunge(
-					GeneralMessageSetImpl.all(), MessageResult.NOTHING);
-		} catch (MailboxManagerException e) {
-			getLogger().error("Error expunging mailbox",e);
-		} catch (MessagingException e) {
-			getLogger().error("Error expunging mailbox",e);
-		}		
-	}
-	
-	/**
-	 * List string keys of messages in repository.
-	 * 
-	 * @return an <code>Iterator</code> over the list of keys in the
-	 *         repository
-	 * @throws MessagingException
-	 * 
-	 */
-	public Iterator list() throws MessagingException {
-		getLogger().debug("UIDPlusFolder list");
-		try {
-			getMailboxGateKeeper().use();
-			FlaggedMailbox mailbox = getMailboxGateKeeper().getMailbox();
-			
-			// needed for retainAllListedAndAddedByKeys(String[], Collection)
-			String[] keysBefore = getUidToKeyBidiMap().getKeys();
-			
-			// get the messages
-			MessageResult[] messageResults = mailbox.getMessages(
-					GeneralMessageSetImpl.all(), MessageResult.UID
-							+ MessageResult.FLAGS);
-			Collection keys = new ArrayList(messageResults.length);
-			for (int i = 0; i < messageResults.length; i++) {
-				
-				long uid = messageResults[i].getUid();
-				
-				if (!messageResults[i].getFlags().contains(Flags.Flag.DELETED)) {
-
-					long uidvalidity = ((UidMailbox) mailbox).getUidValidity();
-					// lookup uid
-
-					String key = getUidToKeyBidiMap().getByUid(uid);
-					if (key == null) {
-						// generate new key
-						key = "james-uid:" + uidvalidity + ";" + uid + ";"
-								+ System.currentTimeMillis() + ";"
-								+ getRandom().nextLong();
-						getUidToKeyBidiMap().put(key, uid);
-					}
-					keys.add(key);
-					getLogger().debug("list: UID: " + uid + " Key:" + key);
-				} else {
-					getLogger().debug("don't list deleted UID:" + uid); 
-				}
-			}
-			// retain only listed keys, and keys added in the meantime (it would
-			// be fatal to loose those)
-			// I don't care about meanwhile removed, those will fail on next
-			// access
-			// it's a good idea to keep count of cached small
-			getUidToKeyBidiMap()
-					.retainAllListedAndAddedByKeys(keysBefore, keys);
-			return keys.iterator();
-		} catch (MailboxManagerException e) {
-			throw new MessagingException(e.getMessage(), e);
-		} finally {
-			getMailboxGateKeeper().free();
-		}
-	}
-
-	private MimeMessage getMessageFromInbox(String key)
-			throws MessagingException {
-
-		long uid = getUidToKeyBidiMap().getByKey(key);
-		if (uid < 1) {
-			return null;
-		}
-		MessageResult[] messageResults;
-		try {
-			getMailboxGateKeeper().use();
-			messageResults = getMailboxGateKeeper().getMailbox().getMessages(
-					GeneralMessageSetImpl.oneUid(uid),
-					MessageResult.MIME_MESSAGE);
-		} catch (MailboxManagerException e) {
-			throw new MessagingException(e.getMessage(), e);
-		} finally {
-			getMailboxGateKeeper().free();
-		}
-
-		MimeMessage mm = null;
-		if (messageResults.length == 1) {
-			mm = messageResults[0].getMimeMessage();
-		}
-		getLogger().debug("getMessageFromInbox: UID: " + uid + " Key:" + key);
-		if (mm == null) {
-			getUidToKeyBidiMap().removeByKey(key);
-			getLogger().info("Message not Found");
-		}
-		return mm;
-	}
-
-	public void remove(Collection mails) throws MessagingException {
-		getLogger().debug("Remove by Collection KEYS:"+mails);
-		try {
-			getMailboxGateKeeper().use();
-			for (Iterator iter = mails.iterator(); iter.hasNext();) {
-				Mail mail = (Mail) iter.next();
-				doRemove(mail.getName(), false);
-			}
-			doExpunge();
-		} finally {
-			getMailboxGateKeeper().free();
-		}
-
-	}
-
-	protected MailboxGateKeeper getMailboxGateKeeper() {
-		if (mailboxGateKeeper == null) {
-			mailboxGateKeeper = new MailboxGateKeeper();
-		}
-		return mailboxGateKeeper;
-	}
-
-	class MailboxGateKeeper {
-		int open = 0;
-
-		FlaggedMailbox mailbox = null;
-
-		synchronized void use() {
-			open++;
-		}
-
-		synchronized void  free() {
-			if (open < 1) {
-				throw new RuntimeException("use<1 !");
-			}
-			open--;
-			if (open < 1) {
-				if (open == 0) {
-					if (mailbox != null) {
-						((MailboxSession) mailbox).close();
-						mailbox=null;
-					}
-				} else {
-					throw new RuntimeException("use<0 !");
-				}
-			}
-		}
-
-		synchronized FlaggedMailbox getMailbox()
-				throws MailboxManagerException, MessagingException {
-			if (open < 1) {
-				throw new RuntimeException("use<1 !");
-			}
-			if (mailbox == null) {
-				Namespace ns = getMailboxManager().getPersonalDefaultNamespace(
-						user);
-
-				String inbox=ns.getName() + ns.getHierarchyDelimter()+ "INBOX";
-				mailbox = getMailboxManager()
-						.getGenericImapMailboxSession(inbox);
-			}
-			return mailbox;
-		}
-	}
-
-	/**
-	 * lazy loads a MailboxManager from MailboxManagerProvider
-	 * 
-	 */
-	
-	protected GeneralManager getMailboxManager() throws MessagingException,
-			MailboxManagerException {
-		if (mailboxManager == null) {
-			if (user == null) {
-				throw new MessagingException("user is null");
-			}
-			mailboxManager = getMailboxManagerProvider()
-					.getGeneralManagerInstance(user);
-		}
-		return mailboxManager;
-	}
-
-	protected MailboxManagerProvider getMailboxManagerProvider() {
-		return mailboxManagerProvider;
-	}
-
-	public void setMailboxManagerProvider(
-			MailboxManagerProvider mailboxManagerProvider) {
-		this.mailboxManagerProvider = mailboxManagerProvider;
-	}
-
-	public void configure(Configuration conf) throws ConfigurationException {
-		
-		// fetch user name
-		
-		String destinationUrl = conf.getAttribute("destinationURL");
-		if (destinationUrl.endsWith("/")) {
-			destinationUrl = destinationUrl.substring(0, destinationUrl
-					.length() - 1);
-		}
-		String userName = destinationUrl.substring(destinationUrl
-				.lastIndexOf('/') + 1);
-		getLogger().info("Configured for user: '"+userName+"' URL: '"+destinationUrl+"'");
-		setUser(new DefaultJamesUser(userName,"none"));
-	}
-
-
-	public void setUser(User user) {
-		this.user=user;
-	}
-
-	public void service(ServiceManager serviceManager) throws ServiceException {
-		MailboxManagerProvider mailboxManagerProvider =(MailboxManagerProvider) serviceManager.lookup("org.apache.james.mailboxmanager.manager.MailboxManagerProvider");
-		getLogger().debug("MailboxManagerMailRepository uses service "+mailboxManagerProvider);
-		setMailboxManagerProvider(mailboxManagerProvider);
-	}
-	
-	
+    /**
+     * used to map keys to uid and vice versa
+     */
+    private UidToKeyBidiMap uidToKeyBidiMap = null;
+
+    private GeneralManager mailboxManager;
+
+    private MailboxGateKeeper mailboxGateKeeper;
+
+    private MailboxManagerProvider mailboxManagerProvider;
+
+    private User user;
+
+    protected long addUIDMessage(MimeMessage message) throws MessagingException {
+        try {
+            MessageResult mr = getMailboxGateKeeper().getMailbox().appendMessage(message,
+                    new Date(), MessageResult.UID);
+            return mr.getUid();
+        } catch (MailboxManagerException e) {
+            throw new MessagingException(e.getMessage(), e);
+        }
+
+    }
+
+    /**
+     * Does nothing
+     * 
+     * @see Initializable#initialize()
+     */
+    public void initialize() throws Exception {
+        getLogger().debug("MailboxManagerMailRepository initialized");
+    }
+
+    /**
+     * Stores a message in this repository.
+     * 
+     * @param mc
+     *            the mail message to store
+     * @throws MessagingException
+     */
+    public synchronized void store(Mail mc) throws MessagingException {
+        MimeMessage message = mc.getMessage();
+        String key = mc.getName();
+        
+        getLogger().debug("store key:" + mc.getName());
+        if (!message.isSet(Flag.RECENT)) {
+            getLogger().debug("Message didn't have RECENT flag");
+            message.setFlag(Flag.RECENT, true);
+        }
+
+        boolean wasLocked = true;
+        try {
+            getMailboxGateKeeper().use();
+            
+            synchronized (this) {
+                wasLocked = getLock().isLocked(key);
+                if (!wasLocked) {
+                    // If it wasn't locked, we want a lock during the store
+                    lock(key);
+                }
+            }
+
+            // insert or update, don't call remove(key) because of locking
+            if (getUidToKeyBidiMap().containsKey(key)) {
+                getLogger().info("remove message because of update Key:" + mc.getName());
+                doRemove(key,true);
+            }
+            long uid = addUIDMessage(message);
+            getUidToKeyBidiMap().put(key, uid);
+
+            getLogger().info("message stored: UID: " + uid + " Key:" + mc.getName());
+        } finally {
+
+            if (!wasLocked) {
+                // If it wasn't locked, we need to unlock now
+                unlock(key);
+                synchronized (this) {
+                    notify();
+                }
+            }
+            getMailboxGateKeeper().free();
+        }
+    }
+
+    /**
+     * lazy loads UidToKeyBidiMap
+     * 
+     * @return
+     */
+    protected UidToKeyBidiMap getUidToKeyBidiMap() {
+        if (uidToKeyBidiMap == null) {
+            uidToKeyBidiMap = new UidToKeyBidiMapImpl();
+        }
+        return uidToKeyBidiMap;
+    }
+
+    /**
+     * Used for testing
+     * 
+     * @param uidToKeyBidiMap
+     */
+    void setUidToKeyBidiMap(UidToKeyBidiMap uidToKeyBidiMap) {
+        this.uidToKeyBidiMap = uidToKeyBidiMap;
+    }
+
+    /**
+     * Retrieves a message given a key. At the moment, keys can be obtained from
+     * list() in superinterface Store.Repository
+     * 
+     * @param key
+     *            the key of the message to retrieve
+     * @return the mail corresponding to this key, null if none exists
+     * @throws MessagingException
+     */
+
+    public Mail retrieve(String key) throws MessagingException {
+        getLogger().info("retrieve " + key);
+        MimeMessage mm = getMessageFromInbox(key);
+        if (mm == null)
+            return null;
+        Mail mail = new MailImpl(mm);
+        mail.setName(key);
+        return mail;
+    }
+
+    /**
+     * Removes a message identified by key.
+     * 
+     * @param key
+     *            the key of the message to be removed from the repository
+     */
+    public synchronized void remove(String key) throws MessagingException {
+        getLogger().info(" remove key:" + key);
+        doLockedRemove(key,true);
+    }
+
+    protected void doLockedRemove(String key,boolean expunge) throws MessagingException {
+        if (lock(key)) {
+            try {
+                doRemove(key,expunge);
+            } finally {
+                unlock(key);
+            }
+        } else {
+            getLogger().info("could not optain lock to remove key:" + key);
+            throw new MessagingException("could not optain lock for remove");
+        }
+    }
+    protected void doRemove(String key,boolean expunge) throws MessagingException {
+        try {
+            getMailboxGateKeeper().use();
+            if (getUidToKeyBidiMap().containsKey(key)) {
+                long uid = getUidToKeyBidiMap().getByKey(key);
+                getMailboxGateKeeper().getMailbox().setFlags(
+                        new Flags(Flags.Flag.DELETED), true, false,
+                        GeneralMessageSetImpl.oneUid(uid), null);
+                getUidToKeyBidiMap().removeByKey(key);
+                if (expunge) {
+                    doExpunge();
+                }
+            }
+        } catch (MailboxManagerException e) {
+            throw new MessagingException(e.getMessage(), e);
+        } finally {
+            getMailboxGateKeeper().free();
+        }
+    }
+
+    protected void doExpunge() {
+        try {
+            getLogger().debug("Expunge");
+            getMailboxGateKeeper().getMailbox().expunge(
+                    GeneralMessageSetImpl.all(), MessageResult.NOTHING);
+        } catch (MailboxManagerException e) {
+            getLogger().error("Error expunging mailbox",e);
+        } catch (MessagingException e) {
+            getLogger().error("Error expunging mailbox",e);
+        }       
+    }
+    
+    /**
+     * List string keys of messages in repository.
+     * 
+     * @return an <code>Iterator</code> over the list of keys in the
+     *         repository
+     * @throws MessagingException
+     * 
+     */
+    public Iterator list() throws MessagingException {
+        getLogger().debug("UIDPlusFolder list");
+        try {
+            getMailboxGateKeeper().use();
+            FlaggedMailbox mailbox = getMailboxGateKeeper().getMailbox();
+            
+            // needed for retainAllListedAndAddedByKeys(String[], Collection)
+            String[] keysBefore = getUidToKeyBidiMap().getKeys();
+            
+            // get the messages
+            MessageResult[] messageResults = mailbox.getMessages(
+                    GeneralMessageSetImpl.all(), MessageResult.UID
+                            + MessageResult.FLAGS);
+            Collection keys = new ArrayList(messageResults.length);
+            for (int i = 0; i < messageResults.length; i++) {
+                
+                long uid = messageResults[i].getUid();
+                
+                if (!messageResults[i].getFlags().contains(Flags.Flag.DELETED)) {
+
+                    long uidvalidity = ((UidMailbox) mailbox).getUidValidity();
+                    // lookup uid
+
+                    String key = getUidToKeyBidiMap().getByUid(uid);
+                    if (key == null) {
+                        // generate new key
+                        key = "james-uid:" + uidvalidity + ";" + uid + ";"
+                                + System.currentTimeMillis() + ";"
+                                + getRandom().nextLong();
+                        getUidToKeyBidiMap().put(key, uid);
+                    }
+                    keys.add(key);
+                    getLogger().debug("list: UID: " + uid + " Key:" + key);
+                } else {
+                    getLogger().debug("don't list deleted UID:" + uid); 
+                }
+            }
+            // retain only listed keys, and keys added in the meantime (it would
+            // be fatal to loose those)
+            // I don't care about meanwhile removed, those will fail on next
+            // access
+            // it's a good idea to keep count of cached small
+            getUidToKeyBidiMap()
+                    .retainAllListedAndAddedByKeys(keysBefore, keys);
+            return keys.iterator();
+        } catch (MailboxManagerException e) {
+            throw new MessagingException(e.getMessage(), e);
+        } finally {
+            getMailboxGateKeeper().free();
+        }
+    }
+
+    private MimeMessage getMessageFromInbox(String key)
+            throws MessagingException {
+
+        long uid = getUidToKeyBidiMap().getByKey(key);
+        if (uid < 1) {
+            return null;
+        }
+        MessageResult[] messageResults;
+        try {
+            getMailboxGateKeeper().use();
+            messageResults = getMailboxGateKeeper().getMailbox().getMessages(
+                    GeneralMessageSetImpl.oneUid(uid),
+                    MessageResult.MIME_MESSAGE);
+        } catch (MailboxManagerException e) {
+            throw new MessagingException(e.getMessage(), e);
+        } finally {
+            getMailboxGateKeeper().free();
+        }
+
+        MimeMessage mm = null;
+        if (messageResults.length == 1) {
+            mm = messageResults[0].getMimeMessage();
+        }
+        getLogger().debug("getMessageFromInbox: UID: " + uid + " Key:" + key);
+        if (mm == null) {
+            getUidToKeyBidiMap().removeByKey(key);
+            getLogger().info("Message not Found");
+        }
+        return mm;
+    }
+
+    public void remove(Collection mails) throws MessagingException {
+        getLogger().debug("Remove by Collection KEYS:"+mails);
+        try {
+            getMailboxGateKeeper().use();
+            for (Iterator iter = mails.iterator(); iter.hasNext();) {
+                Mail mail = (Mail) iter.next();
+                doRemove(mail.getName(), false);
+            }
+            doExpunge();
+        } finally {
+            getMailboxGateKeeper().free();
+        }
+
+    }
+
+    protected MailboxGateKeeper getMailboxGateKeeper() {
+        if (mailboxGateKeeper == null) {
+            mailboxGateKeeper = new MailboxGateKeeper();
+        }
+        return mailboxGateKeeper;
+    }
+
+    class MailboxGateKeeper {
+        int open = 0;
+
+        FlaggedMailbox mailbox = null;
+
+        synchronized void use() {
+            open++;
+        }
+
+        synchronized void  free() {
+            if (open < 1) {
+                throw new RuntimeException("use<1 !");
+            }
+            open--;
+            if (open < 1) {
+                if (open == 0) {
+                    if (mailbox != null) {
+                        ((MailboxSession) mailbox).close();
+                        mailbox=null;
+                    }
+                } else {
+                    throw new RuntimeException("use<0 !");
+                }
+            }
+        }
+
+        synchronized FlaggedMailbox getMailbox()
+                throws MailboxManagerException, MessagingException {
+            if (open < 1) {
+                throw new RuntimeException("use<1 !");
+            }
+            if (mailbox == null) {
+                Namespace ns = getMailboxManager().getPersonalDefaultNamespace(
+                        user);
+
+                String inbox=ns.getName() + ns.getHierarchyDelimter()+ "INBOX";
+                mailbox = getMailboxManager()
+                        .getGenericImapMailboxSession(inbox);
+            }
+            return mailbox;
+        }
+    }
+
+    /**
+     * lazy loads a MailboxManager from MailboxManagerProvider
+     * 
+     */
+    
+    protected GeneralManager getMailboxManager() throws MessagingException,
+            MailboxManagerException {
+        if (mailboxManager == null) {
+            if (user == null) {
+                throw new MessagingException("user is null");
+            }
+            mailboxManager = getMailboxManagerProvider()
+                    .getGeneralManagerInstance(user);
+        }
+        return mailboxManager;
+    }
+
+    protected MailboxManagerProvider getMailboxManagerProvider() {
+        return mailboxManagerProvider;
+    }
+
+    public void setMailboxManagerProvider(
+            MailboxManagerProvider mailboxManagerProvider) {
+        this.mailboxManagerProvider = mailboxManagerProvider;
+    }
+
+    public void configure(Configuration conf) throws ConfigurationException {
+        
+        // fetch user name
+        
+        String destinationUrl = conf.getAttribute("destinationURL");
+        if (destinationUrl.endsWith("/")) {
+            destinationUrl = destinationUrl.substring(0, destinationUrl
+                    .length() - 1);
+        }
+        String userName = destinationUrl.substring(destinationUrl
+                .lastIndexOf('/') + 1);
+        getLogger().info("Configured for user: '"+userName+"' URL: '"+destinationUrl+"'");
+        setUser(new DefaultJamesUser(userName,"none"));
+    }
+
+
+    public void setUser(User user) {
+        this.user=user;
+    }
+
+    public void service(ServiceManager serviceManager) throws ServiceException {
+        MailboxManagerProvider mailboxManagerProvider =(MailboxManagerProvider) serviceManager.lookup("org.apache.james.mailboxmanager.manager.MailboxManagerProvider");
+        getLogger().debug("MailboxManagerMailRepository uses service "+mailboxManagerProvider);
+        setMailboxManagerProvider(mailboxManagerProvider);
+    }
+    
+    
     protected Log getLogger() {
-    	if (log==null) {
-    		log=new SimpleLog("MailboxManagerMailRepository");
-    	}
+        if (log==null) {
+            log=new SimpleLog("MailboxManagerMailRepository");
+        }
         return log;
     }
 

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MailboxManagerMailRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MyAvalonMailStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/mailboxmanager/repository/MyAvalonMailStore.xinfo
------------------------------------------------------------------------------
    svn:eol-style = native



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