Modifier and Type | Field and Description |
---|---|
static SystemProperty<Class> |
USER_PROPERTY_PROVIDER |
static SystemProperty<Class> |
USER_PROVIDER |
Modifier and Type | Method and Description |
---|---|
User |
createUser(String username,
String password,
String name,
String email)
Creates a new User.
|
void |
deleteUser(User user)
Deletes a user (optional operation).
|
Collection<User> |
findUsers(Set<String> fields,
String query)
Searches for users based on a set of fields and a query string.
|
Collection<User> |
findUsers(Set<String> fields,
String query,
int startIndex,
int numResults)
Searches for users based on a set of fields and a query string.
|
static UserManager |
getInstance()
Returns a singleton UserManager instance.
|
Set<String> |
getSearchFields()
Returns the set of fields that can be used for searching for users.
|
User |
getUser(String username)
Returns the User specified by username.
|
int |
getUserCount()
Returns the total number of users in the system.
|
Collection<String> |
getUsernames()
Returns an unmodifiable Collection of usernames of all users in the system.
|
static UserPropertyProvider |
getUserPropertyProvider()
Returns the currently-installed UserPropertyProvider.
|
static UserProvider |
getUserProvider()
Returns the currently-installed UserProvider.
|
Collection<User> |
getUsers()
Returns an unmodifiable Collection of all users in the system.
|
Collection<User> |
getUsers(int startIndex,
int numResults)
Returns an unmodifiable Collection of all users starting at
startIndex
with the given number of results. |
boolean |
isRegisteredUser(org.xmpp.packet.JID user)
Returns true if the specified JID belongs to a local or remote registered user.
|
boolean |
isRegisteredUser(String username)
Returns true if the specified local username belongs to a registered local user.
|
public static final SystemProperty<Class> USER_PROVIDER
public static final SystemProperty<Class> USER_PROPERTY_PROVIDER
public static UserProvider getUserProvider()
public static UserPropertyProvider getUserPropertyProvider()
User.getProperties()
to create, read, update or delete user properties. Failure to do so
is likely to result in inconsistent data behavior and race conditions. Direct access to the user property
provider is only provided for special-case logic.User.getProperties()
public static UserManager getInstance()
public User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException
null
, unless the UserProvider deems that
either of them are required.username
- the new and unique username for the account.password
- the password for the account (plain text).name
- the name of the user, which can be null
unless the UserProvider
deems that it's required.email
- the email address to associate with the new account, which can
be null
, unless the UserProvider deems that it's required.UserAlreadyExistsException
- if the username already exists in the system.UnsupportedOperationException
- if the provider does not support the
operation.public void deleteUser(User user)
user
- the user to delete.public User getUser(String username) throws UserNotFoundException
username
- the username of the user.username
.UserNotFoundException
- if the user does not exist.public int getUserCount()
public Collection<User> getUsers()
public Collection<String> getUsernames()
public Collection<User> getUsers(int startIndex, int numResults)
startIndex
with the given number of results. This is useful to support pagination in a GUI
where you may only want to display a certain number of results per page. It is
possible that the number of results returned will be less than that specified
by numResults
if numResults
is greater than the number of
records left to display.startIndex
- the beginning index to start the results at.numResults
- the total number of results to return.public Set<String> getSearchFields() throws UnsupportedOperationException
findUsers(Set,String)
method.This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
UnsupportedOperationException
- if the provider does not
support the operation (this is an optional operation).public Collection<User> findUsers(Set<String> fields, String query) throws UnsupportedOperationException
getSearchFields()
. The query can
include wildcards. For example, a search on the field "Name" with a query of "Ma*"
might return user's with the name "Matt", "Martha" and "Madeline".This method throws an UnsupportedOperationException if this operation is not supported by the user provider.
fields
- the fields to search on.query
- the query string.UnsupportedOperationException
- if the provider does not
support the operation (this is an optional operation).public Collection<User> findUsers(Set<String> fields, String query, int startIndex, int numResults) throws UnsupportedOperationException
getSearchFields()
. The query can
include wildcards. For example, a search on the field "Name" with a query of "Ma*"
might return user's with the name "Matt", "Martha" and "Madeline".The startIndex and numResults parameters are used to page through search results. For example, if the startIndex is 0 and numResults is 10, the first 10 search results will be returned. Note that numResults is a request for the number of results to return and that the actual number of results returned may be fewer.
This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
fields
- the fields to search on.query
- the query string.startIndex
- the starting index in the search result to return.numResults
- the number of users to return in the search result.UnsupportedOperationException
- if the provider does not
support the operation (this is an optional operation).public boolean isRegisteredUser(String username)
username
- to username of the user to check it it's a registered user.public boolean isRegisteredUser(org.xmpp.packet.JID user)
WARNING: If the supplied JID could be a remote user and the disco#info result packet comes back on the same
thread as the one the calls this method then it will not be processed, and this method will block for 60 seconds
by default. To change the timeout, update the system property usermanager.remote-disco-info-timeout-seconds
user
- to JID of the user to check it it's a registered user.Copyright © 2003–2019 Ignite Realtime. All rights reserved.