james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r382481 - in /james/server/trunk/src/java/org/apache/james: James.java remotemanager/RemoteManagerHandler.java services/MailServer.java transport/mailets/UsersRepositoryAliasingForwarding.java
Date Thu, 02 Mar 2006 19:37:50 GMT
Author: bago
Date: Thu Mar  2 11:37:48 2006
New Revision: 382481

URL: http://svn.apache.org/viewcvs?rev=382481&view=rev
Log:
UsersAliasing mailet now inherith james->user ignoreCase/enableAliases/enableForwarding
if not locally specified.
Deprecated the MailServer.addUser method in favor of UsersRepository.addUser
Both steps related to JAMES-426 and JAMES-450

Modified:
    james/server/trunk/src/java/org/apache/james/James.java
    james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
    james/server/trunk/src/java/org/apache/james/services/MailServer.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java

Modified: james/server/trunk/src/java/org/apache/james/James.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/James.java?rev=382481&r1=382480&r2=382481&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/James.java (original)
+++ james/server/trunk/src/java/org/apache/james/James.java Thu Mar  2 11:37:48 2006
@@ -808,6 +808,10 @@
      * an email address before the '@<domain>'.
      * @param password String plaintext password
      * @return boolean true if user added succesfully, else false.
+     * 
+     * @deprecated we deprecated this in the MailServer interface and this is an implementation
+     * this component depends already depends on a UsersRepository: clients could directly

+     * use the addUser of the usersRepository.
      */
     public boolean addUser(String userName, String password) {
         boolean success;

Modified: james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java?rev=382481&r1=382480&r2=382481&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java Thu
Mar  2 11:37:48 2006
@@ -145,12 +145,6 @@
     private UsersRepository users;
 
     /**
-     * Whether the local users repository should be used to store new
-     * users.
-     */
-    private boolean inLocalUsers = true;
-
-    /**
      * The reader associated with incoming commands.
      */
     private BufferedReader in;
@@ -191,7 +185,6 @@
 
         // Reset the users repository to the default.
         users = theConfigData.getUsersRepository();
-        inLocalUsers = true;
     }
 
     /**
@@ -371,7 +364,6 @@
 
         // Reset user repository
         users = theConfigData.getUsersRepository();
-        inLocalUsers = true;
 
         // Clear config data
         theConfigData = null;
@@ -466,10 +458,6 @@
                         .append(" already exists");
             String response = responseBuffer.toString();
             writeLoggedResponse(response);
-        } else if ( inLocalUsers ) {
-            // TODO: Why does the LocalUsers repository get treated differently?
-            //       What exactly is the LocalUsers repository?
-            success = theConfigData.getMailServer().addUser(username, passwd);
         } else {
             DefaultUser user = new DefaultUser(username, "SHA");
             user.setPassword(passwd);
@@ -946,11 +934,6 @@
                         .append(repositoryName)
                         .append("'.");
             writeLoggedFlushedResponse(responseBuffer.toString());
-            if ( repositoryName.equals("localusers") ) {
-                inLocalUsers = true;
-            } else {
-                inLocalUsers = false;
-            }
         }
         return true;
     }

Modified: james/server/trunk/src/java/org/apache/james/services/MailServer.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/services/MailServer.java?rev=382481&r1=382480&r2=382481&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/MailServer.java (original)
+++ james/server/trunk/src/java/org/apache/james/services/MailServer.java Thu Mar  2 11:37:48
2006
@@ -116,6 +116,10 @@
      *
      * @param sender - the name of the user
      * @return a reference to an initialised mailbox
+     * 
+     * @deprecated addUser should not be considered a property of a MailServer
+     * We could have readonly userbases providing full MailServer implementations.
+     * Look at the UsersRepository.addUser(username, password) method.
      */
     boolean addUser(String userName, String password);
 

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java?rev=382481&r1=382480&r2=382481&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
(original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
Thu Mar  2 11:37:48 2006
@@ -239,20 +239,18 @@
         try {
             usersStore = (UsersStore) compMgr.lookup(UsersStore.ROLE);
 
-            String enAliases = getInitParameter("enableAliases");
-            String enForward = getInitParameter("enableForwarding");
-            String userRep = getInitParameter("usersRepository");
-
-            if (enAliases == null || enAliases.length() == 0) {
-                enableAliases = false;
-            } else
-                enableAliases = new Boolean(enAliases).booleanValue();
-
-            if (enForward == null || enForward.length() == 0) {
-                enableForwarding = false;
-            } else
-                enableForwarding = new Boolean(enForward).booleanValue();
 
+            enableAliases = new Boolean(getInitParameter("enableAliases",
+                    getMailetContext().getAttribute(Constants.DEFAULT_ENABLE_ALIASES).toString()
+                    )).booleanValue();
+            enableForwarding = new Boolean(getInitParameter("enableForwarding",
+                    getMailetContext().getAttribute(Constants.DEFAULT_ENABLE_FORWARDING).toString()
+                    )).booleanValue();
+            ignoreCase = new Boolean(getInitParameter("ignoreCase",
+                    getMailetContext().getAttribute(Constants.DEFAULT_IGNORE_USERNAME_CASE).toString()
+                    )).booleanValue();
+            
+            String userRep = getInitParameter("usersRepository");
             if (userRep == null || userRep.length() == 0) {
                 try {
                     usersRepository = (UsersRepository) compMgr
@@ -265,8 +263,6 @@
                 usersRepository = usersStore.getRepository(userRep);
             }
 
-            ignoreCase = ((Boolean) getMailetContext().getAttribute(
-                    Constants.DEFAULT_IGNORE_USERNAME_CASE)).booleanValue();
         } catch (ServiceException cnfe) {
             log("Failed to retrieve UsersStore component:" + cnfe.getMessage());
         }



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