Package tigase.db
Class AuthRepositoryPool
java.lang.Object
tigase.db.AuthRepositoryPool
- All Implemented Interfaces:
AuthRepository,Repository,RepositoryPool<AuthRepository>
public class AuthRepositoryPool
extends Object
implements AuthRepository, RepositoryPool<AuthRepository>
Pool for authentication repositories. *
This pool should be used if connection to authentication storage is blocking or synchronized, ie. implemented using single connection.*
If implementation of
Created: Mar 27, 2010 11:31:17 PM
This pool should be used if connection to authentication storage is blocking or synchronized, ie. implemented using single connection.*
If implementation of
AuthRepository uses connection pool or non blocking, concurrent access to authentication storage (ie.
DataSourcePool), then this pool is not need.
Created: Mar 27, 2010 11:31:17 PM
- Author:
- Artur Hefczyc
-
Nested Class Summary
Nested classes/interfaces inherited from interface tigase.db.AuthRepository
AuthRepository.AccountStatus, AuthRepository.DefaultCredentials, AuthRepository.SingleCredentialNested classes/interfaces inherited from interface tigase.db.Repository
Repository.Meta, Repository.SchemaId -
Field Summary
Fields inherited from interface tigase.db.AuthRepository
DATA_KEY, DIGEST_ID_KEY, DIGEST_KEY, MACHANISM_KEY, PASSWORD_KEY, PROTOCOL_KEY, PROTOCOL_VAL_NONSASL, PROTOCOL_VAL_SASL, REALM_KEY, RESULT_KEY, SERVER_NAME_KEY, USER_ID_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRepo(AuthRepository repo) Method called to add instance of a repository to the repository pool.voidgetAccountStatus(BareJID user) longgetActiveUsersCountIn(Duration duration) getCredentialIds(BareJID user) getCredentials(BareJID user, String credentialId) getPassword(BareJID user) getResourceUrimethod returns database connection string.longThis method is only used by the server statistics component to report number of registered users.longgetUsersCount(String domain) This method is only used by the server statistics component to report number of registered users for given domain.voidinitRepository(String resource_uri, Map<String, String> params) Deprecated.booleanisMechanismSupported(String domain, String mechanism) booleanisUserDisabled(BareJID user) voidDo some actions on repository, when user logs in.voidbooleanvoidqueryAuthreturns mechanisms available for authentication.voidremoveCredential(BareJID user, String credentialId) voidremoveUser(BareJID user) voidsetAccountStatus(BareJID user, AuthRepository.AccountStatus status) voidsetUserDisabled(BareJID user, Boolean value) takeRepo()voidupdateCredential(BareJID user, String credentialId, String password) voidupdateCredential(BareJID user, String credentialId, String mechanism, String data) voidupdatePassword(BareJID user, String password) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tigase.db.AuthRepository
getUsernames, setCredentialsCodecs
-
Constructor Details
-
AuthRepositoryPool
public AuthRepositoryPool()
-
-
Method Details
-
addRepo
Description copied from interface:RepositoryPoolMethod called to add instance of a repository to the repository pool.- Specified by:
addRepoin interfaceRepositoryPool<AuthRepository>- Parameters:
repo- instance of a repository
-
addUser
- Specified by:
addUserin interfaceAuthRepository- Throws:
TigaseDBException
-
getAccountStatus
- Specified by:
getAccountStatusin interfaceAuthRepository- Throws:
TigaseDBException
-
getCredentials
- Specified by:
getCredentialsin interfaceAuthRepository- Throws:
TigaseDBException
-
getPassword
- Specified by:
getPasswordin interfaceAuthRepository- Throws:
TigaseDBException
-
getResourceUri
Description copied from interface:AuthRepositorygetResourceUrimethod returns database connection string.- Specified by:
getResourceUriin interfaceAuthRepository- Returns:
- a
Stringvalue of database connection string.
-
getActiveUsersCountIn
- Specified by:
getActiveUsersCountInin interfaceAuthRepository- Parameters:
duration- Time range within which active users should be counted. Method is only used by statistics.- Returns:
- number of active users in required range
-
getCredentialIds
- Specified by:
getCredentialIdsin interfaceAuthRepository- Throws:
TigaseDBException
-
getUsersCount
public long getUsersCount()Description copied from interface:AuthRepositoryThis method is only used by the server statistics component to report number of registered users.- Specified by:
getUsersCountin interfaceAuthRepository- Returns:
- a
longnumber of registered users in the repository.
-
getUsersCount
Description copied from interface:AuthRepositoryThis method is only used by the server statistics component to report number of registered users for given domain.- Specified by:
getUsersCountin interfaceAuthRepository- Parameters:
domain- for which get the statistics- Returns:
- a
longnumber of registered users in the repository.
-
initRepository
@Deprecated public void initRepository(String resource_uri, Map<String, String> params) throws DBInitExceptionDeprecated.Description copied from interface:RepositoryMethod is deprecated and should not be user any more.
The method is called to initialize the data repository. Depending on the implementation all the initialization parameters can be passed either viaresource_uriparameter as the database connection string or viaparamsmap if the required repository parameters are more complex or both.- Specified by:
initRepositoryin interfaceRepository- Parameters:
resource_uri- value in most cases representing the database connection string.params- is aMapwith repository properties necessary to initialize and perform all the functions. The initialization parameters are implementation dependent.- Throws:
DBInitException- if there was an error during repository initialization. Some implementations, though, perform so called lazy initialization so even though there is a problem with the underlying repository it may not be signaled through this method call.
-
isMechanismSupported
- Specified by:
isMechanismSupportedin interfaceAuthRepository
-
isUserDisabled
- Specified by:
isUserDisabledin interfaceAuthRepository- Throws:
TigaseDBException
-
loggedIn
Description copied from interface:AuthRepositoryDo some actions on repository, when user logs in. (for example updatelast_login_time)- Specified by:
loggedInin interfaceAuthRepository- Parameters:
user- JID of logged user.- Throws:
TigaseDBException- if an error occurs
-
logout
- Specified by:
logoutin interfaceAuthRepository- Throws:
TigaseDBException
-
otherAuth
public boolean otherAuth(Map<String, Object> authProps) throws TigaseDBException, AuthorizationException- Specified by:
otherAuthin interfaceAuthRepository- Throws:
TigaseDBExceptionAuthorizationException
-
queryAuth
Description copied from interface:AuthRepositoryqueryAuthreturns mechanisms available for authentication.- Specified by:
queryAuthin interfaceAuthRepository- Parameters:
authProps- aMapvalue with parameters for authentication.
-
removeCredential
- Specified by:
removeCredentialin interfaceAuthRepository- Throws:
TigaseDBException
-
removeUser
- Specified by:
removeUserin interfaceAuthRepository- Throws:
TigaseDBException
-
setAccountStatus
public void setAccountStatus(BareJID user, AuthRepository.AccountStatus status) throws TigaseDBException - Specified by:
setAccountStatusin interfaceAuthRepository- Throws:
TigaseDBException
-
setUserDisabled
- Specified by:
setUserDisabledin interfaceAuthRepository- Throws:
TigaseDBException
-
takeRepo
-
updateCredential
public void updateCredential(BareJID user, String credentialId, String password) throws TigaseDBException - Specified by:
updateCredentialin interfaceAuthRepository- Throws:
TigaseDBException
-
updateCredential
public void updateCredential(BareJID user, String credentialId, String mechanism, String data) throws TigaseDBException - Specified by:
updateCredentialin interfaceAuthRepository- Throws:
TigaseDBException
-
updatePassword
- Specified by:
updatePasswordin interfaceAuthRepository- Throws:
TigaseDBException
-