james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r820730 - in /james/server/trunk/pop3server-function/src: main/java/org/apache/james/pop3server/ main/java/org/apache/james/pop3server/core/ test/java/org/apache/james/pop3server/
Date Thu, 01 Oct 2009 17:52:00 GMT
Author: norman
Date: Thu Oct  1 17:52:00 2009
New Revision: 820730

URL: http://svn.apache.org/viewvc?rev=820730&view=rev
Log:
Inject MailServer and UsersRepository

Modified:
    james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
    james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3HandlerConfigurationData.java
    james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Server.java
    james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
    james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
    james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3TestConfiguration.java

Modified: james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java?rev=820730&r1=820729&r2=820730&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
(original)
+++ james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
Thu Oct  1 17:52:00 2009
@@ -250,7 +250,7 @@
      * @return the trimmed input line
      * @throws IOException if an exception is generated reading in the input characters
      */
-    public final String readCommandLine() throws IOException {
+    private String readCommandLine() throws IOException {
         for (;;) try {
             String commandLine = context.getInputReader().readLine();
             if (commandLine != null) {

Modified: james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3HandlerConfigurationData.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3HandlerConfigurationData.java?rev=820730&r1=820729&r2=820730&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3HandlerConfigurationData.java
(original)
+++ james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3HandlerConfigurationData.java
Thu Oct  1 17:52:00 2009
@@ -21,9 +21,6 @@
 
 package org.apache.james.pop3server;
 
-import org.apache.james.api.user.UsersRepository;
-import org.apache.james.services.MailServer;
-
 /**
  * Provides a number of server-wide constant values to the
  * POP3Handlers
@@ -44,20 +41,6 @@
      * @return the reset length
      */
     int getResetLength();
-
-    /**
-     * Returns the MailServer interface for this service.
-     *
-     * @return the MailServer interface for this service
-     */
-    MailServer getMailServer();
-
-    /**
-     * Returns the UsersRepository for this service.
-     *
-     * @return the local users repository
-     */
-    UsersRepository getUsersRepository();
     
     boolean isStartTLSSupported();
 

Modified: james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Server.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Server.java?rev=820730&r1=820729&r2=820730&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Server.java
(original)
+++ james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Server.java
Thu Oct  1 17:52:00 2009
@@ -194,19 +194,6 @@
             return POP3Server.this.lengthReset;
         }
 
-        /**
-         * @see org.apache.james.pop3server.POP3HandlerConfigurationData#getMailServer()
-         */
-        public MailServer getMailServer() {
-            return POP3Server.this.mailServer;
-        }
-
-        /**
-         * @see org.apache.james.pop3server.POP3HandlerConfigurationData#getUsersRepository()
-         */
-        public UsersRepository getUsersRepository() {
-            return POP3Server.this.users;
-        }
 
         /**
          * @see org.apache.james.pop3server.POP3HandlerConfigurationData#isStartTLSSupported()

Modified: james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java?rev=820730&r1=820729&r2=820730&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
(original)
+++ james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
Thu Oct  1 17:52:00 2009
@@ -25,11 +25,15 @@
 import java.util.Collection;
 import java.util.List;
 
+import javax.annotation.Resource;
+
+import org.apache.james.api.user.UsersRepository;
 import org.apache.james.pop3server.CommandHandler;
 import org.apache.james.pop3server.POP3Handler;
 import org.apache.james.pop3server.POP3Response;
 import org.apache.james.pop3server.POP3Session;
 import org.apache.james.services.MailRepository;
+import org.apache.james.services.MailServer;
 import org.apache.james.util.POP3BeforeSMTPHelper;
 
 /**
@@ -38,7 +42,29 @@
 public class PassCmdHandler implements CommandHandler {
 
 	private final static String COMMAND_NAME ="PASS";
+	private UsersRepository users;
+	private MailServer mailServer;
+
 
+    /**
+     * Sets the users repository.
+     * @param users the users to set
+     */
+    @Resource(name="localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
+    }
+	
+    /**
+     * Sets the mail server.
+     * @param mailServer the mailServer to set
+     */
+    @Resource(name="James")
+    public final void setMailServer(MailServer mailServer) {
+        this.mailServer = mailServer;
+    }
+    
+    
 	/**
      * Handler method called upon receipt of a PASS command.
      * Reads in and validates the password.
@@ -49,9 +75,9 @@
         POP3Response response = null;
         if (session.getHandlerState() == POP3Handler.AUTHENTICATION_USERSET && parameters
!= null) {
             String passArg = parameters;
-            if (session.getConfigurationData().getUsersRepository().test(session.getUser(),
passArg)) {
+            if (users.test(session.getUser(), passArg)) {
                 try {
-                    MailRepository inbox = session.getConfigurationData().getMailServer().getUserInbox(session.getUser());
+                    MailRepository inbox = mailServer.getUserInbox(session.getUser());
                     if (inbox == null) {
                         throw new IllegalStateException("MailServer returned a null inbox
for "+session.getUser());
                     }

Modified: james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3ServerTest.java?rev=820730&r1=820729&r2=820730&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
(original)
+++ james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
Thu Oct  1 17:52:00 2009
@@ -105,6 +105,9 @@
         ContainerUtil.service(connectionManager, serviceManager);
         serviceManager.put(JamesConnectionManager.ROLE, connectionManager);
         m_mailServer = new MockMailServer(m_usersRepository);
+        // Phoenix loader does not understand aliases
+        serviceManager.put("James", m_mailServer);
+        serviceManager.put("localusersrepository", m_usersRepository);
         serviceManager
                 .put(MailServer.ROLE, m_mailServer);
         serviceManager.put(UsersRepository.ROLE,

Modified: james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3TestConfiguration.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3TestConfiguration.java?rev=820730&r1=820729&r2=820730&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3TestConfiguration.java
(original)
+++ james/server/trunk/pop3server-function/src/test/java/org/apache/james/pop3server/POP3TestConfiguration.java
Thu Oct  1 17:52:00 2009
@@ -20,6 +20,7 @@
 package org.apache.james.pop3server;
 
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.james.pop3server.core.CoreCmdHandlerLoader;
 import org.apache.james.test.util.Util;
 
 public class POP3TestConfiguration extends DefaultConfiguration {



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