org.apache.james.impl.vut
Class DefaultVirtualUserTable

java.lang.Object
  extended by org.apache.james.impl.vut.DefaultVirtualUserTable
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.service.Serviceable, VirtualUserTableManagement, VirtualUserTable

public class DefaultVirtualUserTable
extends java.lang.Object
implements VirtualUserTableManagement, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Initializable

Default VirtualUserTable


Field Summary
 
Fields inherited from interface org.apache.james.api.vut.management.VirtualUserTableManagement
ROLE
 
Fields inherited from interface org.apache.james.api.vut.VirtualUserTable
ALIASDOMAIN_PREFIX, ERROR_PREFIX, REGEX_PREFIX
 
Constructor Summary
DefaultVirtualUserTable()
           
 
Method Summary
 boolean addAddressMapping(java.lang.String user, java.lang.String domain, java.lang.String address)
          Add address mapping
 boolean addAliasDomainMapping(java.lang.String aliasDomain, java.lang.String realDomain)
          Add aliasDomain mapping
 boolean addErrorMapping(java.lang.String user, java.lang.String domain, java.lang.String error)
          Add error mapping
 boolean addMapping(java.lang.String user, java.lang.String domain, java.lang.String mapping)
          Add mapping
 boolean addRegexMapping(java.lang.String user, java.lang.String domain, java.lang.String regex)
          Add regex mapping
 java.util.Map getAllMappings()
          Return a Map which holds all mappings.
 java.util.Collection getMappings(java.lang.String user, java.lang.String domain)
          Return the mapped MailAddress for the given address.
 java.util.Collection getUserDomainMappings(java.lang.String user, java.lang.String domain)
          Return the explicit mapping stored for the given user and domain.
 void initialize()
           
 boolean removeAddressMapping(java.lang.String user, java.lang.String domain, java.lang.String address)
          Remove address mapping
 boolean removeAliasDomainMapping(java.lang.String aliasDomain, java.lang.String realDomain)
          Remove aliasDomain mapping
 boolean removeErrorMapping(java.lang.String user, java.lang.String domain, java.lang.String error)
          Remove error mapping
 boolean removeMapping(java.lang.String user, java.lang.String domain, java.lang.String mapping)
          Remove mapping
 boolean removeRegexMapping(java.lang.String user, java.lang.String domain, java.lang.String regex)
          Remove regex mapping
 void service(org.apache.avalon.framework.service.ServiceManager arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultVirtualUserTable

public DefaultVirtualUserTable()
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception
See Also:
Initializable.initialize()

service

public void service(org.apache.avalon.framework.service.ServiceManager arg0)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

addAddressMapping

public boolean addAddressMapping(java.lang.String user,
                                 java.lang.String domain,
                                 java.lang.String address)
                          throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Add address mapping

Specified by:
addAddressMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
Returns:
true if successfully
Throws:
InvalidMappingException - get thrown if an invalid argument was given
See Also:
VirtualUserTableManagement.addAddressMapping(java.lang.String, java.lang.String, java.lang.String)

addErrorMapping

public boolean addErrorMapping(java.lang.String user,
                               java.lang.String domain,
                               java.lang.String error)
                        throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Add error mapping

Specified by:
addErrorMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
error - the regex.
Returns:
true if successfully
Throws:
InvalidMappingException - get thrown if an invalid argument was given
See Also:
VirtualUserTableManagement.addErrorMapping(java.lang.String, java.lang.String, java.lang.String)

addRegexMapping

public boolean addRegexMapping(java.lang.String user,
                               java.lang.String domain,
                               java.lang.String regex)
                        throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Add regex mapping

Specified by:
addRegexMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
regex - the regex.
Returns:
true if successfully
Throws:
InvalidMappingException - get thrown if an invalid argument was given
See Also:
VirtualUserTableManagement.addRegexMapping(java.lang.String, java.lang.String, java.lang.String)

getUserDomainMappings

public java.util.Collection getUserDomainMappings(java.lang.String user,
                                                  java.lang.String domain)
                                           throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Return the explicit mapping stored for the given user and domain. Return null if no mapping was found

Specified by:
getUserDomainMappings in interface VirtualUserTableManagement
Parameters:
user - the username
domain - the domain
Returns:
the collection which holds the mappings.
Throws:
InvalidMappingException - get thrown if an invalid use or domain was given
See Also:
VirtualUserTableManagement.getUserDomainMappings(java.lang.String, java.lang.String)

removeAddressMapping

public boolean removeAddressMapping(java.lang.String user,
                                    java.lang.String domain,
                                    java.lang.String address)
                             throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Remove address mapping

Specified by:
removeAddressMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
Returns:
true if successfully
Throws:
InvalidMappingException - get thrown if an invalid argument was given
See Also:
VirtualUserTableManagement.removeAddressMapping(java.lang.String, java.lang.String, java.lang.String)

removeErrorMapping

public boolean removeErrorMapping(java.lang.String user,
                                  java.lang.String domain,
                                  java.lang.String error)
                           throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Remove error mapping

Specified by:
removeErrorMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
Returns:
true if successfully
Throws:
InvalidMappingException - get thrown if an invalid argument was given
See Also:
VirtualUserTableManagement.removeErrorMapping(java.lang.String, java.lang.String, java.lang.String)

removeRegexMapping

public boolean removeRegexMapping(java.lang.String user,
                                  java.lang.String domain,
                                  java.lang.String regex)
                           throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Remove regex mapping

Specified by:
removeRegexMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
regex - the regex.
Returns:
true if successfully
Throws:
InvalidMappingException - get thrown if an invalid argument was given
See Also:
VirtualUserTableManagement.removeRegexMapping(java.lang.String, java.lang.String, java.lang.String)

getMappings

public java.util.Collection getMappings(java.lang.String user,
                                        java.lang.String domain)
                                 throws ErrorMappingException
Description copied from interface: VirtualUserTable
Return the mapped MailAddress for the given address. Return null if no matched mapping was found

Specified by:
getMappings in interface VirtualUserTable
Parameters:
user - the MailAddress
Returns:
the mapped mailAddress
Throws:
ErrorMappingException - get thrown if an error mapping was found
See Also:
VirtualUserTable.getMappings(java.lang.String, java.lang.String)

addMapping

public boolean addMapping(java.lang.String user,
                          java.lang.String domain,
                          java.lang.String mapping)
                   throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Add mapping

Specified by:
addMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
mapping - the mapping
Returns:
true if successfully
Throws:
InvalidMappingException
See Also:
VirtualUserTableManagement.addMapping(java.lang.String, java.lang.String, java.lang.String)

removeMapping

public boolean removeMapping(java.lang.String user,
                             java.lang.String domain,
                             java.lang.String mapping)
                      throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Remove mapping

Specified by:
removeMapping in interface VirtualUserTableManagement
Parameters:
user - the username. Null if no username should be used
domain - the domain. Null if no domain should be used
mapping - the mapping
Returns:
true if successfully
Throws:
InvalidMappingException
See Also:
VirtualUserTableManagement.removeMapping(java.lang.String, java.lang.String, java.lang.String)

getAllMappings

public java.util.Map getAllMappings()
Description copied from interface: VirtualUserTableManagement
Return a Map which holds all mappings. The key is the user@domain and the value is a Collection which holds all mappings

Specified by:
getAllMappings in interface VirtualUserTableManagement
Returns:
Map which holds all mappings
See Also:
VirtualUserTableManagement.getAllMappings()

addAliasDomainMapping

public boolean addAliasDomainMapping(java.lang.String aliasDomain,
                                     java.lang.String realDomain)
                              throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Add aliasDomain mapping

Specified by:
addAliasDomainMapping in interface VirtualUserTableManagement
Parameters:
aliasDomain - the aliasdomain which should be mapped to the realDomain
realDomain - the realDomain
Returns:
true if successfilly
Throws:
InvalidMappingException
See Also:
VirtualUserTableManagement.addAliasDomainMapping(String, String)

removeAliasDomainMapping

public boolean removeAliasDomainMapping(java.lang.String aliasDomain,
                                        java.lang.String realDomain)
                                 throws InvalidMappingException
Description copied from interface: VirtualUserTableManagement
Remove aliasDomain mapping

Specified by:
removeAliasDomainMapping in interface VirtualUserTableManagement
Parameters:
aliasDomain - the aliasdomain which should be mapped to the realDomain
realDomain - the realDomain
Returns:
true if successfilly
Throws:
InvalidMappingException
See Also:
VirtualUserTableManagement.removeAliasDomainMapping(String, String)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.