org.apache.james.impl.user
Class UserManagement

java.lang.Object
  extended by org.apache.james.impl.user.UserManagement
All Implemented Interfaces:
org.apache.avalon.framework.service.Serviceable, UserManagementMBean

public class UserManagement
extends java.lang.Object
implements UserManagementMBean, org.apache.avalon.framework.service.Serviceable


Constructor Summary
UserManagement()
           
 
Method Summary
 boolean addUser(java.lang.String userName, java.lang.String password, java.lang.String repositoryName)
          Adds a user to this mail server.
 long countUsers(java.lang.String repositoryName)
          Total count of existing users
 boolean deleteUser(java.lang.String userName, java.lang.String repositoryName)
          Deletes a user from this mail server.
 java.lang.String getAlias(java.lang.String userName, java.lang.String repositoryName)
          Retrieves the user's alias, if set
 java.lang.String getForwardAddress(java.lang.String userName, java.lang.String repositoryName)
          Retrieves the user's forward, if set
 java.util.List getUserRepositoryNames()
          Retrieves a list of the names of all available user repositories
 java.lang.String[] listAllUsers(java.lang.String repositoryName)
          List the names of all users
 void service(org.apache.avalon.framework.service.ServiceManager componentManager)
           
 boolean setAlias(java.lang.String userName, java.lang.String aliasUserName, java.lang.String repositoryName)
          Set a user's alias to whom all mail is forwarded to
 boolean setForwardAddress(java.lang.String userName, java.lang.String forwardEmailAddress, java.lang.String repositoryName)
          Set a user's forward email address to whom all mail is forwarded to
 void setLocalUsers(UsersRepository localUsers)
           
 boolean setPassword(java.lang.String userName, java.lang.String password, java.lang.String repositoryName)
          Set a user's password
 void setUsersStore(UsersStore usersStore)
           
 boolean unsetAlias(java.lang.String userName, java.lang.String repositoryName)
          Removes a user's alias which terminates local mail forwarding
 boolean unsetForwardAddress(java.lang.String userName, java.lang.String repositoryName)
          Removes a user's forward email address which terminates remote mail forwarding
 boolean verifyExists(java.lang.String userName, java.lang.String repositoryName)
          Check if a user exists with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManagement

public UserManagement()
Method Detail

setLocalUsers

public void setLocalUsers(UsersRepository localUsers)

setUsersStore

public void setUsersStore(UsersStore usersStore)

service

public void service(org.apache.avalon.framework.service.ServiceManager componentManager)
             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)

addUser

public boolean addUser(java.lang.String userName,
                       java.lang.String password,
                       java.lang.String repositoryName)
                throws UserManagementException
Description copied from interface: UserManagementMBean
Adds a user to this mail server.

Specified by:
addUser in interface UserManagementMBean
Parameters:
userName - The name of the user being added
password - The password of the user being added
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the operation was successfull
Throws:
UserManagementException
See Also:
UserManagementMBean.addUser(java.lang.String, java.lang.String, java.lang.String)

deleteUser

public boolean deleteUser(java.lang.String userName,
                          java.lang.String repositoryName)
                   throws UserManagementException
Description copied from interface: UserManagementMBean
Deletes a user from this mail server.

Specified by:
deleteUser in interface UserManagementMBean
Parameters:
userName - The name of the user being deleted
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the operation was successfull
Throws:
UserManagementException
See Also:
UserManagementMBean.deleteUser(java.lang.String, java.lang.String)

verifyExists

public boolean verifyExists(java.lang.String userName,
                            java.lang.String repositoryName)
                     throws UserManagementException
Description copied from interface: UserManagementMBean
Check if a user exists with the given name.

Specified by:
verifyExists in interface UserManagementMBean
Parameters:
userName - The name of the user
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
TRUE, if the user exists
Throws:
UserManagementException
See Also:
UserManagementMBean.verifyExists(java.lang.String, java.lang.String)

countUsers

public long countUsers(java.lang.String repositoryName)
                throws UserManagementException
Description copied from interface: UserManagementMBean
Total count of existing users

Specified by:
countUsers in interface UserManagementMBean
Parameters:
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
Total count of existing users
Throws:
UserManagementException
See Also:
UserManagementMBean.countUsers(java.lang.String)

listAllUsers

public java.lang.String[] listAllUsers(java.lang.String repositoryName)
                                throws UserManagementException
Description copied from interface: UserManagementMBean
List the names of all users

Specified by:
listAllUsers in interface UserManagementMBean
Parameters:
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
List of all user names
Throws:
UserManagementException
See Also:
UserManagementMBean.listAllUsers(java.lang.String)

setPassword

public boolean setPassword(java.lang.String userName,
                           java.lang.String password,
                           java.lang.String repositoryName)
                    throws UserManagementException
Description copied from interface: UserManagementMBean
Set a user's password

Specified by:
setPassword in interface UserManagementMBean
Parameters:
userName - The name of the user whose password will be changed
password - The new password
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the user has been found and the password was changed successfully
Throws:
UserManagementException
See Also:
UserManagementMBean.setPassword(java.lang.String, java.lang.String, java.lang.String)

setAlias

public boolean setAlias(java.lang.String userName,
                        java.lang.String aliasUserName,
                        java.lang.String repositoryName)
                 throws UserManagementException
Description copied from interface: UserManagementMBean
Set a user's alias to whom all mail is forwarded to

Specified by:
setAlias in interface UserManagementMBean
Parameters:
userName - The name of the user whose alias is set
aliasUserName - The user becoming the new alias
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the user has been found and the password was changed successfully
Throws:
UserManagementException
See Also:
UserManagementMBean.setAlias(java.lang.String, java.lang.String, java.lang.String)

unsetAlias

public boolean unsetAlias(java.lang.String userName,
                          java.lang.String repositoryName)
                   throws UserManagementException
Description copied from interface: UserManagementMBean
Removes a user's alias which terminates local mail forwarding

Specified by:
unsetAlias in interface UserManagementMBean
Parameters:
userName - The name of the user whose alias is unset
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the user has been found and the alias was removed
Throws:
UserManagementException
See Also:
UserManagementMBean.unsetAlias(java.lang.String, java.lang.String)

getAlias

public java.lang.String getAlias(java.lang.String userName,
                                 java.lang.String repositoryName)
                          throws UserManagementException
Description copied from interface: UserManagementMBean
Retrieves the user's alias, if set

Specified by:
getAlias in interface UserManagementMBean
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
User's alias, or NULL, if no alias is set
Throws:
UserManagementException
See Also:
UserManagementMBean.getAlias(java.lang.String, java.lang.String)

setForwardAddress

public boolean setForwardAddress(java.lang.String userName,
                                 java.lang.String forwardEmailAddress,
                                 java.lang.String repositoryName)
                          throws UserManagementException
Description copied from interface: UserManagementMBean
Set a user's forward email address to whom all mail is forwarded to

Specified by:
setForwardAddress in interface UserManagementMBean
Parameters:
userName - The name of the user whose forward is set
forwardEmailAddress - The new forward email address
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the user has been found and the password was changed successfully
Throws:
UserManagementException
See Also:
UserManagementMBean.setForwardAddress(java.lang.String, java.lang.String, java.lang.String)

unsetForwardAddress

public boolean unsetForwardAddress(java.lang.String userName,
                                   java.lang.String repositoryName)
                            throws UserManagementException
Description copied from interface: UserManagementMBean
Removes a user's forward email address which terminates remote mail forwarding

Specified by:
unsetForwardAddress in interface UserManagementMBean
Parameters:
userName - The name of the user whose forward is unset
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
if the user has been found and the forward was removed
Throws:
UserManagementException
See Also:
UserManagementMBean.unsetForwardAddress(java.lang.String, java.lang.String)

getForwardAddress

public java.lang.String getForwardAddress(java.lang.String userName,
                                          java.lang.String repositoryName)
                                   throws UserManagementException
Description copied from interface: UserManagementMBean
Retrieves the user's forward, if set

Specified by:
getForwardAddress in interface UserManagementMBean
Parameters:
userName - The name of the user whose forward is set
repositoryName - The user repository, to which the operation should be applied. If NULL, the LocalUsers repository is used.
Returns:
User's forward email address, or NULL, if no forward is set
Throws:
UserManagementException
See Also:
UserManagementMBean.getForwardAddress(java.lang.String, java.lang.String)

getUserRepositoryNames

public java.util.List getUserRepositoryNames()
Description copied from interface: UserManagementMBean
Retrieves a list of the names of all available user repositories

Specified by:
getUserRepositoryNames in interface UserManagementMBean
Returns:
List of repository names
See Also:
UserManagementMBean.getUserRepositoryNames()


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