Class MappedUserProvider

java.lang.Object
org.jivesoftware.openfire.user.UserMultiProvider
org.jivesoftware.openfire.user.MappedUserProvider
All Implemented Interfaces:
UserProvider

public class MappedUserProvider extends UserMultiProvider
A UserProvider that delegates to a user-specific UserProvider. This class related to, but is distinct from HybridUserProvider. The Hybrid variant of the provider iterates over providers, operating on the first applicable instance. This Mapped variant, however, maps each user to exactly one provider. To use this provider, use the following system property definition:
  • provider.user.className = org.jivesoftware.openfire.user.MappedUserProvider
To be usable, a UserProviderMapper must be configured using the mappedUserProvider.mapper.className system property. It is of importance to note that most UserProviderMapper implementations will require additional configuration.
Author:
Guus der Kinderen, guus@goodbytes.nl
See Also:
  • Field Details

    • PROPERTY_MAPPER_CLASSNAME

      public static final String PROPERTY_MAPPER_CLASSNAME
      Name of the property of which the value is expected to be the classname of the UserProviderMapper instance to be used by instances of this class.
      See Also:
    • mapper

      protected final UserProviderMapper mapper
      Used to determine what provider is to be used to operate on a particular user.
  • Constructor Details

    • MappedUserProvider

      public MappedUserProvider()
  • Method Details

    • getUserProviders

      public Collection<UserProvider> getUserProviders()
    • getUserProvider

      public UserProvider getUserProvider(String username)
    • loadUser

      public User loadUser(String username) throws UserNotFoundException
      Description copied from interface: UserProvider
      Loads the specified user by username.
      Parameters:
      username - the username
      Returns:
      the User.
      Throws:
      UserNotFoundException - if the User could not be loaded.
    • createUser

      public User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException
      Description copied from interface: UserProvider
      Creates a new user. This method should throw an UnsupportedOperationException if this operation is not supporte by the backend user store.
      Parameters:
      username - the username.
      password - the plain-text password.
      name - the user's name, which can be null, unless isNameRequired is set to true.
      email - the user's email address, which can be null, unless isEmailRequired is set to true.
      Returns:
      a new User.
      Throws:
      UserAlreadyExistsException - if the username is already in use.
    • deleteUser

      public void deleteUser(String username)
      Description copied from interface: UserProvider
      Delets a user. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Parameters:
      username - the username to delete.
    • setName

      public void setName(String username, String name) throws UserNotFoundException
      Description copied from interface: UserProvider
      Sets the user's name. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Parameters:
      username - the username.
      name - the name.
      Throws:
      UserNotFoundException - if the user could not be found.
    • setEmail

      public void setEmail(String username, String email) throws UserNotFoundException
      Description copied from interface: UserProvider
      Sets the user's email address. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Parameters:
      username - the username.
      email - the email address.
      Throws:
      UserNotFoundException - if the user could not be found.
    • setCreationDate

      public void setCreationDate(String username, Date creationDate) throws UserNotFoundException
      Description copied from interface: UserProvider
      Sets the date the user was created. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Parameters:
      username - the username.
      creationDate - the date the user was created.
      Throws:
      UserNotFoundException - if the user could not be found.
    • setModificationDate

      public void setModificationDate(String username, Date modificationDate) throws UserNotFoundException
      Description copied from interface: UserProvider
      Sets the date the user was last modified. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Parameters:
      username - the username.
      modificationDate - the date the user was last modified.
      Throws:
      UserNotFoundException - if the user could not be found.