james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r770470 - in /james/imap/trunk: mailbox/src/main/java/org/apache/james/imap/mailbox/ processor/src/main/java/org/apache/james/imap/processor/ processor/src/test/java/org/apache/james/imap/processor/ store/src/main/java/org/apache/james/imap...
Date Thu, 30 Apr 2009 22:19:05 GMT
Author: rdonkin
Date: Thu Apr 30 22:19:04 2009
New Revision: 770470

URL: http://svn.apache.org/viewvc?rev=770470&view=rev
Log:
Subscriptions can now use just the session. IMAP-71 https://issues.apache.org/jira/browse/IMAP-71

Modified:
    james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
    james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
    james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
    james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java

Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
(original)
+++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java
Thu Apr 30 22:19:04 2009
@@ -162,33 +162,33 @@
     /**
      * Subscribes the user to the given mailbox.
      * 
-     * @param user
+     * @param session
      *            the user name, not null
      * @param mailbox
      *            the mailbox name, not null
      */
-    public void subscribe(String user, String mailbox)
+    public void subscribe(MailboxSession session, String mailbox)
             throws SubscriptionException;
 
     /**
      * Unsubscribes the user from the given mailbox.
      * 
-     * @param user
+     * @param session
      *            the user name, not null
      * @param mailbox
      *            the mailbox name, not null
      */
-    public void unsubscribe(String user, String mailbox)
+    public void unsubscribe(MailboxSession session, String mailbox)
             throws SubscriptionException;
 
     /**
      * Lists current subscriptions for the given user.
      * 
-     * @param user
+     * @param session
      *            the user name, not null
      * @return a <code>Collection<String></code> of mailbox names
      */
-    public Collection<String> subscriptions(String user) throws SubscriptionException;
+    public Collection<String> subscriptions(MailboxSession session) throws SubscriptionException;
     
     /**
      * <p>Implementations of Mailbox may interpret the fact that someone is

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
Thu Apr 30 22:19:04 2009
@@ -34,6 +34,7 @@
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxManagerProvider;
 import org.apache.james.imap.mailbox.MailboxQuery;
+import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.SubscriptionException;
 import org.apache.james.imap.message.request.LsubRequest;
 import org.apache.james.imap.message.response.LSubResponse;
@@ -88,9 +89,9 @@
     private void listSubscriptions(ImapSession session, Responder responder,
             final String referenceName, final String mailboxPattern)
             throws SubscriptionException, MailboxException {
-        final String userName = ImapSessionUtils.getUserName(session);
+        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final MailboxManager manager = getMailboxManager();
-        final Collection<String> mailboxes = manager.subscriptions(userName);
+        final Collection<String> mailboxes = manager.subscriptions(mailboxSession);
         final MailboxQuery expression = new MailboxQuery(
                 referenceName, mailboxPattern, '*', '%');
         final Collection<String> mailboxResponses = new ArrayList<String>();

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
Thu Apr 30 22:19:04 2009
@@ -29,6 +29,7 @@
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxManagerProvider;
+import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.SubscriptionException;
 import org.apache.james.imap.message.request.SubscribeRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
@@ -49,10 +50,10 @@
             String tag, ImapCommand command, Responder responder) {
         final SubscribeRequest request = (SubscribeRequest) message;
         final String mailboxName = request.getMailboxName();
-        final String userName = ImapSessionUtils.getUserName(session);
+        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
             final MailboxManager manager = getMailboxManager();
-            manager.subscribe(userName, mailboxName);
+            manager.subscribe(mailboxSession, mailboxName);
 
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
Thu Apr 30 22:19:04 2009
@@ -29,6 +29,7 @@
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxManager;
 import org.apache.james.imap.mailbox.MailboxManagerProvider;
+import org.apache.james.imap.mailbox.MailboxSession;
 import org.apache.james.imap.mailbox.SubscriptionException;
 import org.apache.james.imap.message.request.UnsubscribeRequest;
 import org.apache.james.imap.processor.base.ImapSessionUtils;
@@ -49,10 +50,10 @@
             String tag, ImapCommand command, Responder responder) {
         final UnsubscribeRequest request = (UnsubscribeRequest) message;
         final String mailboxName = request.getMailboxName();
-        final String userName = ImapSessionUtils.getUserName(session);
+        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
             final MailboxManager mailboxManager = getMailboxManager();
-            mailboxManager.unsubscribe(userName, mailboxName);
+            mailboxManager.unsubscribe(mailboxSession, mailboxName);
 
             unsolicitedResponses(session, responder, false);
             okComplete(command, tag, responder);

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
(original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
Thu Apr 30 22:19:04 2009
@@ -238,9 +238,7 @@
         checking(new Expectations() {{
             oneOf(session).getAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY);
                     will(returnValue(mailboxSession));
-            oneOf(mailboxSession).getUserName();
-                    will(returnValue(USER));
-            oneOf(manager).subscriptions(with(same(USER)));will(returnValue(subscriptions));
    
+            oneOf(manager).subscriptions(with(same(mailboxSession)));will(returnValue(subscriptions));
    
         }});
     }
 }

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
(original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
Thu Apr 30 22:19:04 2009
@@ -305,18 +305,18 @@
         return authenticator.isAuthentic(userid, passwd);
     }
 
-    public void subscribe(String user, String mailbox)
+    public void subscribe(MailboxSession session, String mailbox)
     throws SubscriptionException {
-        subscriber.subscribe(user, mailbox);
+        subscriber.subscribe(session.getUserName(), mailbox);
     }
 
-    public Collection<String> subscriptions(String user) throws SubscriptionException
{
-        return subscriber.subscriptions(user);
+    public Collection<String> subscriptions(MailboxSession session) throws SubscriptionException
{
+        return subscriber.subscriptions(session.getUserName());
     }
 
-    public void unsubscribe(String user, String mailbox)
+    public void unsubscribe(MailboxSession session, String mailbox)
     throws SubscriptionException {
-        subscriber.unsubscribe(user, mailbox);
+        subscriber.unsubscribe(session.getUserName(), mailbox);
     }
 
     public void addListener(String mailboxName, MailboxListener listener) throws MailboxException
{

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java?rev=770470&r1=770469&r2=770470&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
(original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
Thu Apr 30 22:19:04 2009
@@ -357,18 +357,18 @@
         return userManager.isAuthentic(userid, passwd);
     }
 
-    public void subscribe(String user, String mailbox)
+    public void subscribe(MailboxSession session, String mailbox)
             throws SubscriptionException {
-        userManager.subscribe(user, mailbox);
+        userManager.subscribe(session.getUserName(), mailbox);
     }
 
-    public Collection<String> subscriptions(String user) throws SubscriptionException
{
-        return userManager.subscriptions(user);
+    public Collection<String> subscriptions(MailboxSession session) throws SubscriptionException
{
+        return userManager.subscriptions(session.getUserName());
     }
 
-    public void unsubscribe(String user, String mailbox)
+    public void unsubscribe(MailboxSession session, String mailbox)
             throws SubscriptionException {
-        userManager.unsubscribe(user, mailbox);
+        userManager.unsubscribe(session.getUserName(), mailbox);
     }
 
     public void addListener(String mailboxName, MailboxListener listener) throws MailboxException
{



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