james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r770896 - in /james/imap/trunk: mailbox/src/main/java/org/apache/james/imap/mailbox/ processor/src/main/java/org/apache/james/imap/processor/base/ store/src/main/java/org/apache/james/imap/store/ torque/src/main/java/org/apache/james/mailbo...
Date Sat, 02 May 2009 06:21:15 GMT
Author: rdonkin
Date: Sat May  2 06:21:14 2009
New Revision: 770896

URL: http://svn.apache.org/viewvc?rev=770896&view=rev
Log:
Use an interface for user. This allows mailbox implementations to downcast to their particular
implementation. IMAP-71 https://issues.apache.org/jira/browse/IMAP-71

Modified:
    james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
    james/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.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
    james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java

Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java?rev=770896&r1=770895&r2=770896&view=diff
==============================================================================
--- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
(original)
+++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
Sat May  2 06:21:14 2009
@@ -52,8 +52,20 @@
     public Log getLog();
     
     /**
-     * Gets the name of the user executing this session.
+     * Gets the user executing this session.
      * @return not null
      */
-    public String getUserName();
+    public User getUser();
+    
+    /**
+     * A mailbox user.
+     * Useful for specialist mailbox implementation.
+     */
+    public interface User {
+        /**
+         * Gets the name of the user.
+         * @return not null
+         */
+        public String getUserName();
+    }
 }

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java?rev=770896&r1=770895&r2=770896&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
Sat May  2 06:21:14 2009
@@ -40,7 +40,7 @@
         if (imapSession == null) {
             result = null;
         } else {
-            result = mailboxSession.getUserName();
+            result = mailboxSession.getUser().getUserName();
         }
         return result;
     }

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java?rev=770896&r1=770895&r2=770896&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
(original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
Sat May  2 06:21:14 2009
@@ -25,7 +25,7 @@
 /**
  * Describes a mailbox session.
  */
-public class SimpleMailboxSession implements MailboxSession {
+public class SimpleMailboxSession implements MailboxSession, MailboxSession.User {
 
     private final long sessionId;
     
@@ -71,7 +71,15 @@
 
         return retValue;
     }
-
+    
+    /**
+     * Gets the user executing this session.
+     * @return not null
+     */
+    public User getUser() {
+        return this;
+    }
+    
     /**
      * Gets the name of the user executing this session.
      * @return not null

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=770896&r1=770895&r2=770896&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
Sat May  2 06:21:14 2009
@@ -307,16 +307,16 @@
 
     public void subscribe(MailboxSession session, String mailbox)
     throws SubscriptionException {
-        subscriber.subscribe(session.getUserName(), mailbox);
+        subscriber.subscribe(session.getUser().getUserName(), mailbox);
     }
 
     public Collection<String> subscriptions(MailboxSession session) throws SubscriptionException
{
-        return subscriber.subscriptions(session.getUserName());
+        return subscriber.subscriptions(session.getUser().getUserName());
     }
 
     public void unsubscribe(MailboxSession session, String mailbox)
     throws SubscriptionException {
-        subscriber.unsubscribe(session.getUserName(), mailbox);
+        subscriber.unsubscribe(session.getUser().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=770896&r1=770895&r2=770896&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
Sat May  2 06:21:14 2009
@@ -359,16 +359,16 @@
 
     public void subscribe(MailboxSession session, String mailbox)
             throws SubscriptionException {
-        userManager.subscribe(session.getUserName(), mailbox);
+        userManager.subscribe(session.getUser().getUserName(), mailbox);
     }
 
     public Collection<String> subscriptions(MailboxSession session) throws SubscriptionException
{
-        return userManager.subscriptions(session.getUserName());
+        return userManager.subscriptions(session.getUser().getUserName());
     }
 
     public void unsubscribe(MailboxSession session, String mailbox)
             throws SubscriptionException {
-        userManager.unsubscribe(session.getUserName(), mailbox);
+        userManager.unsubscribe(session.getUser().getUserName(), mailbox);
     }
 
     public void addListener(String mailboxName, MailboxListener listener) throws MailboxException
{

Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java?rev=770896&r1=770895&r2=770896&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java
(original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java
Sat May  2 06:21:14 2009
@@ -25,7 +25,7 @@
 /**
  * Describes a mailbox session.
  */
-public class TorqueMailboxSession implements MailboxSession {
+public class TorqueMailboxSession implements MailboxSession, MailboxSession.User {
 
     private final long sessionId;
     
@@ -76,6 +76,13 @@
         return retValue;
     }
 
+    /**
+     * Gets the user executing this session.
+     * @return not null
+     */
+    public User getUser() {
+        return this;
+    }
 
     /**
      * Gets the name of the user executing this session.



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