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 rd...@apache.org on 2008/04/05 15:06:13 UTC

svn commit: r645087 - in /james/server/trunk: experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ imap-api/src/main/java/org/apache/james/api/imap/process/ phoenix-deployment/src/test/org/apache/james/experimental/im...

Author: rdonkin
Date: Sat Apr  5 06:06:13 2008
New Revision: 645087

URL: http://svn.apache.org/viewvc?rev=645087&view=rev
Log:
Removed unused methods

Removed:
    james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandlerInterface.java
Modified:
    james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
    james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
    james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/process/ImapSession.java
    james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalHostSystem.java

Modified: james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java?rev=645087&r1=645086&r2=645087&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java (original)
+++ james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java Sat Apr  5 06:06:13 2008
@@ -38,13 +38,11 @@
 import org.apache.james.imapserver.codec.encode.base.ImapResponseComposerImpl;
 
 /**
- * The handler class for IMAP connections.
- * TODO: This is a quick cut-and-paste hack from POP3Handler. This, and the ImapServer
- * should probably be rewritten from scratch.
+ * Handles IMAP connections.
  */
 public class ImapHandler
         extends AbstractJamesHandler
-        implements ImapHandlerInterface, ConnectionHandler, Poolable, ImapConstants
+        implements ConnectionHandler, Poolable, ImapConstants
 {
 
     // TODO: inject dependency
@@ -80,19 +78,6 @@
         }
     }
 
-    public void forceConnectionClose(final String message) {
-        getLogger().debug("forceConnectionClose: "+message);
-        final OutputStreamImapResponseWriter writer = new OutputStreamImapResponseWriter(outs);
-        ImapResponseComposer response = new ImapResponseComposerImpl(writer);
-        try {
-            response.byeResponse(message);
-        } catch (IOException e) {
-            getLogger().info("Write BYE failed");
-            getLogger().debug("Cannot write BYE on connection close", e);
-        }
-        endSession();
-    }
-
     /**
      * @see org.apache.james.smtpserver.SMTPSession#endSession()
      */
@@ -117,7 +102,7 @@
         // Clear user data
         try {
             if (session != null) {
-                session.closeMailbox();
+                session.logout();
             }
         } catch (Exception e) {
             getLogger().warn("Failed to close mailbox: " + e.getMessage());
@@ -140,9 +125,7 @@
                     + theConfigData.getHelloName() + " is ready.");
 
             sessionEnded = false;
-            session = new ImapSessionImpl( this,
-                                           socket.getInetAddress().getHostName(),
-                                           socket.getInetAddress().getHostAddress());
+            session = new ImapSessionImpl();
             setupLogger(session);
 
             theWatchdog.start();

Modified: james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java?rev=645087&r1=645086&r2=645087&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java (original)
+++ james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java Sat Apr  5 06:06:13 2008
@@ -33,27 +33,17 @@
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
 
 /**
- * @version $Revision: 109034 $
+ * Implements a session.
  */
 public final class ImapSessionImpl extends AbstractLogEnabled implements ImapSession, ImapConstants
 {
     private ImapSessionState state = ImapSessionState.NON_AUTHENTICATED;
     private SelectedImapMailbox selectedMailbox = null;
-
-    private final String clientHostName;
-    private final String clientAddress;
-
-    private ImapHandlerInterface handler;
     
     private final Map attributesByKey;
     
-    public ImapSessionImpl( ImapHandlerInterface handler,
-                            String clientHostName,
-                            String clientAddress )
-    {
-        this.handler = handler;
-        this.clientHostName = clientHostName;
-        this.clientAddress = clientAddress;
+    public ImapSessionImpl()
+    {
         this.attributesByKey = new ConcurrentHashMap();
     }
 
@@ -71,11 +61,6 @@
         }
         return results;
     }
-    
-    public void closeConnection(String byeMessage) {
-        closeMailbox();
-        handler.forceConnectionClose(byeMessage);
-    }
 
     public void logout()
     {
@@ -83,16 +68,6 @@
         state = ImapSessionState.LOGOUT;
     }
 
-    public String getClientHostname()
-    {
-        return clientHostName;
-    }
-
-    public String getClientIP()
-    {
-        return clientAddress;
-    }
-
     public void authenticated( )
     {
         this.state = ImapSessionState.AUTHENTICATED;
@@ -129,7 +104,6 @@
         }
         
     }
-
 
     public Object getAttribute(String key) {
         final Object result = attributesByKey.get(key);

Modified: james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/process/ImapSession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/process/ImapSession.java?rev=645087&r1=645086&r2=645087&view=diff
==============================================================================
--- james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/process/ImapSession.java (original)
+++ james/server/trunk/imap-api/src/main/java/org/apache/james/api/imap/process/ImapSession.java Sat Apr  5 06:06:13 2008
@@ -28,10 +28,6 @@
  * Encapsulates all state held for an ongoing Imap session,
  * which commences when a client first establishes a connection to the Imap
  * server, and continues until that connection is closed.
- *
- * TODO: {@link #logout()}, {@link #closeConnection(String)}, 
- * {@link #closeMailbox()} and {@link #deselect()} are too closely related
- * in function to justify separate API methods
  * @version $Revision: 109034 $
  */
 public interface ImapSession
@@ -52,22 +48,7 @@
     void logout();
 
     /**
-     * TODO: this method is not clearly 
-     * @param byeMessage
-     */
-    void closeConnection(String byeMessage);
-
-    /**
-     * @return The hostname of the connected client.
-     */
-    String getClientHostname();
-
-    /**
-     * @return The IP address of the connected client.
-     */
-    String getClientIP();
-
-    /**
+     * Gets the current client state.
      * @return Returns the current state of this session.
      */
     ImapSessionState getState();
@@ -98,11 +79,6 @@
      * @return the currently selected mailbox.
      */
     SelectedImapMailbox getSelected();
-
-    /**
-     * Closes the Mailbox
-     */
-    void closeMailbox();
 
     /**
      * Gets an attribute of this session by name.

Modified: james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalHostSystem.java
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalHostSystem.java?rev=645087&r1=645086&r2=645087&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalHostSystem.java (original)
+++ james/server/trunk/phoenix-deployment/src/test/org/apache/james/experimental/imapserver/ExperimentalHostSystem.java Sat Apr  5 06:06:13 2008
@@ -38,7 +38,6 @@
 import org.apache.james.services.User;
 import org.apache.james.services.UsersRepository;
 import org.apache.james.test.functional.imap.HostSystem;
-import org.apache.james.test.functional.imap.HostSystem.Continuation;
 import org.apache.james.test.mock.avalon.MockLogger;
 
 public class ExperimentalHostSystem implements HostSystem, UsersRepository {
@@ -227,7 +226,7 @@
         return true;
     }
     
-    class Session implements HostSystem.Session, ImapHandlerInterface
+    class Session implements HostSystem.Session
     {
         ByteBufferOutputStream out;
         ByteBufferInputStream in;
@@ -240,7 +239,7 @@
             in = new ByteBufferInputStream();
             handler = new ImapRequestHandler(decoder, processor, encoder);
             handler.enableLogging(new MockLogger());
-            session = new ImapSessionImpl(this, "localhost", "127.0.0.1");
+            session = new ImapSessionImpl();
         }
         
         public String readLine() throws Exception {



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