james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1049943 - in /james/server/trunk: container-spring/src/main/config/examples/ container-spring/src/main/config/james/ container-spring/src/main/config/james/context/ mailets/src/main/java/org/apache/james/transport/mailets/ mailets/src/main...
Date Thu, 16 Dec 2010 12:09:51 GMT
Author: norman
Date: Thu Dec 16 12:09:50 2010
New Revision: 1049943

URL: http://svn.apache.org/viewvc?rev=1049943&view=rev
Log:
Remove UsersStore, this also means we remove the mailinglist support for now. See JAMES-1150

Added:
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersRepository.java
      - copied, changed from r1049797, james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersStore.java
Removed:
    james/server/trunk/container-spring/src/main/config/examples/james-listmanager.xml
    james/server/trunk/container-spring/src/main/config/examples/miResources.xml
    james/server/trunk/container-spring/src/main/config/james/james-listmanager.xml
    james/server/trunk/container-spring/src/main/config/james/miResources.xml
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AvalonListserv.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AvalonListservManager.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/CommandListservFooter.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/CommandListservManager.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/CommandListservProcessor.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/GenericListserv.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/GenericListservManager.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/ICommandListservManager.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/JDBCListserv.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/listservcommands/
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UserCmdHandler.java
    james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UsersStore.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersStore.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalJamesUsersRepository.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalUsersRepository.java
    james/server/trunk/user-library/src/test/java/org/apache/james/user/lib/MockUsersStore.java
Modified:
    james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CoreCmdHandlerLoader.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/DelUserCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/SetPasswordCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowAliasCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowForwardingCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetAliasCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetForwardingCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/VerifyCmdHandler.java
    james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java
    james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java
    james/server/trunk/user-library/src/test/java/org/apache/james/user/lib/UserManagementTest.java

Modified: james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml Thu Dec 16 12:09:50 2010
@@ -54,7 +54,6 @@
                 <entry key="mailetloader" value="mailetcontainer"/>
                 <entry key="matcherloader" value="mailetcontainer"/>
                 <entry key="mailetcontext" value="mailetcontainer"/>
-                <entry key="usersstore" value="usersrepository"/>
              </map>
         </property>
     </bean>
@@ -77,7 +76,6 @@
                 <entry key="mailspooler" value="mailetcontainer"/>
                 <entry key="mailetloader" value="mailetcontainer"/>
                 <entry key="matcherloader" value="mailetcontainer"/>
-                <entry key="usersstore" value="usersrepository"/>
             </map>
         </property>
     </bean>
@@ -219,10 +217,7 @@
     <!-- 
       Users
      -->
-    <bean id="usersstore" class="org.apache.james.user.lib.JamesUsersStore" >
-        <property name="defaultRepository" value="LocalUsers"/>
-    </bean>
-    <bean id="localusersrepository" class="org.apache.james.user.lib.LocalUsersRepository" />
+    <bean id="usersrepository" name="localusersrepository" class="org.apache.james.user.lib.JamesUsersRepository"/>
     <bean id="virtualusertable" class="org.apache.james.vut.lib.JamesVirtualUserTable" />
 
     <!-- 
@@ -236,11 +231,6 @@
     <bean id="mailstore" class="org.apache.james.mailstore.lib.JamesMailStore" />
 
     <!-- 
-      Mailstore Import 2.3
-      INFO: This sections still needs to be completed with beans responsible to import James 2.3 mailstore.
-     -->
-          
-    <!-- 
       Mailbox
      -->
     <bean id="mailboxmanager" parent="jpa-mailboxmanager" />

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java Thu Dec 16 12:09:50 2010
@@ -23,7 +23,6 @@ package org.apache.james.transport.maile
 
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailetConfig;
@@ -57,8 +56,6 @@ public class LocalDelivery extends Gener
     
     private UsersRepository usersRepository;
 
-    private UsersStore usersStore;
-
 
     private MailboxManager mailboxManager;
 
@@ -70,11 +67,6 @@ public class LocalDelivery extends Gener
     }
     
     
-    @Resource(name="usersstore")
-    public void setUsersStore(UsersStore usersStore) {
-        this.usersStore = usersStore;
-    }
-    
     
 
     @Resource(name="mailboxmanager")
@@ -115,7 +107,6 @@ public class LocalDelivery extends Gener
         
         aliasingMailet = new UsersRepositoryAliasingForwarding();
         aliasingMailet.setUsersRepository(usersRepository);
-        aliasingMailet.setUsersStore(usersStore);
         aliasingMailet.init(getMailetConfig());
         sieveMailet = new SieveMailet();
         MailetConfig m = new MailetConfig() {

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java Thu Dec 16 12:09:50 2010
@@ -29,7 +29,6 @@ import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 import org.apache.james.vut.api.VirtualUserTable;
 import org.apache.james.vut.api.VirtualUserTable.ErrorMappingException;
 import org.apache.mailet.MailAddress;
@@ -46,8 +45,6 @@ import org.apache.mailet.MailAddress;
  * <enableForwarding>true</enableForwarding>: enable the forwarding. Default to
  * false.
  * 
- * <usersRepository>LocalAdmins</usersRepository>: specific users repository
- * name. Default to empty. If empty does lookup the default userRepository.
  * 
  * @deprecated use org.apache.james.transport.mailets.VirtualUserTable
  * 
@@ -60,7 +57,6 @@ public class UsersRepositoryAliasingForw
      * inboxes on this server.
      */
     private UsersRepository usersRepository;
-    private UsersStore usersStore;
 
     /**
      * Return a string describing this mailet.
@@ -75,12 +71,7 @@ public class UsersRepositoryAliasingForw
     public void setUsersRepository(UsersRepository usersRepository) {
         this.usersRepository = usersRepository;
     }
-    
-    @Resource(name="usersstore")
-    public void setUsersStore(UsersStore usersStore) {
-        this.usersStore = usersStore;
-    }
-    
+
     /**
      * Return null when the mail should be GHOSTed, the username string when it
      * should be changed due to the ignoreUser configuration.
@@ -131,16 +122,4 @@ public class UsersRepositoryAliasingForw
     }
 
     
-    /**
-     * @see org.apache.mailet.GenericMailet#init()
-     */
-    public void init() throws MessagingException {
-        super.init();
-        String userRep = getInitParameter("usersRepository");
-        if (userRep != null && userRep.length() > 0) {
-            usersRepository = usersStore.getRepository(userRep);
-        }
-
-    }
-
 }

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -34,7 +34,6 @@ import org.apache.james.remotemanager.Co
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * Handler method called upon receipt of an ADDUSER command.
@@ -44,8 +43,6 @@ public class AddUserCmdHandler implement
     private final static String COMMAND_NAME = "ADDUSER";
     private CommandHelp help = new CommandHelp("adduser [username] [password]","add a new user");
 
-    private UsersStore uStore;
-
     private DomainList domList;
 
     @Resource(name="domainlist")
@@ -53,13 +50,17 @@ public class AddUserCmdHandler implement
         this.domList = domList;
     }
     
+    private UsersRepository users;
+
     /**
-     * Sets the users store.
-     * @param users the users to set
+     * Sets the users repository.
+     * 
+     * @param users
+     *            the users to set
      */
-    @Resource(name="usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
     
 
@@ -90,8 +91,6 @@ public class AddUserCmdHandler implement
             response = new RemoteManagerResponse("Usage: " + getHelp().getSyntax());
             return response;
         }
-        UsersRepository users = uStore.getRepository((String)session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
-
         boolean success = false;
         if (users.contains(username)) {
             StringBuilder responseBuffer =

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CoreCmdHandlerLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CoreCmdHandlerLoader.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CoreCmdHandlerLoader.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CoreCmdHandlerLoader.java Thu Dec 16 12:09:50 2010
@@ -47,7 +47,6 @@ public class CoreCmdHandlerLoader implem
     private final static String UNKNOWNCMDHANDLER = UnknownCmdHandler.class.getName();
     private final static String UNSETALIASCMDHANDLER = UnsetAliasCmdHandler.class.getName();
     private final static String UNSETFORWARDINGCMDHANDLER = UnsetForwardingCmdHandler.class.getName();
-    private final static String USERCMDHANDLER = UserCmdHandler.class.getName();
     private final static String VERIFYCMDHANDLER = VerifyCmdHandler.class.getName();
     private final static String COMMANDDISPATCHER = RemoteManagerCommandDispatcherLineHandler.class.getName();
     private final static String AUTHORIZATIONHANDLER = AuthorizationHandler.class.getName();
@@ -78,7 +77,6 @@ public class CoreCmdHandlerLoader implem
         commands.add(UNKNOWNCMDHANDLER);
         commands.add(UNSETALIASCMDHANDLER);
         commands.add(UNSETFORWARDINGCMDHANDLER);
-        commands.add(USERCMDHANDLER);
         commands.add(VERIFYCMDHANDLER);
 
         

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -28,7 +28,6 @@ import org.apache.james.protocols.api.Re
 import org.apache.james.remotemanager.CommandHelp;
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
-import org.apache.james.user.api.UsersRepository;
 
 public class CountUsersCmdHandler extends ListUsersCmdHandler{
 
@@ -51,7 +50,6 @@ public class CountUsersCmdHandler extend
     public Response onCommand(RemoteManagerSession session, Request request) {      
     	RemoteManagerResponse response;
         String parameters = request.getArgument();
-        UsersRepository users = uStore.getRepository(((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY)));
         System.out.println("users " +users);
         if (parameters == null) {
             response = new RemoteManagerResponse("Existing accounts " + users.countUsers());

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/DelUserCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/DelUserCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/DelUserCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/DelUserCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -33,7 +33,6 @@ import org.apache.james.remotemanager.Co
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * Handler called upon receipt of an DELUSER command.
@@ -42,20 +41,19 @@ public class DelUserCmdHandler implement
 
     private final static String COMMAND_NAME = "DELUSER";
     private CommandHelp help = new CommandHelp("deluser [username]", "delete existing user");
-
-    private UsersStore uStore;
+   
+    private UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
-
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -76,7 +74,6 @@ public class DelUserCmdHandler implement
             response = new RemoteManagerResponse("Usage: " + help.getSyntax());
             return response;
         } else {
-            UsersRepository users = uStore.getRepository(((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY)));
             if (users.contains(user)) {
                 try {
                     users.removeUser(user);

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -33,26 +33,24 @@ import org.apache.james.remotemanager.Co
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 public class ListUsersCmdHandler implements CommandHandler{
 
     private final static String COMMAND_NAME = "LISTUSERS";
     private CommandHelp help = new CommandHelp("listusers","display existing accounts");
 
-    protected UsersStore uStore;
+    protected UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
-
     
     /**
     
@@ -70,7 +68,6 @@ public class ListUsersCmdHandler impleme
     public Response onCommand(RemoteManagerSession session, Request request) {
         RemoteManagerResponse response;
         String parameters = request.getArgument();
-        UsersRepository users = uStore.getRepository(((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY)));
 
         if (parameters == null) {
             response = new RemoteManagerResponse("Existing accounts " + users.countUsers());

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/SetPasswordCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/SetPasswordCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/SetPasswordCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/SetPasswordCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -34,7 +34,6 @@ import org.apache.james.remotemanager.Re
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.User;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 
 /**
@@ -45,19 +44,19 @@ public class SetPasswordCmdHandler imple
     private final static String COMMAND_NAME = "SETPASSWORD";
     private CommandHelp help = new CommandHelp("setpassword [username] [password]","sets a user's password");
 
-    private UsersStore uStore;
+    private UsersRepository users;
 
-    
     /**
-     * Sets the users store.
-     * @param users the users to set
+     * Sets the users repository.
+     * 
+     * @param users
+     *            the users to set
      */
-    @Resource(name="usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
     
-    
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -87,7 +86,6 @@ public class SetPasswordCmdHandler imple
             return response;
         }
         
-        UsersRepository users = uStore.getRepository((String)session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
 
         
         User user = users.getUserByName(username);

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowAliasCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowAliasCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowAliasCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowAliasCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -34,7 +34,6 @@ import org.apache.james.remotemanager.Re
 import org.apache.james.user.api.JamesUser;
 import org.apache.james.user.api.User;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * Handler called upon receipt of an SHOWALIAS command.
@@ -45,17 +44,17 @@ public class ShowAliasCmdHandler impleme
     private final static String COMMAND_NAME = "SHOWALIAS";
     private CommandHelp help = new CommandHelp("showalias [username]","shows a user's current email alias");
 
-    private UsersStore uStore;
+    private UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
     
     /**
@@ -77,8 +76,6 @@ public class ShowAliasCmdHandler impleme
             return response;
         }
 
-        UsersRepository users = uStore.getRepository((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
-
         User baseuser = users.getUserByName(parameters);
         if (baseuser == null) {
             response = new RemoteManagerResponse("No such user " + parameters);

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowForwardingCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowForwardingCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowForwardingCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ShowForwardingCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -34,7 +34,6 @@ import org.apache.james.remotemanager.Re
 import org.apache.james.user.api.JamesUser;
 import org.apache.james.user.api.User;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 import org.apache.mailet.MailAddress;
 
 /**
@@ -46,19 +45,18 @@ public class ShowForwardingCmdHandler im
     private final static String COMMAND_NAME = "SHOWFORWARDING";
     private CommandHelp help = new CommandHelp("showforwarding [username]","shows a user's current email forwarding");
 
-    private UsersStore uStore;
+    private UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
-    
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -78,8 +76,6 @@ public class ShowForwardingCmdHandler im
             return response;
         }
 
-        UsersRepository users = uStore.getRepository((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
-
         
         // Verify user exists
         User baseuser = users.getUserByName(parameters);

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetAliasCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetAliasCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetAliasCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetAliasCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -33,7 +33,6 @@ import org.apache.james.remotemanager.Re
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.JamesUser;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * Handler called upon receipt of an UNSETALIAS command.
@@ -42,19 +41,18 @@ public class UnsetAliasCmdHandler implem
     public final static String COMMAND_NAME = "UNSETALIAS";
     private CommandHelp help = new CommandHelp("unsetalias [user]","unsets an alias for 'user'");
 
-    private UsersStore uStore;
+    private UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
-    
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -74,8 +72,6 @@ public class UnsetAliasCmdHandler implem
             response = new RemoteManagerResponse("Usage: " + help.getSyntax());
             return response;
         }
-        UsersRepository users = uStore.getRepository((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
-
         String username = parameters;
         JamesUser user = (JamesUser) users.getUserByName(username);
         if (user == null) {

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetForwardingCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetForwardingCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetForwardingCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/UnsetForwardingCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -33,7 +33,6 @@ import org.apache.james.remotemanager.Re
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.JamesUser;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * Handler called upon receipt of an UNSETFORWARDING command.
@@ -43,19 +42,18 @@ public class UnsetForwardingCmdHandler i
     private final static String COMMAND_NAME = "UNSETFORWARDING";
     private CommandHelp help = new CommandHelp("unsetforwarding [username]","removes a forward");
 
-    private UsersStore uStore;
+    private UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
-    
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -74,7 +72,6 @@ public class UnsetForwardingCmdHandler i
             response = new RemoteManagerResponse("Usage: " + help.getSyntax());
             return response;
         }
-        UsersRepository users = uStore.getRepository((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
         String username = parameters;
         JamesUser user = (JamesUser) users.getUserByName(username);
         if (user == null) {

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/VerifyCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/VerifyCmdHandler.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/VerifyCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/VerifyCmdHandler.java Thu Dec 16 12:09:50 2010
@@ -32,7 +32,6 @@ import org.apache.james.remotemanager.Co
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * Handler method called upon receipt of an VERIFY command.
@@ -40,20 +39,19 @@ import org.apache.james.user.api.UsersSt
 public class VerifyCmdHandler implements CommandHandler{
     private final static String COMMAND_NAME = "VERIFY";
     private CommandHelp help = new CommandHelp("verify [username]","verify if specified user exist");
-
-    private UsersStore uStore;
+    private UsersRepository users;
 
     /**
-     * Sets the users store.
+     * Sets the users repository.
      * 
      * @param users
      *            the users to set
      */
-    @Resource(name = "usersstore")
-    public final void setUsers(UsersStore uStore) {
-        this.uStore = uStore;
+    @Resource(name = "localusersrepository")
+    public final void setUsers(UsersRepository users) {
+        this.users = users;
     }
-    
+
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -72,7 +70,6 @@ public class VerifyCmdHandler implements
             response = new RemoteManagerResponse("Usage: verify [username]");
             return response;
         }
-        UsersRepository users = uStore.getRepository((String) session.getState().get(RemoteManagerSession.CURRENT_USERREPOSITORY));
         if (users.contains(user)) {
             StringBuilder responseBuffer =
                 new StringBuilder(64)

Modified: james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java (original)
+++ james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java Thu Dec 16 12:09:50 2010
@@ -46,7 +46,6 @@ import org.apache.james.domainlist.api.S
 import org.apache.james.lifecycle.LifecycleUtil;
 import org.apache.james.mailstore.MockMailStore;
 import org.apache.james.user.lib.MockUsersRepository;
-import org.apache.james.user.lib.MockUsersStore;
 import org.apache.james.util.InternetPrintWriter;
 import org.apache.james.util.TestUtil;
 import org.apache.james.vut.lib.MockVirtualUserTableManagementImpl;
@@ -60,7 +59,6 @@ public abstract class AbstractRemoteMana
 	private TelnetClient m_telnetClient;
 	private MockUsersRepository m_mockUsersRepository;
 	private MockJSR250Loader serviceManager;
-	private MockUsersStore usersStore;
 	protected DNSService dnsservice;
 	protected MockFileSystem filesystem;
 	private MockVirtualUserTableManagementImpl vutManagement;
@@ -165,10 +163,6 @@ public abstract class AbstractRemoteMana
 		m_mockUsersRepository = new MockUsersRepository();
 		serviceManager.put("localusersrepository", m_mockUsersRepository);
 
-
-		usersStore = new MockUsersStore(m_mockUsersRepository);
-		serviceManager.put("usersstore", usersStore);
-
 		
 		filesystem = new MockFileSystem();
 		serviceManager.put("filesystem", filesystem);

Modified: james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java (original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java Thu Dec 16 12:09:50 2010
@@ -35,53 +35,44 @@ public interface UserManagementMBean {
      *
      * @param userName The name of the user being added
      * @param password The password of the user being added
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
+
      * @return if the operation was successful
      */
-    boolean addUser(String userName, String password, String repositoryName);
+    boolean addUser(String userName, String password);
 
     /**
      * Deletes a user from this mail server.
      *
      *
      * @param userName The name of the user being deleted
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return if the operation was successful
      */
-    boolean deleteUser(String userName, String repositoryName);
+    boolean deleteUser(String userName);
 
     /**
      * Check if a user exists with the given name.
      *
      *
      * @param userName The name of the user
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return TRUE, if the user exists
      */
-    boolean verifyExists(String userName, String repositoryName);
+    boolean verifyExists(String userName);
 
     /**
      * Total count of existing users
      *
      *
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return Total count of existing users
      */
-    long countUsers(String repositoryName);
+    long countUsers();
 
     /**
      * List the names of all users
      *
      *
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return List of all user names
      */
-    String[] listAllUsers(String repositoryName);
+    String[] listAllUsers();
 
     /**
      * Set a user's password
@@ -89,73 +80,54 @@ public interface UserManagementMBean {
      *
      * @param userName The name of the user whose password will be changed
      * @param password The new password 
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return if the user has been found and the password was changed successfully
      */
-    boolean setPassword(String userName, String password, String repositoryName);
+    boolean setPassword(String userName, String password);
 
     /**
      * Removes a user's alias which terminates local mail forwarding
      *
      *
      * @param userName The name of the user whose alias is unset
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return if the user has been found and the alias was removed
      */
     @Deprecated
-    boolean unsetAlias(String userName, String repositoryName);
+    boolean unsetAlias(String userName);
 
     /**
      * Retrieves the user's alias, if set
      *
      *
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return User's alias, or NULL, if no alias is set
      */
     @Deprecated
-    String getAlias(String userName, String repositoryName) ;
+    String getAlias(String userName) ;
 
     /**
      * Removes a user's forward email address which terminates remote mail forwarding
      *
      *
      * @param userName The name of the user whose forward is unset
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return if the user has been found and the forward was removed
      */
     @Deprecated
-    boolean unsetForwardAddress(String userName, String repositoryName);
+    boolean unsetForwardAddress(String userName);
 
     /**
      * Retrieves the user's forward, if set
      *
      *
      * @param userName The name of the user whose forward is set
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return User's forward email address, or NULL, if no forward is set
      */
     @Deprecated
-    String getForwardAddress(String userName, String repositoryName);
+    String getForwardAddress(String userName);
+
 
-    /**
-     * Retrieves a list of the names of all available user repositories
-     *
-     *
-     * @return List<String> of repository names
-     */
-    List<String> getUserRepositoryNames();
-    
     /**
      * Return true if the UserRepository has VirtualHosting enabled
      * 
-     * @param repositoryName The user repository, to which the operation should be applied. If NULL, the LocalUsers
-     *        repository is used.
      * @return virtual
      */
-    public boolean getVirtualHostingEnabled(String repositoryName);
+    public boolean getVirtualHostingEnabled();
 }

Copied: james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersRepository.java (from r1049797, james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersStore.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersRepository.java?p2=james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersRepository.java&p1=james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersStore.java&r1=1049797&r2=1049943&rev=1049943&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersStore.java (original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersRepository.java Thu Dec 16 12:09:50 2010
@@ -18,10 +18,9 @@
  ****************************************************************/
 package org.apache.james.user.lib;
 
-import java.util.Collections;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import javax.annotation.PostConstruct;
@@ -33,23 +32,22 @@ import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.LogEnabled;
 import org.apache.james.services.InstanceFactory;
+import org.apache.james.user.api.User;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 /**
  * UsersStore implementation which will parse the configuration file for users-store and add every configured repository 
  *
  */
-public class JamesUsersStore implements UsersStore ,Configurable, LogEnabled{
-
-    private String defaultName;
+public class JamesUsersRepository implements UsersRepository ,org.apache.james.user.api.JamesUsersRepository, Configurable, LogEnabled{
 
     protected Log log;
 
-    protected final Map<String, UsersRepository> objects = Collections.synchronizedMap(new HashMap<String, UsersRepository>());
     private InstanceFactory factory;
     private HierarchicalConfiguration config;
 
+    private UsersRepository repos;
+
   
     @Resource(name="instanceFactory")
     public void setInstanceFactory(InstanceFactory factory) {
@@ -68,61 +66,192 @@ public class JamesUsersStore implements 
     @SuppressWarnings("unchecked")
     public void init() throws Exception {
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
-        List<HierarchicalConfiguration> repConfs = config.configurationsAt("repository");
-        for (int i = 0; i < repConfs.size(); i++) {
-            final HierarchicalConfiguration repConf = repConfs.get(i);
-            String repName = repConf.getString("[@name]", null);
-            String repClass = repConf.getString("[@class]");
-
-            if (repName == null) {
-                repName = repClass;
-            }
-            
-            if (log.isDebugEnabled()) {
-                log.debug("Starting " + repClass);
-            }
-                        
-            
-            objects.put(repName, (UsersRepository) factory.newInstance(loader.loadClass(repClass), log, repConf));
-            
-            if (log.isInfoEnabled()) {
-                StringBuffer logBuffer = new StringBuffer(64).append("Bean  ").append(repName).append(" started.");
-                log.info(logBuffer.toString());
-            }
+        HierarchicalConfiguration repConf = config.configurationAt("repository");
+        String repName = repConf.getString("[@name]", null);
+        String repClass = repConf.getString("[@class]");
+
+        if (repName == null) {
+            repName = repClass;
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("Starting " + repClass);
+        }
+
+        repos = (UsersRepository)factory.newInstance(loader.loadClass(repClass), log, repConf);
+
+        if (log.isInfoEnabled()) {
+            StringBuffer logBuffer = new StringBuffer(64).append("Bean  ").append(repName).append(" started.");
+            log.info(logBuffer.toString());
         }
    
     }
-    
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.james.api.user.UsersStore#getRepository(java.lang.String)
-     */
-    public UsersRepository getRepository(String name) {
-        if (name == null || name.trim().equals("")) {
-            name = defaultName;
-        }
+    public boolean addUser(User user) {
+        return repos.addUser(user);
+    }
+
+    public void addUser(String name, Object attributes) {
+        repos.addUser(name, attributes);
+    }
+
+    public boolean addUser(String username, String password) {
+        return repos.addUser(username, password);
+    }
+
+    public User getUserByName(String name) {
+        return repos.getUserByName(name);
+    }
+
+    public User getUserByNameCaseInsensitive(String name) {
+        return repos.getUserByNameCaseInsensitive(name);
+    }
+
+    public String getRealName(String name) {
+        return repos.getRealName(name);
+    }
+
+    public boolean updateUser(User user) {
+        return repos.updateUser(user);
+    }
+
+    public void removeUser(String name) {
+        repos.removeUser(name);
+    }
+
+    public boolean contains(String name) {
+        return repos.contains(name);
+    }
+
+    public boolean containsCaseInsensitive(String name) {
+        return repos.containsCaseInsensitive(name);
+    }
+
+    public boolean test(String name, String password) {
+        return repos.test(name, password);
+
+    }
 
-        UsersRepository response = objects.get(name);
+    public int countUsers() {
+        return repos.countUsers();
 
-        if ((response == null) && (log.isWarnEnabled())) {
-            log.warn("No users repository called: " + name);
+    }
+
+    public Iterator<String> list() {
+        return repos.list();
+    }
+
+    public boolean supportVirtualHosting() {
+        return repos.supportVirtualHosting();
+    }
+
+    public Collection<String> getMappings(String user, String domain) throws ErrorMappingException {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).getMappings(user, domain);
         }
-        return response;
+        return null;
+    }
+
+    public boolean addRegexMapping(String user, String domain, String regex) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).addRegexMapping(user, domain,regex);
+        }        
+        return false;
+    }
+
+    public boolean removeRegexMapping(String user, String domain, String regex) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).removeRegexMapping(user, domain,regex);
+        }        
+        return false;
+    }
+
+    public boolean addAddressMapping(String user, String domain, String address) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).addAddressMapping(user, domain, address);
+        }        
+        return false;
+    }
+
+    public boolean removeAddressMapping(String user, String domain, String address) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).removeAddressMapping(user, domain, address);
+        }        
+        return false;
+    }
+
+    public boolean addErrorMapping(String user, String domain, String error) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).addErrorMapping(user, domain, error);
+        }        
+        return false;
+    }
+
+    public boolean removeErrorMapping(String user, String domain, String error) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).removeErrorMapping(user, domain, error);
+        }        
+        return false;
+    }
+
+    public Collection<String> getUserDomainMappings(String user, String domain) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).getUserDomainMappings(user, domain);
+        }        
+        return null;
+    }
+
+    public boolean addMapping(String user, String domain, String mapping) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).addMapping(user, domain, mapping);
+        }        
+        return false;
+    }
+
+    public boolean removeMapping(String user, String domain, String mapping) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).removeMapping(user, domain, mapping);
+        }        
+        return false;
+    }
+
+    public Map<String, Collection<String>> getAllMappings() {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).getAllMappings();
+        }        
+        return new HashMap<String, Collection<String>>();
+    }
+
+    public boolean addAliasDomainMapping(String aliasDomain, String realDomain) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).addAliasDomainMapping(aliasDomain, realDomain);
+        }        
+        return false;
+    }
+
+    public boolean removeAliasDomainMapping(String aliasDomain, String realDomain) {
+        if (repos instanceof JamesUsersRepository) {
+            return ((org.apache.james.user.api.JamesUsersRepository) repos).removeAliasDomainMapping(aliasDomain, realDomain);
+        }        
+        return false;
+    }
+
+    public void setEnableAliases(boolean enableAliases) {
+        if (repos instanceof JamesUsersRepository) {
+            ((org.apache.james.user.api.JamesUsersRepository) repos).setEnableAliases(enableAliases);
+        }        
     }
 
-    public void setDefaultRepository(String defaultName) {
-        this.defaultName = defaultName;
+    public void setEnableForwarding(boolean enableForwarding) {
+        if (repos instanceof JamesUsersRepository) {
+            ((org.apache.james.user.api.JamesUsersRepository) repos).setEnableForwarding(enableForwarding);
+        }  
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.james.api.user.UsersStore#getRepositoryNames()
-     */
-    public Iterator<String> getRepositoryNames() {
-        return objects.keySet().iterator();
+    public void setIgnoreCase(boolean ignoreCase) {
+        if (repos instanceof JamesUsersRepository) {
+            ((org.apache.james.user.api.JamesUsersRepository) repos).setIgnoreCase(ignoreCase);
+        }  
     }
 
 }

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java (original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java Thu Dec 16 12:09:50 2010
@@ -34,7 +34,6 @@ import org.apache.james.user.api.JamesUs
 import org.apache.james.user.api.User;
 import org.apache.james.user.api.UserManagementMBean;
 import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersStore;
 
 public class UserManagement extends StandardMBean implements UserManagementMBean {
     
@@ -42,162 +41,142 @@ public class UserManagement extends Stan
      * The administered UsersRepository
      */
     private UsersRepository localUsers;
-    private UsersStore usersStore;
 
     @Resource(name="localusersrepository")
     public void setUsersRepository(UsersRepository localUsers) {
         this.localUsers = localUsers;
     }
     
-    @Resource(name="usersstore")
-    public void setUsersStore(UsersStore usersStore) {
-        this.usersStore = usersStore;
-    }
-
     
     public UserManagement() throws NotCompliantMBeanException {
         super(UserManagementMBean.class);
     }
 
 
-    private JamesUser getJamesUser(String userName, String repositoryName) {
-        User baseuser = getUserRepository(repositoryName).getUserByName(userName);
+    private JamesUser getJamesUser(String userName) {
+        User baseuser = localUsers.getUserByName(userName);
         if (baseuser == null) throw new IllegalArgumentException("user not found: " + userName);
         if (! (baseuser instanceof JamesUser ) ) throw new IllegalArgumentException("user is not of type JamesUser: " + userName);
 
         return (JamesUser) baseuser;
     }
 
-    private UsersRepository getUserRepository(String repositoryName) {
-        if (repositoryName == null) return localUsers; // return default
-
-        if (usersStore == null) throw new IllegalArgumentException("cannot access user repository named " + repositoryName);
-
-        UsersRepository repository = usersStore.getRepository(repositoryName);
-        if (repository == null) throw new IllegalArgumentException("user repository does not exist: " + repositoryName);
-        
-        return repository;
-    }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#addUser(java.lang.String, java.lang.String, java.lang.String)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#addUser(java.lang.String, java.lang.String)
      */
-    public boolean addUser(String userName, String password, String repositoryName) {
-        return getUserRepository(repositoryName).addUser(userName, password);
+    public boolean addUser(String userName, String password) {
+        return localUsers.addUser(userName, password);
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#deleteUser(java.lang.String, java.lang.String)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#deleteUser(java.lang.String)
      */
-    public boolean deleteUser(String userName, String repositoryName) {
-        UsersRepository users = getUserRepository(repositoryName);
-        if (!users.contains(userName)) return false;
-        users.removeUser(userName);
+    public boolean deleteUser(String userName) {
+        if (!localUsers.contains(userName)) return false;
+        localUsers.removeUser(userName);
         return true;
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#verifyExists(java.lang.String, java.lang.String)
+    /*
+     * /(non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#verifyExists(java.lang.String)
      */
-    public boolean verifyExists(String userName, String repositoryName) {
-        UsersRepository users = getUserRepository(repositoryName);
-        return users.contains(userName);
+    public boolean verifyExists(String userName) {
+        return localUsers.contains(userName);
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#countUsers(java.lang.String)
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#countUsers()
      */
-    public long countUsers(String repositoryName) {
-        UsersRepository users = getUserRepository(repositoryName);
-        return users.countUsers();
+    public long countUsers() {
+        return localUsers.countUsers();
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#listAllUsers(java.lang.String)
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#listAllUsers()
      */
-    public String[] listAllUsers(String repositoryName) {
+    public String[] listAllUsers() {
         List<String> userNames = new ArrayList<String>();
-        UsersRepository users = getUserRepository(repositoryName);
-        for (Iterator<String> it = users.list(); it.hasNext();) {
+        for (Iterator<String> it = localUsers.list(); it.hasNext();) {
             userNames.add(it.next());
         }
         return (String[])userNames.toArray(new String[]{});
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#setPassword(java.lang.String, java.lang.String, java.lang.String)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#setPassword(java.lang.String, java.lang.String)
      */
-    public boolean setPassword(String userName, String password, String repositoryName) {
-        UsersRepository users = getUserRepository(repositoryName);
-        User user = users.getUserByName(userName);
+    public boolean setPassword(String userName, String password) {
+        User user = localUsers.getUserByName(userName);
         if (user == null) throw new IllegalArgumentException("user not found: " + userName);
         return user.setPassword(password);
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#unsetAlias(java.lang.String, java.lang.String)
+
+    /*
+     * 
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#unsetAlias(java.lang.String)
      */
-    public boolean unsetAlias(String userName, String repositoryName) {
-        JamesUser user = getJamesUser(userName, null);
+    public boolean unsetAlias(String userName) {
+        JamesUser user = getJamesUser(userName);
         if (!user.getAliasing()) return false;
         
         user.setAliasing(false);
-        getUserRepository(repositoryName).updateUser(user);
+        localUsers.updateUser(user);
         return true;
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#getAlias(java.lang.String, java.lang.String)
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#getAlias(java.lang.String)
      */
-    public String getAlias(String userName, String repositoryName) {
-        JamesUser user = getJamesUser(userName, null);
+    public String getAlias(String userName) {
+        JamesUser user = getJamesUser(userName);
         if (!user.getAliasing()) return null;
         return user.getAlias();
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#unsetForwardAddress(java.lang.String, java.lang.String)
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#unsetForwardAddress(java.lang.String)
      */
-    public boolean unsetForwardAddress(String userName, String repositoryName) {
-        JamesUser user = getJamesUser(userName, null);
+    public boolean unsetForwardAddress(String userName) {
+        JamesUser user = getJamesUser(userName);
 
         if (!user.getForwarding()) return false;
         
         user.setForwarding(false);
-        getUserRepository(repositoryName).updateUser(user);
+        localUsers.updateUser(user);
         return true;
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#getForwardAddress(java.lang.String, java.lang.String)
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#getForwardAddress(java.lang.String)
      */
-    public String getForwardAddress(String userName, String repositoryName) {
-        JamesUser user = getJamesUser(userName, null);
+    public String getForwardAddress(String userName) {
+        JamesUser user = getJamesUser(userName);
         if (!user.getForwarding()) return null;
         return user.getForwardingDestination().toString();
     }
 
-    /**
-     * @see org.apache.james.user.api.UserManagementMBean#getUserRepositoryNames()
-     */
-    public List<String> getUserRepositoryNames() {
-        List<String> result = new ArrayList<String>();
-        if (usersStore == null) return result;
-        
-        Iterator<String> repositoryNames = usersStore.getRepositoryNames();
-        while (repositoryNames.hasNext()) {
-            String name = repositoryNames.next();
-            result.add(name);
-        }
-        return result;
-    }
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.user.api.UserManagementMBean#getVirtualHostingEnabled(java.lang.String)
+     * @see org.apache.james.user.api.UserManagementMBean#getVirtualHostingEnabled()
      */
-    public boolean getVirtualHostingEnabled(String repositoryName) {
-        return getUserRepository(repositoryName).supportVirtualHosting();
+    public boolean getVirtualHostingEnabled() {
+        return localUsers.supportVirtualHosting();
     }
 
 }

Modified: james/server/trunk/user-library/src/test/java/org/apache/james/user/lib/UserManagementTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/test/java/org/apache/james/user/lib/UserManagementTest.java?rev=1049943&r1=1049942&r2=1049943&view=diff
==============================================================================
--- james/server/trunk/user-library/src/test/java/org/apache/james/user/lib/UserManagementTest.java (original)
+++ james/server/trunk/user-library/src/test/java/org/apache/james/user/lib/UserManagementTest.java Thu Dec 16 12:09:50 2010
@@ -41,52 +41,36 @@ public class UserManagementTest extends 
 
         m_userManagement = new UserManagement();      
         m_userManagement.setUsersRepository(m_mockUsersRepository);
-        m_userManagement.setUsersStore(new MockUsersStore(m_mockUsersRepository));
     }
 
    
 
     public void testUserCount() {
-        assertEquals("no user yet", 0, m_userManagement.countUsers(null));
+        assertEquals("no user yet", 0, m_userManagement.countUsers());
         m_mockUsersRepository.addUser("testCount1", "testCount");
-        assertEquals("1 user", 1, m_userManagement.countUsers(null));
+        assertEquals("1 user", 1, m_userManagement.countUsers());
         m_mockUsersRepository.addUser("testCount2", "testCount");
-        assertEquals("2 users", 2, m_userManagement.countUsers(null));
+        assertEquals("2 users", 2, m_userManagement.countUsers());
         m_mockUsersRepository.removeUser("testCount1");
-        assertEquals("1 user", 1, m_userManagement.countUsers(null));
+        assertEquals("1 user", 1, m_userManagement.countUsers());
     }
 
-    public void testDefaultRepositoryIsLocalUsers() {
-        m_userManagement.addUser("testCount1", "testCount", null);
-        m_userManagement.addUser("testCount2", "testCount", "LocalUsers");
 
-        assertEquals("2 users", 2, m_userManagement.countUsers(null));
-        assertEquals("2 users", 2, m_userManagement.countUsers("LocalUsers"));
-    }
-
-    public void testNonExistingRepository() {
-        try {
-            m_userManagement.addUser("testCount1", "testCount", "NonExisting");
-            fail("retrieved non-existing repository");
-        } catch (IllegalArgumentException e) {
-            // success
-        }
-    }
 
     public void testAddUserAndVerify() {
         assertTrue("user added", m_mockUsersRepository.addUser("testCount1", "testCount"));
-        assertFalse("user not there", m_userManagement.verifyExists("testNotAdded", null));
-        assertTrue("user is there", m_userManagement.verifyExists("testCount1", null));
+        assertFalse("user not there", m_userManagement.verifyExists("testNotAdded"));
+        assertTrue("user is there", m_userManagement.verifyExists("testCount1"));
         m_mockUsersRepository.removeUser("testCount1");
-        assertFalse("user not there", m_userManagement.verifyExists("testCount1", null));
+        assertFalse("user not there", m_userManagement.verifyExists("testCount1"));
     }
 
     public void testDelUser() {
         assertTrue("user added", m_mockUsersRepository.addUser("testDel", "test"));
-        assertFalse("user not there", m_userManagement.verifyExists("testNotDeletable", null));
-        assertTrue("user is there", m_userManagement.verifyExists("testDel", null));
+        assertFalse("user not there", m_userManagement.verifyExists("testNotDeletable"));
+        assertTrue("user is there", m_userManagement.verifyExists("testDel"));
         m_mockUsersRepository.removeUser("testDel");
-        assertFalse("user no longer there", m_userManagement.verifyExists("testDel", null));
+        assertFalse("user no longer there", m_userManagement.verifyExists("testDel"));
     }
 
     public void testListUsers() {
@@ -99,7 +83,7 @@ public class UserManagementTest extends 
             assertTrue("user added", m_mockUsersRepository.addUser(user, "test"));
         }
 
-        String[] userNames = m_userManagement.listAllUsers(null);
+        String[] userNames = m_userManagement.listAllUsers();
         assertEquals("user count", users.size(), userNames.length);
 
         for (int i = 0; i < userNames.length; i++) {
@@ -111,27 +95,23 @@ public class UserManagementTest extends 
     
     public void testSetPassword() {
 
-        assertTrue("user added", m_userManagement.addUser("testPwdUser", "pwd1", null));
+        assertTrue("user added", m_userManagement.addUser("testPwdUser", "pwd1"));
 
         assertTrue("initial password", m_mockUsersRepository.test("testPwdUser", "pwd1"));
 
         // set empty pwd
-        assertTrue("changed to empty password", m_userManagement.setPassword("testPwdUser", "", null));
+        assertTrue("changed to empty password", m_userManagement.setPassword("testPwdUser", ""));
         assertTrue("password changed to empty", m_mockUsersRepository.test("testPwdUser", ""));
 
         // change pwd
-        assertTrue("changed password", m_userManagement.setPassword("testPwdUser", "pwd2", null));
+        assertTrue("changed password", m_userManagement.setPassword("testPwdUser", "pwd2"));
         assertTrue("password not changed to pwd2", m_mockUsersRepository.test("testPwdUser", "pwd2"));
 
         // assure case sensitivity
-        assertTrue("changed password", m_userManagement.setPassword("testPwdUser", "pWD2", null));
+        assertTrue("changed password", m_userManagement.setPassword("testPwdUser", "pWD2"));
         assertFalse("password no longer pwd2", m_mockUsersRepository.test("testPwdUser", "pwd2"));
         assertTrue("password changed to pWD2", m_mockUsersRepository.test("testPwdUser", "pWD2"));
 
     }
     
-    public void testListRepositories() {
-        List<String> userRepositoryNames = m_userManagement.getUserRepositoryNames();
-        assertTrue("default is there", userRepositoryNames.contains("LocalUsers"));
-    }
 }



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