Class ConfigurableUserManager
- java.lang.Object
-
- org.apache.archiva.redback.users.AbstractUserManager
-
- org.apache.archiva.redback.users.configurable.ConfigurableUserManager
-
- All Implemented Interfaces:
UserManager
@Service("userManager#configurable") public class ConfigurableUserManager extends AbstractUserManager implements UserManager
- Author:
- jesse
-
-
Field Summary
-
Fields inherited from class org.apache.archiva.redback.users.AbstractUserManager
log
-
Fields inherited from interface org.apache.archiva.redback.users.UserManager
GUEST_USERNAME
-
-
Constructor Summary
Constructors Constructor Description ConfigurableUserManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description User
addUser(User user)
Add a User.void
addUserUnchecked(User user)
Add a user to the database without checking for consistency or adjusting the password.User
createUser(String username, String fullName, String emailAddress)
Factory method to create new User Objects based on provider specific implementation.UserQuery
createUserQuery()
Factory method to createUserQuery
s based on provider specific implementations.void
deleteUser(String username)
Delete a user using the username.void
eraseDatabase()
User
findUser(String username)
Find a User using a User name.User
findUser(String username, boolean useCache)
Find a User using a User name.List<? extends User>
findUsersByEmailKey(String emailKey, boolean orderAscending)
List<? extends User>
findUsersByFullNameKey(String fullNameKey, boolean orderAscending)
List<? extends User>
findUsersByQuery(UserQuery query)
Find users matching properties, ordering and range as specified by theUserQuery
.List<? extends User>
findUsersByUsernameKey(String usernameKey, boolean orderAscending)
String
getDescriptionKey()
User
getGuestUser()
Get the guest user.String
getId()
An Identifier for the UserManager.List<? extends User>
getUsers()
Get the List ofUser
objects.List<? extends User>
getUsers(boolean orderAscending)
void
initialize()
consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.boolean
isReadOnly()
Is the UserManager read only? if so then create and modify actions are to be disabledvoid
setUserManagerImpl(UserManager userManagerImpl)
User
updateUser(User user)
Update a User.User
updateUser(User user, boolean passwordChangeRequired)
boolean
userExists(String userName)
true if the user exists, false if it doesn't-
Methods inherited from class org.apache.archiva.redback.users.AbstractUserManager
addUserManagerListener, createGuestUser, fireUserManagerInit, fireUserManagerUserAdded, fireUserManagerUserRemoved, fireUserManagerUserUpdated, getListeners, isFinalImplementation, removeUserManagerListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.archiva.redback.users.UserManager
addUserManagerListener, createGuestUser, isFinalImplementation, removeUserManagerListener
-
-
-
-
Constructor Detail
-
ConfigurableUserManager
public ConfigurableUserManager()
-
-
Method Detail
-
initialize
@PostConstruct public void initialize()
Description copied from interface:UserManager
consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.- Specified by:
initialize
in interfaceUserManager
- Overrides:
initialize
in classAbstractUserManager
-
addUser
public User addUser(User user) throws UserManagerException
Description copied from interface:UserManager
Add a User.- Specified by:
addUser
in interfaceUserManager
- Parameters:
user
- the user to add.- Returns:
- the user that was just added.
- Throws:
UserManagerException
-
addUserUnchecked
public void addUserUnchecked(User user) throws UserManagerException
Description copied from interface:UserManager
Add a user to the database without checking for consistency or adjusting the password. Should only be used for re-importing known-good data.- Specified by:
addUserUnchecked
in interfaceUserManager
- Parameters:
user
- the user to add- Throws:
UserManagerException
-
createUser
public User createUser(String username, String fullName, String emailAddress) throws UserManagerException
Description copied from interface:UserManager
Factory method to create new User Objects based on provider specific implementation. User objects created this way do not exist in the provider's underlying data store until a call toUserManager.addUser(User)
is made.- Specified by:
createUser
in interfaceUserManager
- Parameters:
username
- the username for this user.fullName
- the full name for this user.emailAddress
- the email address for this user.- Returns:
- the new user object ready to use.
- Throws:
UserManagerException
-
createUserQuery
public UserQuery createUserQuery()
Description copied from interface:UserManager
Factory method to createUserQuery
s based on provider specific implementations.- Specified by:
createUserQuery
in interfaceUserManager
- Returns:
- the provider implementation of UserQuery
-
deleteUser
public void deleteUser(String username) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Delete a user using the username.- Specified by:
deleteUser
in interfaceUserManager
- Parameters:
username
- the username to look for.- Throws:
UserNotFoundException
- the user was not found.UserManagerException
-
eraseDatabase
public void eraseDatabase()
- Specified by:
eraseDatabase
in interfaceUserManager
-
findUser
public User findUser(String username) throws UserManagerException, UserNotFoundException
Description copied from interface:UserManager
Find a User using a User name.- Specified by:
findUser
in interfaceUserManager
- Parameters:
username
- the username to find.- Returns:
- the user.
- Throws:
UserNotFoundException
- if the user was not found.UserManagerException
-
findUser
public User findUser(String username, boolean useCache) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Find a User using a User name.- Specified by:
findUser
in interfaceUserManager
- Parameters:
username
- the username to find.useCache
- to use or not caching- Returns:
- the user.
- Throws:
UserNotFoundException
- if the user was not found.UserManagerException
-
getGuestUser
public User getGuestUser() throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Get the guest user.- Specified by:
getGuestUser
in interfaceUserManager
- Overrides:
getGuestUser
in classAbstractUserManager
- Returns:
- the guest user.
- Throws:
UserNotFoundException
UserManagerException
-
findUsersByEmailKey
public List<? extends User> findUsersByEmailKey(String emailKey, boolean orderAscending) throws UserManagerException
- Specified by:
findUsersByEmailKey
in interfaceUserManager
- Throws:
UserManagerException
-
findUsersByFullNameKey
public List<? extends User> findUsersByFullNameKey(String fullNameKey, boolean orderAscending) throws UserManagerException
- Specified by:
findUsersByFullNameKey
in interfaceUserManager
- Throws:
UserManagerException
-
findUsersByQuery
public List<? extends User> findUsersByQuery(UserQuery query) throws UserManagerException
Description copied from interface:UserManager
Find users matching properties, ordering and range as specified by theUserQuery
.- Specified by:
findUsersByQuery
in interfaceUserManager
- Parameters:
query
- the query.- Returns:
- a List of
User
objects. - Throws:
UserManagerException
-
findUsersByUsernameKey
public List<? extends User> findUsersByUsernameKey(String usernameKey, boolean orderAscending) throws UserManagerException
- Specified by:
findUsersByUsernameKey
in interfaceUserManager
- Throws:
UserManagerException
-
getId
public String getId()
Description copied from interface:UserManager
An Identifier for the UserManager.- Specified by:
getId
in interfaceUserManager
- Returns:
- the user manager identifier.
-
getUsers
public List<? extends User> getUsers() throws UserManagerException
Description copied from interface:UserManager
Get the List ofUser
objects.- Specified by:
getUsers
in interfaceUserManager
- Returns:
- the List of
User
Objects. - Throws:
UserManagerException
-
getUsers
public List<? extends User> getUsers(boolean orderAscending) throws UserManagerException
- Specified by:
getUsers
in interfaceUserManager
- Throws:
UserManagerException
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:UserManager
Is the UserManager read only? if so then create and modify actions are to be disabled- Specified by:
isReadOnly
in interfaceUserManager
- Returns:
- boolean true if user manager is disabled
-
updateUser
public User updateUser(User user) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Update a User.- Specified by:
updateUser
in interfaceUserManager
- Parameters:
user
- the user to update.- Returns:
- the user that was just updated.
- Throws:
UserNotFoundException
- if the user was not found to update.UserManagerException
-
updateUser
public User updateUser(User user, boolean passwordChangeRequired) throws UserNotFoundException, UserManagerException
- Specified by:
updateUser
in interfaceUserManager
- Throws:
UserNotFoundException
UserManagerException
-
userExists
public boolean userExists(String userName) throws UserManagerException
Description copied from interface:UserManager
true if the user exists, false if it doesn't- Specified by:
userExists
in interfaceUserManager
- Returns:
- true, if user exists
- Throws:
UserManagerException
-
setUserManagerImpl
public void setUserManagerImpl(UserManager userManagerImpl)
-
getDescriptionKey
public String getDescriptionKey()
- Specified by:
getDescriptionKey
in interfaceUserManager
- Returns:
- a key to be able to customize label in UI
-
-