james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r757703 - 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/ store/src/main/java/org/apache/james/imap/s...
Date Tue, 24 Mar 2009 10:28:55 GMT
Author: rdonkin
Date: Tue Mar 24 10:28:53 2009
New Revision: 757703

URL: http://svn.apache.org/viewvc?rev=757703&view=rev
Log:
Added log to mailbox session IMAP-75 https://issues.apache.org/jira/browse/IMAP-75

Modified:
    james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java
    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/MailboxManager.java
    james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
    james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
    james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
    james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
    james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
    james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java
    james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java

Modified: james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java
(original)
+++ james/protocols/imap/trunk/jpa/src/main/java/org/apache/james/imap/jpa/JPAMailbox.java
Tue Mar 24 10:28:53 2009
@@ -44,8 +44,8 @@
 
     private final EntityManagerFactory entityManagerFactory;
 
-    public JPAMailbox(final Mailbox mailbox, final Log log, final EntityManagerFactory entityManagerfactory)
{
-        super(mailbox, log);
+    public JPAMailbox(final Mailbox mailbox, final EntityManagerFactory entityManagerfactory)
{
+        super(mailbox);
         this.entityManagerFactory = entityManagerfactory;
     }    
 

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=757703&r1=757702&r2=757703&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
Tue Mar 24 10:28:53 2009
@@ -49,7 +49,7 @@
     @Override
     protected StoreMailbox createMailbox(Mailbox mailboxRow) {
         StoreMailbox result;
-        result = new JPAMailbox(mailboxRow, getLog(), entityManagerFactory);
+        result = new JPAMailbox(mailboxRow, entityManagerFactory);
         return result;
     }
     

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=757703&r1=757702&r2=757703&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
Tue Mar 24 10:28:53 2009
@@ -22,6 +22,8 @@
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+
 
 /**
  * <p>
@@ -141,10 +143,11 @@
 
     /**
      * Creates a new session.
+     * @param log TODO
      * 
      * @return <code>MailboxSession</code>, not null
      */
-    public MailboxSession createSession();
+    public MailboxSession createSession(Log log);
 
     /**
      * Autenticates the given user against the given password.

Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
(original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java
Tue Mar 24 10:28:53 2009
@@ -19,6 +19,8 @@
 
 package org.apache.james.imap.mailbox;
 
+import org.apache.commons.logging.Log;
+
 /**
  * Mailbox session.
  */
@@ -42,4 +44,10 @@
      * Closes this session.
      */
     public void close();
+    
+    /**
+     * Gets the logger for this session context.
+     * @return not null
+     */
+    public Log getLog();
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
Tue Mar 24 10:28:53 2009
@@ -63,7 +63,7 @@
             final MailboxManager mailboxManager = getMailboxManager();
             if (mailboxManager.isAuthentic(userid, passwd)) {
                 session.authenticated();
-                final MailboxSession mailboxSession = mailboxManager.createSession();
+                final MailboxSession mailboxSession = mailboxManager.createSession(session.getLog());
                 session.setAttribute(
                         ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY,
                         mailboxSession);

Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
(original)
+++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/SimpleMailboxSession.java
Tue Mar 24 10:28:53 2009
@@ -19,6 +19,7 @@
 
 package org.apache.james.imap.store;
 
+import org.apache.commons.logging.Log;
 import org.apache.james.imap.mailbox.MailboxSession;
 
 /**
@@ -27,12 +28,19 @@
 public class SimpleMailboxSession implements MailboxSession {
 
     private final long sessionId;
+    
+    private final Log log;
 
     private boolean open;
 
-    public SimpleMailboxSession(final long sessionId) {
+    public SimpleMailboxSession(final long sessionId, final Log log) {
         super();
         this.sessionId = sessionId;
+        this.log = log;
+    }
+
+    public Log getLog() {
+        return log;
     }
 
     public void close() {

Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
(original)
+++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
Tue Mar 24 10:28:53 2009
@@ -37,8 +37,6 @@
 import javax.mail.Flags;
 import javax.mail.MessagingException;
 
-import org.apache.commons.logging.Log;
-import org.apache.james.imap.api.AbstractLogEnabled;
 import org.apache.james.imap.mailbox.MailboxException;
 import org.apache.james.imap.mailbox.MailboxListener;
 import org.apache.james.imap.mailbox.MailboxNotFoundException;
@@ -58,7 +56,7 @@
 import org.apache.james.mime4j.descriptor.MaximalBodyDescriptor;
 import org.apache.james.mime4j.parser.MimeTokenStream;
 
-public abstract class StoreMailbox extends AbstractLogEnabled implements org.apache.james.imap.mailbox.Mailbox
{
+public abstract class StoreMailbox implements org.apache.james.imap.mailbox.Mailbox {
 
     private static final int INITIAL_SIZE_FLAGS = 32;
 
@@ -68,11 +66,7 @@
 
     private final UidChangeTracker tracker;
 
-    private final MessageSearches searches;
-
-    public StoreMailbox(final Mailbox mailbox, final Log log) {
-        this.searches = new MessageSearches();
-        setLog(log);
+    public StoreMailbox(final Mailbox mailbox) {
         this.mailboxId = mailbox.getMailboxId();
         this.tracker = new UidChangeTracker(mailbox.getLastUid());
     }
@@ -413,16 +407,18 @@
         final Set<Long> uids = new TreeSet<Long>();
         for (MailboxMembership member:members) {
             try {
+                final MessageSearches searches = new MessageSearches();
+                searches.setLog(mailboxSession.getLog());
                 if (searches.isMatch(query, member)) {
                     uids.add(member.getUid());
                 }
             } catch (MailboxException e) {
-                getLog()
+                mailboxSession.getLog()
                 .info(
                         "Cannot test message against search criteria. Will continue to test
other messages.",
                         e);
-                if (getLog().isDebugEnabled())
-                    getLog().debug("UID: " + member.getUid());
+                if (mailboxSession.getLog().isDebugEnabled())
+                    mailboxSession.getLog().debug("UID: " + member.getUid());
             }
         }
 
@@ -433,11 +429,6 @@
         return true;
     }
 
-    public void setLog(Log log) {
-        super.setLog(log);
-        searches.setLog(log);
-    }
-
     public void copyTo(MessageRange set, StoreMailbox toMailbox, MailboxSession session)
throws MailboxException {
         try {
             final MessageMapper mapper = createMessageMapper();

Modified: james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
(original)
+++ james/protocols/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java
Tue Mar 24 10:28:53 2009
@@ -134,7 +134,7 @@
 
     public void deleteMailbox(String mailboxName, MailboxSession session)
     throws MailboxException {
-        getLog().info("deleteMailbox " + mailboxName);
+        session.getLog().info("deleteMailbox " + mailboxName);
         synchronized (mailboxes) {
             // TODO put this into a serilizable transaction
             final MailboxMapper mapper = createMailboxMapper();
@@ -270,8 +270,8 @@
         mailboxes.clear();
     }
 
-    public MailboxSession createSession() {
-        return new SimpleMailboxSession(random.nextLong());
+    public MailboxSession createSession(Log log) {
+        return new SimpleMailboxSession(random.nextLong(), log);
     }
 
     public String resolve(final String userName, String mailboxPath) {

Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
(original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
Tue Mar 24 10:28:53 2009
@@ -73,9 +73,7 @@
 
 import com.workingdogs.village.DataSetException;
 
-public class TorqueMailbox extends AbstractLogEnabled implements Mailbox {
-
-    private Log log;
+public class TorqueMailbox implements Mailbox {
 
     private boolean open = true;
 
@@ -87,10 +85,8 @@
 
     private final MessageSearches searches;
 
-    TorqueMailbox(final MailboxRow mailboxRow, final ReadWriteLock lock,
-            final Log log) {
+    TorqueMailbox(final MailboxRow mailboxRow, final ReadWriteLock lock) {
         this.searches = new MessageSearches();
-        setLog(log);
         this.mailboxRow = mailboxRow;
         this.tracker = new UidChangeTracker(mailboxRow.getLastUid());
         this.lock = lock;
@@ -654,12 +650,12 @@
                             uids.add(row.getUid());
                         }
                     } catch (TorqueException e) {
-                        getLog()
+                        mailboxSession.getLog()
                                 .info(
                                         "Cannot test message against search criteria. Will
continue to test other messages.",
                                         e);
-                        if (getLog().isDebugEnabled())
-                            getLog().debug("UID: " + row.getUid());
+                        if (mailboxSession.getLog().isDebugEnabled())
+                            mailboxSession.getLog().debug("UID: " + row.getUid());
                     }
                 }
 
@@ -717,12 +713,6 @@
         return true;
     }
 
-    public void setLog(Log log) {
-        super.setLog(log);
-        this.log = log;
-        searches.setLog(log);
-    }
-
     public void copyTo(MessageRange set, TorqueMailbox toMailbox,
             MailboxSession session) throws MailboxException {
         try {

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=757703&r1=757702&r2=757703&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
Tue Mar 24 10:28:53 2009
@@ -91,8 +91,7 @@
                     TorqueMailbox torqueMailbox = (TorqueMailbox) mailboxes
                             .get(mailboxName);
                     if (torqueMailbox == null) {
-                        torqueMailbox = new TorqueMailbox(mailboxRow, lock,
-                                getLog());
+                        torqueMailbox = new TorqueMailbox(mailboxRow, lock);
                         mailboxes.put(mailboxName, torqueMailbox);
                     }
 
@@ -326,8 +325,8 @@
         return log;
     }
 
-    public MailboxSession createSession() {
-        return new TorqueMailboxSession(random.nextLong());
+    public MailboxSession createSession(Log log) {
+        return new TorqueMailboxSession(random.nextLong(), log);
     }
 
     public String resolve(final String userName, String mailboxPath) {

Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java?rev=757703&r1=757702&r2=757703&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java
(original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxSession.java
Tue Mar 24 10:28:53 2009
@@ -19,6 +19,7 @@
 
 package org.apache.james.mailboxmanager.torque;
 
+import org.apache.commons.logging.Log;
 import org.apache.james.imap.mailbox.MailboxSession;
 
 /**
@@ -27,13 +28,23 @@
 public class TorqueMailboxSession implements MailboxSession {
 
     private final long sessionId;
+    
+    private final Log log;
 
     private boolean open;
 
-    public TorqueMailboxSession(final long sessionId) {
+    public TorqueMailboxSession(final long sessionId, final Log log) {
         super();
         this.sessionId = sessionId;
+        this.log = log;
     }
+    
+    
+    public Log getLog() {
+        return log;
+    }
+
+
 
     public void close() {
         open = false;



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