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 no...@apache.org on 2010/10/16 20:36:41 UTC

svn commit: r1023349 [1/2] - in /james/server/trunk: remotemanager/src/main/java/org/apache/james/remotemanager/core/ spring-deployment/src/main/config/james/ user-api/src/main/java/org/apache/james/api/user/management/ user-api/src/main/java/org/apach...

Author: norman
Date: Sat Oct 16 18:36:40 2010
New Revision: 1023349

URL: http://svn.apache.org/viewvc?rev=1023349&view=rev
Log:
Enable JMX for VirtualUserTable and UsersRepository (JAMES-1057)

Added:
    james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTable.java
      - copied, changed from r1022543, james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagement.java
    james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTableException.java
      - copied, changed from r1022543, james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementException.java
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagement.java
      - copied, changed from r1022543, james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagementMBeanImpl.java
Removed:
    james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagement.java
    james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementException.java
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagementMBeanImpl.java
Modified:
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AbstractMappingCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddMappingCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListAllMappingsCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListMappingCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/RemoveMappingCmdHandler.java
    james/server/trunk/spring-deployment/src/main/config/james/spring-beans.xml
    james/server/trunk/user-api/src/main/java/org/apache/james/api/user/management/UserManagementMBean.java
    james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementMBean.java
    james/server/trunk/user-function/src/main/java/org/apache/james/vut/JDBCVirtualUserTable.java
    james/server/trunk/user-function/src/main/java/org/apache/james/vut/JPAVirtualUserTable.java
    james/server/trunk/user-function/src/test/java/org/apache/james/management/UserManagementTest.java
    james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java
    james/server/trunk/user-function/src/test/java/org/apache/james/vut/JPAVirtualUserTableTest.java
    james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/user/UserManagement.java
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java
    james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/JamesVirtualUserTable.java
    james/server/trunk/user-library/src/test/java/org/apache/james/test/mock/james/MockVirtualUserTableManagementImpl.java
    james/server/trunk/user-library/src/test/java/org/apache/james/vut/AbstractVirtualUserTableTest.java

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AbstractMappingCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AbstractMappingCmdHandler.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AbstractMappingCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AbstractMappingCmdHandler.java Sat Oct 16 18:36:40 2010
@@ -21,22 +21,24 @@ package org.apache.james.remotemanager.c
 
 import javax.annotation.Resource;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagement;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTable;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.remotemanager.CommandHandler;
 
 public abstract class AbstractMappingCmdHandler implements CommandHandler {
 
     protected final static String ADD_MAPPING_ACTION = "ADDMAPPING";
     protected final static String REMOVE_MAPPING_ACTION = "REMOVEMAPPING";
-    protected VirtualUserTableManagement vutManagement;
+    protected ManageableVirtualUserTable vutManagement;
 
-    @Resource(name = "virtualusertablemanagement")
-    public final void setVirtualUserTableManagement(VirtualUserTableManagement vutManagement) {
-        this.vutManagement = vutManagement;
+
+    @Resource(name="manageablevirtualusertable")
+    public void setManageableVirtualUserTable(org.apache.james.api.vut.ManageableVirtualUserTable vut) {
+        this.vutManagement = vut;
     }
+    
 
-    protected boolean mappingAction(String[] args, String action) throws IllegalArgumentException, VirtualUserTableManagementException {
+    protected boolean mappingAction(String[] args, String action) throws IllegalArgumentException, ManageableVirtualUserTableException {
         String user = null;
         String domain = null;
         String mapping = null;

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddMappingCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddMappingCmdHandler.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddMappingCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddMappingCmdHandler.java Sat Oct 16 18:36:40 2010
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.remotemanager.CommandHelp;
@@ -51,7 +51,7 @@ public class AddMappingCmdHandler extend
         } else {
             try {
                 response = new RemoteManagerResponse("Adding mapping successful: " + mappingAction(args, ADD_MAPPING_ACTION));
-            } catch (VirtualUserTableManagementException e) {
+            } catch (ManageableVirtualUserTableException e) {
                 session.getLogger().error("Error on adding mapping: " + e);
                 response = new RemoteManagerResponse("Error on adding mapping: " + e);
             } catch (IllegalArgumentException e) {

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListAllMappingsCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListAllMappingsCmdHandler.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListAllMappingsCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListAllMappingsCmdHandler.java Sat Oct 16 18:36:40 2010
@@ -27,7 +27,7 @@ import java.util.Map;
 
 import javax.annotation.Resource;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagement;
+import org.apache.james.api.vut.ManageableVirtualUserTable;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.remotemanager.CommandHandler;
@@ -40,12 +40,14 @@ public class ListAllMappingsCmdHandler i
 
     public final static String COMMAND_NAME = "LISTALLMAPPINGS";
 
-    protected VirtualUserTableManagement vutManagement;
+    protected ManageableVirtualUserTable vutManagement;
 
-    @Resource(name = "virtualusertablemanagement")
-    public final void setVirtualUserTableManagementService(VirtualUserTableManagement vutManagement) {
-        this.vutManagement = vutManagement;
+
+    @Resource(name="manageablevirtualusertable")
+    public void setManageableVirtualUserTable(org.apache.james.api.vut.ManageableVirtualUserTable vut) {
+        this.vutManagement = vut;
     }
+    
 
     /*
      * (non-Javadoc)

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListMappingCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListMappingCmdHandler.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListMappingCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListMappingCmdHandler.java Sat Oct 16 18:36:40 2010
@@ -24,8 +24,8 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagement;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTable;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.remotemanager.CommandHelp;
@@ -68,8 +68,8 @@ public class ListMappingCmdHandler exten
 			}
 
             try {
-            	if (vutManagement instanceof VirtualUserTableManagement) {
-            		Collection<String> mappings = ((VirtualUserTableManagement)vutManagement).getUserDomainMappings(user, domain);
+            	if (vutManagement instanceof ManageableVirtualUserTable) {
+            		Collection<String> mappings = ((ManageableVirtualUserTable)vutManagement).getUserDomainMappings(user, domain);
                     if (mappings == null) {
                         response = new RemoteManagerResponse("No mappings found");
                     } else {
@@ -84,7 +84,7 @@ public class ListMappingCmdHandler exten
                     response = new RemoteManagerResponse("Listing mappings not supported");
             	}
                 
-            } catch (VirtualUserTableManagementException e) {
+            } catch (ManageableVirtualUserTableException e) {
                 session.getLogger().error("Error on listing mapping: " + e);
                 response = new RemoteManagerResponse("Error on listing mapping: " + e);
             } catch (IllegalArgumentException e) {

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/RemoveMappingCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/RemoveMappingCmdHandler.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/RemoveMappingCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/RemoveMappingCmdHandler.java Sat Oct 16 18:36:40 2010
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.remotemanager.CommandHelp;
@@ -51,7 +51,7 @@ public class RemoveMappingCmdHandler ext
         } else {
             try {
                 response = new RemoteManagerResponse("Removing mapping successful: " + mappingAction(args, REMOVE_MAPPING_ACTION));
-            } catch (VirtualUserTableManagementException e) {
+            } catch (ManageableVirtualUserTableException e) {
                 session.getLogger().error("Error on  removing mapping: " + e);
                 response = new RemoteManagerResponse("Error on removing mapping: " + e);
             } catch (IllegalArgumentException e) {

Modified: james/server/trunk/spring-deployment/src/main/config/james/spring-beans.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/config/james/spring-beans.xml?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/src/main/config/james/spring-beans.xml (original)
+++ james/server/trunk/spring-deployment/src/main/config/james/spring-beans.xml Sat Oct 16 18:36:40 2010
@@ -44,12 +44,14 @@
           <entry key="org.apache.james:type=component,name=domainlist" value-ref="domainlist"/>
           <entry key="org.apache.james:type=component,name=dnsservice" value-ref="dnsservice"/>
           <entry key="org.apache.james:type=component,name=processor" value-ref="processormanagement"/>
+          <entry key="org.apache.james:type=component,name=virtualusertable" value-ref="virtualusertablemanagement"/>
+          <entry key="org.apache.james:type=component,name=usermanagement" value-ref="usermanagement"/>
 
         </map>
       </property>
       <property name="assembler">
           <bean class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
-            <property name="managedInterfaces" value="org.apache.james.smtpserver.SMTPServerMBean,org.apache.james.socket.ServerMBean,org.apache.james.api.domainlist.DomainListMBean,org.apache.james.api.domainlist.ManageableDomainListMBean,org.apache.james.dnsservice.api.DNSServiceMBean,org.apache.james.mailetcontainer.ProcessorManagementMBean"/>
+            <property name="managedInterfaces" value="org.apache.james.smtpserver.SMTPServerMBean,org.apache.james.socket.ServerMBean,org.apache.james.api.domainlist.DomainListMBean,org.apache.james.api.domainlist.ManageableDomainListMBean,org.apache.james.dnsservice.api.DNSServiceMBean,org.apache.james.mailetcontainer.ProcessorManagementMBean,org.apache.james.api.vut.management.VirtualUserTableManagementMBean,org.apache.james.api.user.management.UserManagementMBean"/>
           </bean>
       </property>
     </bean>
@@ -68,6 +70,11 @@
     </bean>
     
     <bean id="processormanagement" class="org.apache.james.mailetcontainer.ProcessorManagement"/>
+    
+    
+    <bean id="usermanagement" class="org.apache.james.impl.user.UserManagement" />
+    
+    <bean id="virtualusertablemanagement" class="org.apache.james.impl.vut.VirtualUserTableManagement" />
     -->
 
     <bean class="org.apache.james.container.spring.lifecycle.CommonsConfigurableBeanPostProcessor">
@@ -194,9 +201,6 @@
         <property name="coreHandlersPackage" value="org.apache.james.remotemanager.core.CoreCmdHandlerLoader"/>
     </bean>
 
-    <!-- The User Management block  -->
-    <bean id="usermanagement" class="org.apache.james.impl.user.UserManagement" />
-
     <!-- Async POP3 Server -->
     <bean id="pop3server"  class="org.apache.james.pop3server.netty.NioPOP3Server" >
         <property name="protocolHandlerChain" ref="pop3ProtocolHandlerChain"/>
@@ -254,7 +258,7 @@
     <bean id="filesystem" class="org.apache.james.container.spring.SpringFileSystem" />
 
 
-    <bean id="virtualusertable" name="virtualusertablemanagement" class="org.apache.james.impl.vut.JamesVirtualUserTable" />
+    <bean id="virtualusertable" name="manageablevirtualusertable" class="org.apache.james.impl.vut.JamesVirtualUserTable" />
 
     <!-- The context domainlist implementation -->
     <bean id="domainlist" name="domainlistmanagement" class="org.apache.james.domain.JamesDomainList" />

Modified: james/server/trunk/user-api/src/main/java/org/apache/james/api/user/management/UserManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/api/user/management/UserManagementMBean.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/api/user/management/UserManagementMBean.java (original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/api/user/management/UserManagementMBean.java Sat Oct 16 18:36:40 2010
@@ -109,20 +109,6 @@ public interface UserManagementMBean {
     boolean setPassword(String userName, String password, String repositoryName) throws UserManagementException;
 
     /**
-     * Set a user's alias to whom all mail is forwarded to
-     *
-     * @phoenix:mx-operation
-     * @phoenix:mx-description Set a user's alias to whom all mail is forwarded to
-     *
-     * @param userName The name of the user whose alias is set
-     * @param aliasUserName The user becoming the new alias 
-     * @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 setAlias(String userName, String aliasUserName, String repositoryName) throws UserManagementException;
-
-    /**
      * Removes a user's alias which terminates local mail forwarding
      *
      * @phoenix:mx-operation
@@ -133,6 +119,7 @@ public interface UserManagementMBean {
      *        repository is used.
      * @return if the user has been found and the alias was removed
      */
+    @Deprecated
     boolean unsetAlias(String userName, String repositoryName) throws UserManagementException;
 
     /**
@@ -145,23 +132,10 @@ public interface UserManagementMBean {
      *        repository is used.
      * @return User's alias, or NULL, if no alias is set
      */
+    @Deprecated
     String getAlias(String userName, String repositoryName) throws UserManagementException;
 
     /**
-     * Set a user's forward email address to whom all mail is forwarded to
-     *
-     * @phoenix:mx-operation
-     * @phoenix:mx-description Set a user's forward email address to whom all mail is forwarded to
-     *
-     * @param userName The name of the user whose forward is set
-     * @param forwardEmailAddress The new forward email address
-     * @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 setForwardAddress(String userName, String forwardEmailAddress, String repositoryName) throws UserManagementException;
-
-    /**
      * Removes a user's forward email address which terminates remote mail forwarding
      *
      * @phoenix:mx-operation
@@ -172,6 +146,7 @@ public interface UserManagementMBean {
      *        repository is used.
      * @return if the user has been found and the forward was removed
      */
+    @Deprecated
     boolean unsetForwardAddress(String userName, String repositoryName) throws UserManagementException;
 
     /**
@@ -185,6 +160,7 @@ public interface UserManagementMBean {
      *        repository is used.
      * @return User's forward email address, or NULL, if no forward is set
      */
+    @Deprecated
     String getForwardAddress(String userName, String repositoryName) throws UserManagementException;
 
     /**

Copied: james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTable.java (from r1022543, james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagement.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTable.java?p2=james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTable.java&p1=james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagement.java&r1=1022543&r2=1023349&rev=1023349&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagement.java (original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTable.java Sat Oct 16 18:36:40 2010
@@ -19,14 +19,13 @@
 
 
 
-package org.apache.james.api.vut.management;
+package org.apache.james.api.vut;
 
 import java.util.Collection;
 import java.util.Map;
 
-import org.apache.james.api.vut.VirtualUserTable;
 
-public interface VirtualUserTableManagement extends VirtualUserTable {
+public interface ManageableVirtualUserTable extends VirtualUserTable {
     
     /**
      * The component role used by components implementing this service
@@ -40,9 +39,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param regex the regex.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException get thrown if an invalid argument was given
+     * @throws ManageableVirtualUserTableException get thrown if an invalid argument was given
      */
-    public boolean addRegexMapping(String user, String domain, String regex) throws VirtualUserTableManagementException;
+    public boolean addRegexMapping(String user, String domain, String regex) throws ManageableVirtualUserTableException;
     
     /**
      * Remove regex mapping
@@ -51,9 +50,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param regex the regex.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException get thrown if an invalid argument was given
+     * @throws ManageableVirtualUserTableException get thrown if an invalid argument was given
      */
-    public boolean removeRegexMapping(String user,String domain, String regex) throws VirtualUserTableManagementException;
+    public boolean removeRegexMapping(String user,String domain, String regex) throws ManageableVirtualUserTableException;
     
     /***
      * Add address mapping
@@ -62,9 +61,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param address 
      * @return true if successfully
-     * @throws VirtualUserTableManagementException get thrown if an invalid argument was given
+     * @throws ManageableVirtualUserTableException get thrown if an invalid argument was given
      */
-    public boolean addAddressMapping(String user, String domain, String address) throws VirtualUserTableManagementException;
+    public boolean addAddressMapping(String user, String domain, String address) throws ManageableVirtualUserTableException;
     
     /**
      * Remove address mapping
@@ -73,9 +72,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param address 
      * @return true if successfully
-     * @throws VirtualUserTableManagementException get thrown if an invalid argument was given
+     * @throws ManageableVirtualUserTableException get thrown if an invalid argument was given
      */
-    public boolean removeAddressMapping(String user,String domain, String address) throws VirtualUserTableManagementException;
+    public boolean removeAddressMapping(String user,String domain, String address) throws ManageableVirtualUserTableException;
     
     /**
      * Add error mapping
@@ -84,9 +83,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param error the regex.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException get thrown if an invalid argument was given
+     * @throws ManageableVirtualUserTableException get thrown if an invalid argument was given
      */
-    public boolean addErrorMapping(String user, String domain, String error) throws VirtualUserTableManagementException;
+    public boolean addErrorMapping(String user, String domain, String error) throws ManageableVirtualUserTableException;
 
     /**
      * Remove error mapping
@@ -95,9 +94,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param error
      * @return true if successfully
-     * @throws VirtualUserTableManagementException get thrown if an invalid argument was given
+     * @throws ManageableVirtualUserTableException get thrown if an invalid argument was given
      */
-    public boolean removeErrorMapping(String user,String domain, String error) throws VirtualUserTableManagementException;
+    public boolean removeErrorMapping(String user,String domain, String error) throws ManageableVirtualUserTableException;
     
     /**
      * Return the explicit mapping stored for the given user and domain. Return null
@@ -106,9 +105,9 @@ public interface VirtualUserTableManagem
      * @param user the username
      * @param domain the domain
      * @return the collection which holds the mappings. 
-     * @throws VirtualUserTableManagementException  get thrown if an invalid use or domain was given
+     * @throws ManageableVirtualUserTableException  get thrown if an invalid use or domain was given
      */
-    public Collection<String> getUserDomainMappings(String user, String domain) throws VirtualUserTableManagementException;
+    public Collection<String> getUserDomainMappings(String user, String domain) throws ManageableVirtualUserTableException;
     
     /**
      * Add mapping
@@ -117,9 +116,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param mapping the mapping
      * @return true if successfully
-     * @throws VirtualUserTableManagementException
+     * @throws ManageableVirtualUserTableException
      */
-    public boolean addMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException;
+    public boolean addMapping(String user, String domain, String mapping) throws ManageableVirtualUserTableException;
     
     /**
      * Remove mapping
@@ -128,9 +127,9 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param mapping the mapping
      * @return true if successfully
-     * @throws VirtualUserTableManagementException
+     * @throws ManageableVirtualUserTableException
      */
-    public boolean removeMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException;
+    public boolean removeMapping(String user, String domain, String mapping) throws ManageableVirtualUserTableException;
 
 
     /**
@@ -147,9 +146,9 @@ public interface VirtualUserTableManagem
      * @param aliasDomain the aliasdomain which should be mapped to the realDomain
      * @param realDomain the realDomain
      * @return true if successfilly
-     * @throws VirtualUserTableManagementException
+     * @throws ManageableVirtualUserTableException
      */
-    public boolean addAliasDomainMapping(String aliasDomain, String realDomain) throws VirtualUserTableManagementException;
+    public boolean addAliasDomainMapping(String aliasDomain, String realDomain) throws ManageableVirtualUserTableException;
     
     /**
      * Remove aliasDomain mapping
@@ -157,7 +156,7 @@ public interface VirtualUserTableManagem
      * @param aliasDomain the aliasdomain which should be mapped to the realDomain
      * @param realDomain the realDomain
      * @return true if successfilly
-     * @throws VirtualUserTableManagementException
+     * @throws ManageableVirtualUserTableException
      */
-    public boolean removeAliasDomainMapping(String aliasDomain, String realDomain) throws VirtualUserTableManagementException;
+    public boolean removeAliasDomainMapping(String aliasDomain, String realDomain) throws ManageableVirtualUserTableException;
 }

Copied: james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTableException.java (from r1022543, james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementException.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTableException.java?p2=james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTableException.java&p1=james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementException.java&r1=1022543&r2=1023349&rev=1023349&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementException.java (original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/ManageableVirtualUserTableException.java Sat Oct 16 18:36:40 2010
@@ -20,25 +20,25 @@
 
 
 
-package org.apache.james.api.vut.management;
+package org.apache.james.api.vut;
 
-public class VirtualUserTableManagementException extends Exception {
+public class ManageableVirtualUserTableException extends Exception {
 
 	private static final long serialVersionUID = 2365387465283746L;
 
-	public VirtualUserTableManagementException() {
+	public ManageableVirtualUserTableException() {
         super();
     }
 
-    public VirtualUserTableManagementException(String message) {
+    public ManageableVirtualUserTableException(String message) {
         super(message);
     }
 
-    public VirtualUserTableManagementException(Exception e) {
+    public ManageableVirtualUserTableException(Exception e) {
         super(e);
     }
     
-    public VirtualUserTableManagementException(String message, Exception e) {
+    public ManageableVirtualUserTableException(String message, Exception e) {
         super(message, e);
     }
 

Modified: james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementMBean.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementMBean.java (original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/api/vut/management/VirtualUserTableManagementMBean.java Sat Oct 16 18:36:40 2010
@@ -23,12 +23,10 @@ package org.apache.james.api.vut.managem
 
 import java.util.Collection;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
 
 /**
  * Expose virtualusertable management functionality through JMX.
  * 
- * @phoenix:mx-topic name="VirtualUserTableAdministration"
  */
 public interface VirtualUserTableManagementMBean {
     
@@ -41,9 +39,8 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param regex the regex.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean addRegexMapping(String user, String domain, String regex) throws VirtualUserTableManagementException;
+    public boolean addRegexMapping(String user, String domain, String regex);
     
     /**
      * Remove regex mapping
@@ -54,9 +51,8 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param regex the regex.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean removeRegexMapping(String user,String domain, String regex) throws VirtualUserTableManagementException;
+    public boolean removeRegexMapping(String user,String domain, String regex);
     
     /***
      * Add address mapping
@@ -67,9 +63,8 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param address the address.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean addAddressMapping(String user, String domain, String address) throws VirtualUserTableManagementException;
+    public boolean addAddressMapping(String user, String domain, String address);
     
     /**
      * Remove address mapping
@@ -80,9 +75,8 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param address
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean removeAddressMapping(String user,String domain, String address) throws VirtualUserTableManagementException;
+    public boolean removeAddressMapping(String user,String domain, String address);
     
     /**
      * Add error mapping
@@ -93,9 +87,8 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param error
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean addErrorMapping(String user, String domain, String error) throws VirtualUserTableManagementException;
+    public boolean addErrorMapping(String user, String domain, String error);
 
     /**
      * Remove error mapping
@@ -106,9 +99,8 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param error
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean removeErrorMapping(String user,String domain, String error) throws VirtualUserTableManagementException;
+    public boolean removeErrorMapping(String user,String domain, String error);
     
     /**
      * Return the explicit mapping stored for the given user and domain. Return null
@@ -120,9 +112,8 @@ public interface VirtualUserTableManagem
      * @param user the username
      * @param domain the domain
      * @return the collection which holds the mappings. 
-     * @throws VirtualUserTableManagementException TODO
      */
-    public Collection<String> getUserDomainMappings(String user, String domain) throws VirtualUserTableManagementException;
+    public Collection<String> getUserDomainMappings(String user, String domain);
     
     /**
     * Try to identify the right method based on the prefix of the mapping and add it.
@@ -133,9 +124,8 @@ public interface VirtualUserTableManagem
     * @param domain the domain. Null if no domain should be used
     * @param mapping the mapping.
     * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
     */
-    public boolean addMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException;
+    public boolean addMapping(String user, String domain, String mapping);
     
     /**
      * Try to identify the right method based on the prefix of the mapping and remove it.
@@ -146,7 +136,6 @@ public interface VirtualUserTableManagem
      * @param domain the domain. Null if no domain should be used
      * @param mapping the mapping.
      * @return true if successfully
-     * @throws VirtualUserTableManagementException TODO
      */
-    public boolean removeMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException;
+    public boolean removeMapping(String user, String domain, String mapping);
 }

Modified: james/server/trunk/user-function/src/main/java/org/apache/james/vut/JDBCVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/main/java/org/apache/james/vut/JDBCVirtualUserTable.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-function/src/main/java/org/apache/james/vut/JDBCVirtualUserTable.java (original)
+++ james/server/trunk/user-function/src/main/java/org/apache/james/vut/JDBCVirtualUserTable.java Sat Oct 16 18:36:40 2010
@@ -36,7 +36,7 @@ import javax.sql.DataSource;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.impl.vut.AbstractVirtualUserTable;
 import org.apache.james.impl.vut.VirtualUserTableUtil;
 import org.apache.james.services.DataSourceSelector;
@@ -228,7 +228,7 @@ public class JDBCVirtualUserTable extend
     /**
      * @see org.apache.james.impl.vut.AbstractVirtualUserTable#addMappingInternal(String, String, String)
      */
-    protected boolean addMappingInternal(String user, String domain, String regex) throws VirtualUserTableManagementException {
+    protected boolean addMappingInternal(String user, String domain, String regex) throws ManageableVirtualUserTableException {
 
         String newUser = getUserString(user);
         String newDomain = getDomainString(domain);
@@ -339,7 +339,7 @@ public class JDBCVirtualUserTable extend
     /**
      * @see org.apache.james.impl.vut.AbstractVirtualUserTable#removeMappingInternal(String, String, String)
      */
-    protected boolean removeMappingInternal(String user, String domain, String mapping) throws VirtualUserTableManagementException {
+    protected boolean removeMappingInternal(String user, String domain, String mapping) throws ManageableVirtualUserTableException {
         String newUser = getUserString(user);
         String newDomain = getDomainString(domain);
         Collection<String> map = getUserDomainMappings(newUser,newDomain);
@@ -476,12 +476,12 @@ public class JDBCVirtualUserTable extend
      * @return user the user String
      * @throws InvalidMappingException get thrown on invalid argument
      */
-    private String getUserString(String user) throws VirtualUserTableManagementException {
+    private String getUserString(String user) throws ManageableVirtualUserTableException {
         if (user != null) {
             if(user.equals(WILDCARD) || user.indexOf("@") < 0) {
                 return user;
             } else {
-                throw new VirtualUserTableManagementException("Invalid user: " + user);
+                throw new ManageableVirtualUserTableException("Invalid user: " + user);
             }
         } else {
             return WILDCARD;
@@ -495,12 +495,12 @@ public class JDBCVirtualUserTable extend
      * @return domainString the domain String
      * @throws InvalidMappingException get thrown on invalid argument
      */
-    private String getDomainString(String domain) throws VirtualUserTableManagementException {
+    private String getDomainString(String domain) throws ManageableVirtualUserTableException {
         if(domain != null) {
             if (domain.equals(WILDCARD) || domain.indexOf("@") < 0) {
                 return domain;  
             } else {
-                throw new VirtualUserTableManagementException("Invalid domain: " + domain);
+                throw new ManageableVirtualUserTableException("Invalid domain: " + domain);
             }
         } else {
             return WILDCARD;

Modified: james/server/trunk/user-function/src/main/java/org/apache/james/vut/JPAVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/main/java/org/apache/james/vut/JPAVirtualUserTable.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-function/src/main/java/org/apache/james/vut/JPAVirtualUserTable.java (original)
+++ james/server/trunk/user-function/src/main/java/org/apache/james/vut/JPAVirtualUserTable.java Sat Oct 16 18:36:40 2010
@@ -29,7 +29,7 @@ import javax.persistence.EntityTransacti
 import javax.persistence.PersistenceException;
 import javax.persistence.PersistenceUnit;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.impl.vut.AbstractVirtualUserTable;
 import org.apache.james.impl.vut.VirtualUserTableUtil;
 import org.apache.james.vut.model.JPAVirtualUser;
@@ -57,7 +57,7 @@ public class JPAVirtualUserTable extends
     /**
      * @see org.apache.james.impl.vut.AbstractVirtualUserTable#addMappingInternal(String, String, String)
      */
-    protected boolean addMappingInternal(String user, String domain, String regex) throws VirtualUserTableManagementException {
+    protected boolean addMappingInternal(String user, String domain, String regex) throws ManageableVirtualUserTableException {
         
         String newUser = getUserString(user);
         String newDomain = getDomainString(domain);
@@ -153,7 +153,7 @@ public class JPAVirtualUserTable extends
     /**
      * @see org.apache.james.impl.vut.AbstractVirtualUserTable#removeMappingInternal(String, String, String)
      */
-    protected boolean removeMappingInternal(String user, String domain, String mapping) throws VirtualUserTableManagementException {
+    protected boolean removeMappingInternal(String user, String domain, String mapping) throws ManageableVirtualUserTableException {
         String newUser = getUserString(user);
         String newDomain = getDomainString(domain);
         Collection<String> map = getUserDomainMappings(newUser,newDomain);
@@ -265,12 +265,12 @@ public class JPAVirtualUserTable extends
      * @return user the user String
      * @throws InvalidMappingException get thrown on invalid argument
      */
-    private String getUserString(String user) throws VirtualUserTableManagementException {
+    private String getUserString(String user) throws ManageableVirtualUserTableException {
         if (user != null) {
             if(user.equals(WILDCARD) || user.indexOf("@") < 0) {
                 return user;
             } else {
-                throw new VirtualUserTableManagementException("Invalid user: " + user);
+                throw new ManageableVirtualUserTableException("Invalid user: " + user);
             }
         } else {
             return WILDCARD;
@@ -284,12 +284,12 @@ public class JPAVirtualUserTable extends
      * @return domainString the domain String
      * @throws InvalidMappingException get thrown on invalid argument
      */
-    private String getDomainString(String domain) throws VirtualUserTableManagementException {
+    private String getDomainString(String domain) throws ManageableVirtualUserTableException {
         if(domain != null) {
             if (domain.equals(WILDCARD) || domain.indexOf("@") < 0) {
                 return domain;  
             } else {
-                throw new VirtualUserTableManagementException("Invalid domain: " + domain);
+                throw new ManageableVirtualUserTableException("Invalid domain: " + domain);
             }
         } else {
             return WILDCARD;

Modified: james/server/trunk/user-function/src/test/java/org/apache/james/management/UserManagementTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/test/java/org/apache/james/management/UserManagementTest.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-function/src/test/java/org/apache/james/management/UserManagementTest.java (original)
+++ james/server/trunk/user-function/src/test/java/org/apache/james/management/UserManagementTest.java Sat Oct 16 18:36:40 2010
@@ -111,102 +111,7 @@ public class UserManagementTest extends 
         }
     }
 
-    public void testAlias() throws UserManagementException {
-        m_mockUsersRepository.setForceUseJamesUser();
-
-        // do some tests when parameter users don't exist
-        try {
-            m_userManagement.setAlias("testNonExist1", "testNonExist2", null);
-            fail("user unknown to server");
-        } catch (UserManagementException e) {
-            // success
-        }
-
-        assertTrue("user added", m_userManagement.addUser("testAlias1", "test", null));
-
-        assertNull("no alias set", m_userManagement.getAlias("testAlias1", null));
-
-        try {
-            m_userManagement.setAlias("testAlias1", "testNonExist2", null);
-            fail("alias unknown to server");
-        } catch (UserManagementException e) {
-            // success
-        }
-
-        try {
-            m_userManagement.setAlias("testNonExist1", "testAlias", null);
-            fail("user unknown to server");
-        } catch (UserManagementException e) {
-            // success
-        }
-
-        assertTrue("user added", m_userManagement.addUser("testAlias2", "test", null));
-
-        // regular alias
-        assertTrue("alias for testAlias1 set to:testAlias2", m_userManagement.setAlias("testAlias1", "testAlias2", null));
-
-        //TODO: is this correct? even primitive circular aliasing allowed!
-        assertTrue("alias for testAlias2 set to:testAlias1", m_userManagement.setAlias("testAlias2", "testAlias1", null));
-
-        // did first one persist?
-        assertEquals("Current alias for testAlias1 is: testAlias2", "testAlias2", m_userManagement.getAlias("testAlias1", null));
-
-        //TODO: is this correct? setting self as alias!
-        assertTrue("alias for testAlias1 set to:testAlias1", m_userManagement.setAlias("testAlias1", "testAlias1", null));
-
-        assertTrue("user added", m_userManagement.addUser("testAlias3", "test", null));
-
-        // re-set, simply overwrites
-        assertTrue("alias for testAlias1 set to:testAlias3", m_userManagement.setAlias("testAlias1", "testAlias3", null));
-
-        // check overwrite
-        assertEquals("Current alias for testAlias1 is: testAlias3", "testAlias3", m_userManagement.getAlias("testAlias1", null));
-
-        // retreat
-        assertTrue("alias for testAlias1 unset", m_userManagement.unsetAlias("testAlias1", null));
-
-        // check removed alias
-        //sendCommand("showalias testAlias1");
-        assertNull("User testAlias1 does not currently have an alias", m_userManagement.getAlias("testAlias1", null));
-
-    }
-
-    public void testForward() throws UserManagementException {
-        m_mockUsersRepository.setForceUseJamesUser();
-
-        // do some tests when parameter users don't exist
-        try {
-            m_userManagement.setForwardAddress("testNonExist1", "testForward1@locahost", null);
-            fail("user unknown to server");
-        } catch (UserManagementException e) {
-            // success
-        }
-
-        assertTrue("user added", m_userManagement.addUser("testForwardUser", "test", null));
-
-        assertNull("no forward set", m_userManagement.getForwardAddress("testForwardUser", null));
-
-        assertTrue(m_userManagement.setForwardAddress("testForwardUser", "testForward1@locahost", null));
-
-        // did it persist?
-        String forwardAddress = m_userManagement.getForwardAddress("testForwardUser", null);
-        assertEquals("forward for testForwardUser is: testForward1@locahost", "testForward1@locahost", forwardAddress);
-
-        // re-set, simply overwrites
-        assertTrue(m_userManagement.setForwardAddress("testForwardUser", "testForward2@locahost", null));
-
-        // check overwrite
-        forwardAddress = m_userManagement.getForwardAddress("testForwardUser", null);
-        assertEquals("forward for testForwardUser is: testForward2@locahost", "testForward2@locahost", forwardAddress);
-
-        // retreat
-        assertTrue("Forward for testForwardUser unset", m_userManagement.unsetForwardAddress("testForwardUser", null));
-
-        // check removed forward
-        assertNull("no more forward set", m_userManagement.getForwardAddress("testForwardUser", null));
-
-    }
-
+    
     public void testSetPassword() throws UserManagementException {
 
         assertTrue("user added", m_userManagement.addUser("testPwdUser", "pwd1", null));

Modified: james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java (original)
+++ james/server/trunk/user-function/src/test/java/org/apache/james/vut/JDBCVirtualUserTableTest.java Sat Oct 16 18:36:40 2010
@@ -20,7 +20,7 @@ package org.apache.james.vut;
 
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.logging.impl.SimpleLog;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.impl.vut.AbstractVirtualUserTable;
 import org.apache.james.services.MockFileSystem;
 import org.apache.james.util.TestUtil;
@@ -49,7 +49,7 @@ public class JDBCVirtualUserTableTest ex
     /**
      * @see org.apache.james.vut.AbstractVirtualUserTableTest#addMapping(java.lang.String, java.lang.String, java.lang.String, int)
      */
-    protected boolean addMapping(String user, String domain, String mapping, int type) throws VirtualUserTableManagementException {
+    protected boolean addMapping(String user, String domain, String mapping, int type) throws ManageableVirtualUserTableException {
         if (type == ERROR_TYPE) {
             return virtualUserTable.addErrorMapping(user, domain, mapping);
         } else if (type == REGEX_TYPE) {
@@ -66,7 +66,7 @@ public class JDBCVirtualUserTableTest ex
     /**
      * @see org.apache.james.vut.AbstractVirtualUserTableTest#removeMapping(java.lang.String, java.lang.String, java.lang.String, int)
      */
-    protected boolean removeMapping(String user, String domain, String mapping, int type) throws VirtualUserTableManagementException {
+    protected boolean removeMapping(String user, String domain, String mapping, int type) throws ManageableVirtualUserTableException {
         if (type == ERROR_TYPE) {
             return virtualUserTable.removeErrorMapping(user, domain, mapping);
         } else if (type == REGEX_TYPE) {

Modified: james/server/trunk/user-function/src/test/java/org/apache/james/vut/JPAVirtualUserTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/test/java/org/apache/james/vut/JPAVirtualUserTableTest.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-function/src/test/java/org/apache/james/vut/JPAVirtualUserTableTest.java (original)
+++ james/server/trunk/user-function/src/test/java/org/apache/james/vut/JPAVirtualUserTableTest.java Sat Oct 16 18:36:40 2010
@@ -22,7 +22,7 @@ import java.util.HashMap;
 
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.logging.impl.SimpleLog;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.impl.vut.AbstractVirtualUserTable;
 import org.apache.james.vut.model.JPAVirtualUser;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
@@ -76,7 +76,7 @@ public class JPAVirtualUserTableTest ext
     /**
      * @see org.apache.james.vut.AbstractVirtualUserTableTest#addMapping(java.lang.String, java.lang.String, java.lang.String, int)
      */
-    protected boolean addMapping(String user, String domain, String mapping, int type) throws VirtualUserTableManagementException {
+    protected boolean addMapping(String user, String domain, String mapping, int type) throws ManageableVirtualUserTableException {
         if (type == ERROR_TYPE) {
             return virtualUserTable.addErrorMapping(user, domain, mapping);
         } else if (type == REGEX_TYPE) {
@@ -93,7 +93,7 @@ public class JPAVirtualUserTableTest ext
     /**
      * @see org.apache.james.vut.AbstractVirtualUserTableTest#removeMapping(java.lang.String, java.lang.String, java.lang.String, int)
      */
-    protected boolean removeMapping(String user, String domain, String mapping, int type) throws VirtualUserTableManagementException {
+    protected boolean removeMapping(String user, String domain, String mapping, int type) throws ManageableVirtualUserTableException {
         if (type == ERROR_TYPE) {
             return virtualUserTable.removeErrorMapping(user, domain, mapping);
         } else if (type == REGEX_TYPE) {

Modified: james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java (original)
+++ james/server/trunk/user-function/src/test/java/org/apache/james/vut/XMLVirtualUserTableTest.java Sat Oct 16 18:36:40 2010
@@ -24,8 +24,8 @@ import java.util.List;
 
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.api.vut.VirtualUserTable;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
 import org.apache.james.impl.vut.AbstractVirtualUserTable;
 import org.apache.james.impl.vut.VirtualUserTableUtil;
 
@@ -51,7 +51,7 @@ public class XMLVirtualUserTableTest ext
     /**
      * @see org.apache.james.vut.AbstractVirtualUserTableTest#addMapping(java.lang.String, java.lang.String, java.lang.String, int)
      */
-    protected boolean addMapping(String user, String domain, String mapping, int type) throws VirtualUserTableManagementException {
+    protected boolean addMapping(String user, String domain, String mapping, int type) throws ManageableVirtualUserTableException {
 
         Collection<String> mappings = virtualUserTable.getUserDomainMappings(user, domain);
 
@@ -92,7 +92,7 @@ public class XMLVirtualUserTableTest ext
     /**
      * @see org.apache.james.vut.AbstractVirtualUserTableTest#removeMapping(java.lang.String, java.lang.String, java.lang.String, int)
      */
-    protected boolean removeMapping(String user, String domain, String mapping, int type) throws VirtualUserTableManagementException {       
+    protected boolean removeMapping(String user, String domain, String mapping, int type) throws ManageableVirtualUserTableException {       
 
         Collection<String> mappings = virtualUserTable.getUserDomainMappings(user, domain);
         

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/impl/user/UserManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/impl/user/UserManagement.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/impl/user/UserManagement.java (original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/impl/user/UserManagement.java Sat Oct 16 18:36:40 2010
@@ -22,23 +22,20 @@
 
 package org.apache.james.impl.user;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.annotation.Resource;
+
 import org.apache.james.api.user.JamesUser;
 import org.apache.james.api.user.User;
 import org.apache.james.api.user.UsersRepository;
 import org.apache.james.api.user.UsersStore;
 import org.apache.james.api.user.management.UserManagementException;
 import org.apache.james.api.user.management.UserManagementMBean;
-import org.apache.mailet.MailAddress;
-
-import javax.annotation.Resource;
-import javax.mail.internet.ParseException;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.List;
 
 public class UserManagement implements UserManagementMBean {
-
-    String ROLE = "org.apache.james.impl.user.UserManagement";
     
     /**
      * The administered UsersRepository
@@ -133,20 +130,6 @@ public class UserManagement implements U
     }
 
     /**
-     * @see org.apache.james.api.user.management.UserManagementMBean#setAlias(java.lang.String, java.lang.String, java.lang.String)
-     */
-    public boolean setAlias(String userName, String aliasUserName, String repositoryName) throws UserManagementException {
-        JamesUser user = getJamesUser(userName, null);
-        JamesUser aliasUser = getJamesUser(aliasUserName, null);
-        if (aliasUser == null) return false;
-
-        boolean success = user.setAlias(aliasUserName);
-        user.setAliasing(true);
-        getUserRepository(repositoryName).updateUser(user);
-        return success;
-    }
-
-    /**
      * @see org.apache.james.api.user.management.UserManagementMBean#unsetAlias(java.lang.String, java.lang.String)
      */
     public boolean unsetAlias(String userName, String repositoryName) throws UserManagementException {
@@ -168,26 +151,6 @@ public class UserManagement implements U
     }
 
     /**
-     * @see org.apache.james.api.user.management.UserManagementMBean#setForwardAddress(java.lang.String, java.lang.String, java.lang.String)
-     */
-    public boolean setForwardAddress(String userName, String forwardEmailAddress, String repositoryName) throws UserManagementException {
-        MailAddress forwardAddress;
-        try {
-             forwardAddress = new MailAddress(forwardEmailAddress);
-        } catch(ParseException pe) {
-            throw new UserManagementException(pe);
-        }
-
-        JamesUser user = getJamesUser(userName, null);
-        boolean success = user.setForwardingDestination(forwardAddress);
-        if (!success) return false;
-        
-        user.setForwarding(true);
-        getUserRepository(repositoryName).updateUser(user);
-        return true;
-    }
-
-    /**
      * @see org.apache.james.api.user.management.UserManagementMBean#unsetForwardAddress(java.lang.String, java.lang.String)
      */
     public boolean unsetForwardAddress(String userName, String repositoryName) throws UserManagementException {

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java (original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/AbstractVirtualUserTable.java Sat Oct 16 18:36:40 2010
@@ -30,9 +30,9 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.james.api.vut.ErrorMappingException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.api.vut.VirtualUserTable;
-import org.apache.james.api.vut.management.VirtualUserTableManagement;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTable;
 import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.LogEnabled;
 import org.apache.mailet.MailAddress;
@@ -42,7 +42,7 @@ import org.apache.oro.text.regex.Perl5Co
 /**
  * 
  */
-public abstract class AbstractVirtualUserTable implements VirtualUserTable, VirtualUserTableManagement, LogEnabled, Configurable {       
+public abstract class AbstractVirtualUserTable implements VirtualUserTable, ManageableVirtualUserTable, LogEnabled, Configurable {       
     // The maximum mappings which will process before throwing exception
     private int mappingLimit = 10;
        
@@ -184,13 +184,13 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addRegexMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#addRegexMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean addRegexMapping(String user, String domain, String regex) throws VirtualUserTableManagementException {     
+    public boolean addRegexMapping(String user, String domain, String regex) throws ManageableVirtualUserTableException {     
         try {
             new Perl5Compiler().compile(regex);
         } catch (MalformedPatternException e) {
-            throw new VirtualUserTableManagementException("Invalid regex: " + regex);
+            throw new ManageableVirtualUserTableException("Invalid regex: " + regex);
         }
         
         if (checkMapping(user,domain,regex) == true) {
@@ -203,24 +203,24 @@ public abstract class AbstractVirtualUse
 
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeRegexMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#removeRegexMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean removeRegexMapping(String user, String domain, String regex) throws VirtualUserTableManagementException {
+    public boolean removeRegexMapping(String user, String domain, String regex) throws ManageableVirtualUserTableException {
         getLogger().info("Remove regex mapping => " + regex + " for user: " + user + " domain: " + domain);
         return removeMappingInternal(user,domain,VirtualUserTable.REGEX_PREFIX + regex);
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addAddressMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#addAddressMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean addAddressMapping(String user, String domain, String address) throws VirtualUserTableManagementException {
+    public boolean addAddressMapping(String user, String domain, String address) throws ManageableVirtualUserTableException {
         if (address.indexOf('@') < 0) {
             address =  address + "@localhost";
         } 
         try {
             new MailAddress(address);
         } catch (ParseException e) {
-            throw new VirtualUserTableManagementException("Invalid emailAddress: " + address);
+            throw new ManageableVirtualUserTableException("Invalid emailAddress: " + address);
         }
         if (checkMapping(user,domain,address) == true) {          
             getLogger().info("Add address mapping => " + address + " for user: " + user + " domain: " + domain);
@@ -231,9 +231,9 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeAddressMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#removeAddressMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean removeAddressMapping(String user, String domain, String address) throws VirtualUserTableManagementException {
+    public boolean removeAddressMapping(String user, String domain, String address) throws ManageableVirtualUserTableException {
         if (address.indexOf('@') < 0) {
             address =  address + "@localhost";
         } 
@@ -242,9 +242,9 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addErrorMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#addErrorMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean addErrorMapping(String user, String domain, String error) throws VirtualUserTableManagementException {   
+    public boolean addErrorMapping(String user, String domain, String error) throws ManageableVirtualUserTableException {   
         if (checkMapping(user,domain,error) == true) {          
             getLogger().info("Add error mapping => " + error + " for user: " + user + " domain: " + domain);
             return addMappingInternal(user,domain, VirtualUserTable.ERROR_PREFIX + error);
@@ -254,18 +254,18 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeErrorMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#removeErrorMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean removeErrorMapping(String user, String domain, String error) throws VirtualUserTableManagementException {
+    public boolean removeErrorMapping(String user, String domain, String error) throws ManageableVirtualUserTableException {
         getLogger().info("Remove error mapping => " + error + " for user: " + user + " domain: " + domain);     
         return removeMappingInternal(user,domain,VirtualUserTable.ERROR_PREFIX + error);
     }
 
 
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#addMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean addMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException {
+    public boolean addMapping(String user, String domain, String mapping) throws ManageableVirtualUserTableException {
 
         String map = mapping.toLowerCase();
         
@@ -274,7 +274,7 @@ public abstract class AbstractVirtualUse
         } else if (map.startsWith(VirtualUserTable.REGEX_PREFIX)) {
             return addRegexMapping(user,domain,map.substring(VirtualUserTable.REGEX_PREFIX.length()));
         } else if (map.startsWith(VirtualUserTable.ALIASDOMAIN_PREFIX)) {
-            if (user != null) throw new VirtualUserTableManagementException("User must be null for aliasDomain mappings");
+            if (user != null) throw new ManageableVirtualUserTableException("User must be null for aliasDomain mappings");
             return addAliasDomainMapping(domain,map.substring(VirtualUserTable.ALIASDOMAIN_PREFIX.length()));
         } else {
             return addAddressMapping(user,domain,map);
@@ -283,9 +283,9 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeMapping(java.lang.String, java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#removeMapping(java.lang.String, java.lang.String, java.lang.String)
      */
-    public boolean removeMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException {
+    public boolean removeMapping(String user, String domain, String mapping) throws ManageableVirtualUserTableException {
 
         String map = mapping.toLowerCase();
     
@@ -294,7 +294,7 @@ public abstract class AbstractVirtualUse
         } else if (map.startsWith(VirtualUserTable.REGEX_PREFIX)) {
             return removeRegexMapping(user,domain,map.substring(VirtualUserTable.REGEX_PREFIX.length()));
         } else if (map.startsWith(VirtualUserTable.ALIASDOMAIN_PREFIX)) {
-            if (user != null) throw new VirtualUserTableManagementException("User must be null for aliasDomain mappings");
+            if (user != null) throw new ManageableVirtualUserTableException("User must be null for aliasDomain mappings");
             return removeAliasDomainMapping(domain,map.substring(VirtualUserTable.ALIASDOMAIN_PREFIX.length()));
         } else {
             return removeAddressMapping(user,domain,map);
@@ -303,7 +303,7 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#getAllMappings()
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#getAllMappings()
      */
     public Map<String,Collection<String>> getAllMappings() {
         int count = 0;
@@ -317,24 +317,24 @@ public abstract class AbstractVirtualUse
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#getUserDomainMappings(java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#getUserDomainMappings(java.lang.String, java.lang.String)
      */
     public Collection<String> getUserDomainMappings(String user, String domain) {
         return getUserDomainMappingsInternal(user, domain);
     }
 
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#addAliasDomainMapping(java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#addAliasDomainMapping(java.lang.String, java.lang.String)
      */
-    public synchronized boolean addAliasDomainMapping(String aliasDomain, String realDomain) throws VirtualUserTableManagementException {
+    public synchronized boolean addAliasDomainMapping(String aliasDomain, String realDomain) throws ManageableVirtualUserTableException {
         getLogger().info("Add domain mapping: " + aliasDomain  + " => " + realDomain);
         return addMappingInternal(null, aliasDomain, VirtualUserTable.ALIASDOMAIN_PREFIX + realDomain);
     }
     
     /**
-     * @see org.apache.james.api.vut.management.VirtualUserTableManagement#removeAliasDomainMapping(java.lang.String, java.lang.String)
+     * @see org.apache.james.api.vut.ManageableVirtualUserTable#removeAliasDomainMapping(java.lang.String, java.lang.String)
      */
-    public synchronized boolean removeAliasDomainMapping(String aliasDomain, String realDomain) throws VirtualUserTableManagementException {
+    public synchronized boolean removeAliasDomainMapping(String aliasDomain, String realDomain) throws ManageableVirtualUserTableException {
         getLogger().info("Remove domain mapping: " + aliasDomain  + " => " + realDomain);
         return removeMappingInternal(null, aliasDomain, VirtualUserTable.ALIASDOMAIN_PREFIX + realDomain);
     }
@@ -352,7 +352,7 @@ public abstract class AbstractVirtualUse
      * @return true if successfully
      * @throws InvalidMappingException 
      */
-    protected abstract boolean  addMappingInternal(String user, String domain, String mapping) throws VirtualUserTableManagementException;
+    protected abstract boolean  addMappingInternal(String user, String domain, String mapping) throws ManageableVirtualUserTableException;
     
     /**
      * Remove mapping 
@@ -363,7 +363,7 @@ public abstract class AbstractVirtualUse
      * @return true if successfully
      * @throws InvalidMappingException 
      */
-    protected abstract boolean  removeMappingInternal(String user, String domain, String mapping) throws VirtualUserTableManagementException;
+    protected abstract boolean  removeMappingInternal(String user, String domain, String mapping) throws ManageableVirtualUserTableException;
 
     /**
      * Return Collection of all mappings for the given username and domain

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/JamesVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/JamesVirtualUserTable.java?rev=1023349&r1=1023348&r2=1023349&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/JamesVirtualUserTable.java (original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/JamesVirtualUserTable.java Sat Oct 16 18:36:40 2010
@@ -30,15 +30,15 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.james.api.vut.ErrorMappingException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.api.vut.VirtualUserTable;
-import org.apache.james.api.vut.management.VirtualUserTableManagement;
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTable;
 import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.Disposable;
 import org.apache.james.lifecycle.LogEnabled;
 import org.apache.james.services.InstanceFactory;
 
-public class JamesVirtualUserTable implements VirtualUserTableManagement, Configurable, LogEnabled{
+public class JamesVirtualUserTable implements ManageableVirtualUserTable, Configurable, LogEnabled{
 
 	private HierarchicalConfiguration config;
 	private Log log;
@@ -101,74 +101,74 @@ public class JamesVirtualUserTable imple
 	}
 
 	public boolean addAddressMapping(String user, String domain, String address)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().addAddressMapping(user, domain, address);
 	}
 
 	public boolean addAliasDomainMapping(String aliasDomain, String realDomain)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().addAliasDomainMapping(aliasDomain, realDomain);
 	}
 
 	public boolean addErrorMapping(String user, String domain, String error)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().addErrorMapping(user, domain, error);
 	}
 
 	public boolean addMapping(String user, String domain, String mapping)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().addMapping(user, domain, mapping);
 	}
 
 	public boolean addRegexMapping(String user, String domain, String regex)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().addRegexMapping(user, domain, regex);
 	}
 
 	public Map<String, Collection<String>> getAllMappings() {
 		try {
 			return getManagement().getAllMappings();
-		} catch (VirtualUserTableManagementException e) {
+		} catch (ManageableVirtualUserTableException e) {
 			return new HashMap<String, Collection<String>>();
 		}
 	}
 
 	public Collection<String> getUserDomainMappings(String user, String domain)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().getUserDomainMappings(user, domain);
 	}
 
 	public boolean removeAddressMapping(String user, String domain,
-			String address) throws VirtualUserTableManagementException {
+			String address) throws ManageableVirtualUserTableException {
 		return getManagement().removeAddressMapping(user, domain, address);
 	}
 
 	public boolean removeAliasDomainMapping(String aliasDomain,
-			String realDomain) throws VirtualUserTableManagementException {
+			String realDomain) throws ManageableVirtualUserTableException {
 		return getManagement().removeAliasDomainMapping(aliasDomain, realDomain);
 
 	}
 
 	public boolean removeErrorMapping(String user, String domain, String error)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().removeErrorMapping(user, domain, error);
 	}
 
 	public boolean removeMapping(String user, String domain, String mapping)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().removeMapping(user, domain, mapping);
 	}
 
 	public boolean removeRegexMapping(String user, String domain, String regex)
-			throws VirtualUserTableManagementException {
+			throws ManageableVirtualUserTableException {
 		return getManagement().removeRegexMapping(user, domain, regex);
 	}
 	
-	private VirtualUserTableManagement getManagement() throws VirtualUserTableManagementException{
-		if (vut instanceof VirtualUserTableManagement) {
-			return (VirtualUserTableManagement) vut;
+	private ManageableVirtualUserTable getManagement() throws ManageableVirtualUserTableException{
+		if (vut instanceof ManageableVirtualUserTable) {
+			return (ManageableVirtualUserTable) vut;
 		} else {
-			throw new VirtualUserTableManagementException("VirtualUserTable implementation is not managable");
+			throw new ManageableVirtualUserTableException("VirtualUserTable implementation is not managable");
 		}
 	}
     

Copied: james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagement.java (from r1022543, james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagementMBeanImpl.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagement.java?p2=james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagement.java&p1=james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagementMBeanImpl.java&r1=1022543&r2=1023349&rev=1023349&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagementMBeanImpl.java (original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/impl/vut/VirtualUserTableManagement.java Sat Oct 16 18:36:40 2010
@@ -21,11 +21,12 @@
 
 package org.apache.james.impl.vut;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 import javax.annotation.Resource;
 
-import org.apache.james.api.vut.management.VirtualUserTableManagementException;
+import org.apache.james.api.vut.ManageableVirtualUserTableException;
 import org.apache.james.api.vut.management.VirtualUserTableManagementMBean;
 
 
@@ -33,58 +34,93 @@ import org.apache.james.api.vut.manageme
  * Management for VirtualUserTables
  * 
  */
-public class VirtualUserTableManagementMBeanImpl implements VirtualUserTableManagementMBean {
+public class VirtualUserTableManagement implements VirtualUserTableManagementMBean {
 
-    private org.apache.james.api.vut.management.VirtualUserTableManagement vut;    
+    private org.apache.james.api.vut.ManageableVirtualUserTable vut;    
 
-    @Resource(name="virtualusertablemanagement")
-    public void setVirtualUserTableManagement(org.apache.james.api.vut.management.VirtualUserTableManagement vut) {
+    @Resource(name="manageablevirtualusertable")
+    public void setManageableVirtualUserTable(org.apache.james.api.vut.ManageableVirtualUserTable vut) {
         this.vut = vut;
     }
     
 
-    public boolean addAddressMapping(String user, String domain, String address) throws  VirtualUserTableManagementException {
-        return vut.addAddressMapping(user, domain, address);
+    public boolean addAddressMapping(String user, String domain, String address) {
+        try {
+            return vut.addAddressMapping(user, domain, address);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        }
     }
 
-    public boolean addErrorMapping(String user, String domain, String error) throws VirtualUserTableManagementException {
-        return vut.addErrorMapping(user, domain, error);  
+    public boolean addErrorMapping(String user, String domain, String error) {
+        try {
+            return vut.addErrorMapping(user, domain, error); 
+        } catch (ManageableVirtualUserTableException e){
+            return false;
+        }
     }
 
     
-    public boolean addRegexMapping(String user, String domain, String regex) throws VirtualUserTableManagementException {
-        return vut.addRegexMapping(user, domain, regex);  
+    public boolean addRegexMapping(String user, String domain, String regex) {
+        try {
+            return vut.addRegexMapping(user, domain, regex);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        }  
     }
 
 
-    public Collection<String> getUserDomainMappings(String user, String domain) throws VirtualUserTableManagementException {
-        return vut.getUserDomainMappings(user, domain);
+    public Collection<String> getUserDomainMappings(String user, String domain) {
+        try {
+            return vut.getUserDomainMappings(user, domain);
+        } catch (ManageableVirtualUserTableException e) {
+            return new ArrayList<String>();
+        }
     }
 
 
-    public boolean removeErrorMapping(String user, String domain, String error) throws VirtualUserTableManagementException {
-        return vut.removeErrorMapping(user, domain, error);
-    }
-
-    public boolean removeRegexMapping(String user, String domain, String regex) throws VirtualUserTableManagementException {
-        return vut.removeRegexMapping(user, domain, regex);
+    public boolean removeErrorMapping(String user, String domain, String error) {
+        try {
+            return vut.removeErrorMapping(user, domain, error);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        }
+    }
+
+    public boolean removeRegexMapping(String user, String domain, String regex) {
+        try {
+            return vut.removeRegexMapping(user, domain, regex);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        }
     }
 
    
-    public boolean addMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException {
-        return vut.addMapping(user, domain, mapping);
+    public boolean addMapping(String user, String domain, String mapping) {
+        try {
+            return vut.addMapping(user, domain, mapping);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        }
     }
 
 
-    public boolean removeMapping(String user, String domain, String mapping) throws VirtualUserTableManagementException {
-        return vut.removeMapping(user, domain, mapping); 
+    public boolean removeMapping(String user, String domain, String mapping) {
+        try {
+            return vut.removeMapping(user, domain, mapping);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        } 
     }
 
 
-	public boolean removeAddressMapping(String user,String domain, String address)
-			throws VirtualUserTableManagementException {
-		return vut.removeAddressMapping(user, domain, address);
-	       
-	}
+    public boolean removeAddressMapping(String user, String domain, String address) {
+        try {
+            return vut.removeAddressMapping(user, domain, address);
+        } catch (ManageableVirtualUserTableException e) {
+            return false;
+        }
+
+    }
 
 }



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