james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r731341 - in /james/protocols/imap/trunk: jpa/src/main/java/org/apache/james/imap/jpa/ mailbox/src/main/java/org/apache/james/imap/mailbox/ processor/src/main/java/org/apache/james/imap/processor/base/ processor/src/main/java/org/apache/jam...
Date Sun, 04 Jan 2009 19:17:50 GMT
Author: rdonkin
Date: Sun Jan  4 11:17:50 2009
New Revision: 731341

URL: http://svn.apache.org/viewvc?rev=731341&view=rev
Log:
Move add listener to MailboxManager

Modified:
    james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailboxManager.java
    james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java
    james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/AbstractSelectionProcessor.java
    james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java

Modified: james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailboxManager.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailboxManager.java?rev=731341&r1=731340&r2=731341&view=diff
==============================================================================
--- james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailboxManager.java
(original)
+++ james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailboxManager.java
Sun Jan  4 11:17:50 2009
@@ -40,6 +40,7 @@
 import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxExpression;
+import org.apache.james.imap.mailbox.MailboxListener;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
 import org.apache.james.imap.mailbox.MailboxSession;
@@ -359,4 +360,9 @@
         subscriber.unsubscribe(user, mailbox);
     }
 
+    public void addListener(String mailboxName, MailboxListener listener) throws MailboxException
{
+        final JPAMailbox mailbox = doGetMailbox(mailboxName);
+        mailbox.addListener(listener);
+    }
+
 }

Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java?rev=731341&r1=731340&r2=731341&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java
(original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/Mailbox.java
Sun Jan  4 11:17:50 2009
@@ -178,16 +178,4 @@
     Iterator getMessages(MessageRange set, FetchGroup fetchGroup,
             MailboxSession mailboxSession) throws MailboxException;
 
-    /**
-     * <p>Implementations of Mailbox may interpret the fact that someone is
-     * listening and do some caching and even postpone persistence until
-     * everyone has removed itself.
-     * </p><p>
-     * Listeners should return true from {@link MailboxListener#isClosed()}
-     * when they are ready to be removed.
-     * </p>
-     * @param listener not null
-     * @throws MailboxException
-     */
-    void addListener(MailboxListener listener) throws MailboxException;
 }

Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java?rev=731341&r1=731340&r2=731341&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
(original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
Sun Jan  4 11:17:50 2009
@@ -191,4 +191,18 @@
      * @return a <code>Collection<String></code> of mailbox names
      */
     public Collection<String> subscriptions(String user) throws SubscriptionException;
+    
+    /**
+     * <p>Implementations of Mailbox may interpret the fact that someone is
+     * listening and do some caching and even postpone persistence until
+     * everyone has removed itself.
+     * </p><p>
+     * Listeners should return true from {@link MailboxListener#isClosed()}
+     * when they are ready to be removed.
+     * </p>
+     * @param mailboxName not null
+     * @param listener not null
+     * @throws MailboxException
+     */
+    void addListener(String mailboxName, MailboxListener listener) throws MailboxException;
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java?rev=731341&r1=731340&r2=731341&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
Sun Jan  4 11:17:50 2009
@@ -27,8 +27,8 @@
 
 import org.apache.james.api.imap.AbstractLogEnabled;
 import org.apache.james.api.imap.process.SelectedMailbox;
-import org.apache.james.imap.mailbox.Mailbox;
 import org.apache.james.imap.mailbox.MailboxException;
+import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.util.MailboxEventAnalyser;
 import org.apache.james.imap.mailbox.util.UidToMsnConverter;
@@ -44,7 +44,7 @@
 
     private boolean recentUidRemoved;
 
-    public SelectedMailboxImpl(final Mailbox mailbox, final List<Long> uids,
+    public SelectedMailboxImpl(final MailboxManager mailboxManager, final List<Long>
uids,
             final MailboxSession mailboxSession, final String name) throws MailboxException
{
         recentUids = new TreeSet<Long>();
         recentUidRemoved = false;
@@ -52,9 +52,9 @@
         events = new MailboxEventAnalyser(sessionId, name);
         // Ignore events from our session
         events.setSilentFlagChanges(true);
-        mailbox.addListener(events);
+        mailboxManager.addListener(name, events);
         converter = new UidToMsnConverter(uids);
-        mailbox.addListener(converter);
+        mailboxManager.addListener(name, converter);
     }
 
     /**

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/AbstractSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/AbstractSelectionProcessor.java?rev=731341&r1=731340&r2=731341&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/AbstractSelectionProcessor.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/AbstractSelectionProcessor.java
Sun Jan  4 11:17:50 2009
@@ -176,8 +176,7 @@
             throws MailboxException {
         final MailboxManager mailboxManager = getMailboxManager();
         final Mailbox mailbox = mailboxManager.getMailbox(mailboxName);
-        final MailboxSession mailboxSession = ImapSessionUtils
-                .getMailboxSession(session);
+        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
 
         final SelectedMailbox sessionMailbox;
         final SelectedMailbox currentMailbox = session.getSelected();
@@ -202,7 +201,7 @@
             final MessageResult result = (MessageResult) it.next();
             uids.add(new Long(result.getUid()));
         }
-        sessionMailbox = new SelectedMailboxImpl(mailbox, uids,
+        sessionMailbox = new SelectedMailboxImpl(getMailboxManager(), uids,
                 mailboxSession, name);
         session.selected(sessionMailbox);
         return sessionMailbox;

Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java?rev=731341&r1=731340&r2=731341&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
(original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
Sun Jan  4 11:17:50 2009
@@ -36,6 +36,7 @@
 import org.apache.james.imap.mailbox.MailboxExistsException;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxExpression;
+import org.apache.james.imap.mailbox.MailboxListener;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
 import org.apache.james.imap.mailbox.MailboxSession;
@@ -357,4 +358,9 @@
         userManager.unsubscribe(user, mailbox);
     }
 
+    public void addListener(String mailboxName, MailboxListener listener) throws MailboxException
{
+        final TorqueMailbox mailbox = doGetMailbox(mailboxName);
+        mailbox.addListener(listener);
+    }
+
 }



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


Mime
View raw message