Package tigase.db.jdbc

## Class JDBCRepository

- java.lang.Object
- - tigase.db.jdbc.JDBCRepository

- All Implemented Interfaces:
    `AuthRepository`, `DataSourceAware<DataRepository>`, `Repository`, `UserRepository`, `RepositoryVersionAware`

      public class JDBCRepository
      extends java.lang.Object
      implements AuthRepository, UserRepository, DataSourceAware<DataRepository>, RepositoryVersionAware

  Not synchronized implementation! Musn't be used by more than one thread at the same time.

  Thanks to Daniele for better unique IDs handling. Created: Thu Oct 26 11:48:53 2006

  Author:
    Artur Hefczyc, Daniele

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `JDBCRepository.IRepoCache<K,​V>` |

    - ### Nested classes/interfaces inherited from interface tigase.db.AuthRepository

      `AuthRepository.AccountStatus, AuthRepository.DefaultCredentials, AuthRepository.SingleCredential`

    - ### Nested classes/interfaces inherited from interface tigase.db.Repository

      `Repository.Meta, Repository.SchemaId`

    - ### Nested classes/interfaces inherited from interface tigase.db.util.RepositoryVersionAware

      `RepositoryVersionAware.SchemaVersion`

    - ### Nested classes/interfaces inherited from interface tigase.db.UserRepository

      `UserRepository.UserRemovedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `CURRENT_DB_SCHEMA_VER` |
    `static java.lang.String` | `DEF_MAXIDS_TBL` |
    `static java.lang.String` | `DEF_NODES_TBL` |
    `static java.lang.String` | `DEF_PAIRS_TBL` |
    `static java.lang.String` | `DEF_ROOT_NODE` |
    `static java.lang.String` | `DEF_USERS_TBL` |
    `static java.lang.String` | `DERBY_GETSCHEMAVER_QUERY` |
    `static java.lang.String` | `JDBC_GETSCHEMAVER_QUERY` |
    `static java.lang.String` | `SCHEMA_UPGRADE_LINK` |
    `static java.lang.String` | `SQLSERVER_GETSCHEMAVER_QUERY` | Stored procedure used to check version of the schema neither MS SQL Server JDBC driver supports default schema prefix in connection string for stored functions

    - ### 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
    Constructor | Description
    --- | ---
    `JDBCRepository()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addDataList​(BareJID user_id, java.lang.String subnode, java.lang.String key, java.lang.String[] list)` | `addDataList` method adds mode entries to existing data list associated with given key in repository under given node path.
    `void` | `addUser​(BareJID user_id)` | This `addUser` method allows to add new user to repository.
    `void` | `addUser​(BareJID user, java.lang.String password)` |
    `AuthRepository.AccountStatus` | `getAccountStatus​(BareJID user)` |
    `java.lang.String` | `getData​(BareJID user_id, java.lang.String key)` | `getData` method returns a value associated with given key for user repository in default subnode.
    `java.lang.String` | `getData​(BareJID user_id, java.lang.String subnode, java.lang.String key)` | `getData` method returns a value associated with given key for user repository in given subnode.
    `java.lang.String` | `getData​(BareJID user_id, java.lang.String subnode, java.lang.String key, java.lang.String def)` | `getData` method returns a value associated with given key for user repository in given subnode.
    `java.lang.String[]` | `getDataList​(BareJID user_id, java.lang.String subnode, java.lang.String key)` | `getDataList` method returns array of values associated with given key or `null` if given key does not exist for given user ID in given node path.
    `java.util.Map<java.lang.String,​java.lang.String>` | `getDataMap​(BareJID user_id, java.lang.String subnode)` | `getDataMap` method returns a values associated with each key for user repository in given subnode.
    `<T> java.util.Map<java.lang.String,​T>` | `getDataMap​(BareJID user, java.lang.String subnode, java.util.function.Function<java.lang.String,​T> converter)` | `getDataMap` method returns a values associated with each key for user repository in given subnode.
    `java.lang.String[]` | `getKeys​(BareJID user_id)` | `getKeys` method returns list of all keys stored in default user repository node.
    `java.lang.String[]` | `getKeys​(BareJID user_id, java.lang.String subnode)` | `getKeys` method returns list of all keys stored in given subnode in user repository.
    `java.lang.String` | `getPassword​(BareJID user)` |
    `protected DataRepository` | `getRepository()` |
    `java.lang.String` | `getResourceUri()` | `getResourceUri` method returns database connection string.
    `java.lang.String[]` | `getSubnodes​(BareJID user_id)` | `getSubnodes` method returns list of all root nodes for given user.
    `java.lang.String[]` | `getSubnodes​(BareJID user_id, java.lang.String subnode)` | Deprecated.
    `java.util.List<BareJID>` | `getUsers()` | This method is only used by the data conversion tools.
    `long` | `getUsersCount()` | This method is only used by the server statistics component to report number of registered users.
    `long` | `getUsersCount​(java.lang.String domain)` | This method is only used by the server statistics component to report number of registered users for given domain.
    `long` | `getUserUID​(BareJID user_id)` | Returns a user unique ID number within the given repository.
    `void` | `initRepository​(java.lang.String connection_str, java.util.Map<java.lang.String,​java.lang.String> params)` | Deprecated.
    `protected boolean` | `isExceptionKeyViolation​(java.sql.SQLException ex)` |
    `boolean` | `isMechanismSupported​(java.lang.String domain, java.lang.String mechanism)` |
    `boolean` | `isUserDisabled​(BareJID user)` |
    `void` | `loggedIn​(BareJID user)` | Do some actions on repository, when user logs in.
    `void` | `logout​(BareJID user)` |
    `boolean` | `otherAuth​(java.util.Map<java.lang.String,​java.lang.Object> props)` |
    `void` | `queryAuth​(java.util.Map<java.lang.String,​java.lang.Object> authProps)` | `queryAuth` returns mechanisms available for authentication.
    `void` | `removeData​(BareJID user_id, java.lang.String key)` | `removeData` method removes pair (key, value) from user repository in default repository node.
    `void` | `removeData​(BareJID user_id, java.lang.String subnode, java.lang.String key)` | `removeData` method removes pair (key, value) from user repository in given subnode.
    `void` | `removeSubnode​(BareJID user_id, java.lang.String subnode)` | `removeSubnode` method removes given subnode with all subnodes in this node and all data stored in this node and in all subnodes.
    `void` | `removeUser​(BareJID user_id)` | `removeUser` method is thread safe.
    `void` | `setAccountStatus​(BareJID user, AuthRepository.AccountStatus status)` |
    `void` | `setData​(BareJID user_id, java.lang.String key, java.lang.String value)` | This `setData` method sets data value for given user ID associated with given key in default repository node.
    `void` | `setData​(BareJID user_id, java.lang.String subnode, java.lang.String key, java.lang.String value)` | `setData` method sets data value for given user ID in repository under given node path and associates it with given key.
    `void` | `setDataList​(BareJID user_id, java.lang.String subnode, java.lang.String key, java.lang.String[] list)` | `setDataList` method sets list of values for given user associated given key in repository under given node path.
    `void` | `setDataSource​(DataRepository dataSource)` | Method called to provide class with instance of a data source.
    `void` | `setUserDisabled​(BareJID user, java.lang.Boolean value)` |
    `void` | `updatePassword​(BareJID user, java.lang.String password)` |
    `boolean` | `userExists​(BareJID user)` | Method `userExists` checks whether the user (or repository top node) exists in the database.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface tigase.db.AuthRepository

      `getCredentialIds, getCredentials, getUsernames, removeCredential, setCredentialsCodecs, updateCredential`

    - ### Methods inherited from interface tigase.db.util.RepositoryVersionAware

      `getVersion, updateSchema`

- - ### Field Detail

    - #### CURRENT_DB_SCHEMA_VER

          public static final java.lang.String CURRENT_DB_SCHEMA_VER

      See Also:
        Constant Field Values

    - #### DEF_MAXIDS_TBL

          public static final java.lang.String DEF_MAXIDS_TBL

      See Also:
        Constant Field Values

    - #### DEF_NODES_TBL

          public static final java.lang.String DEF_NODES_TBL

      See Also:
        Constant Field Values

    - #### DEF_PAIRS_TBL

          public static final java.lang.String DEF_PAIRS_TBL

      See Also:
        Constant Field Values

    - #### DEF_ROOT_NODE

          public static final java.lang.String DEF_ROOT_NODE

      See Also:
        Constant Field Values

    - #### DEF_USERS_TBL

          public static final java.lang.String DEF_USERS_TBL

      See Also:
        Constant Field Values

    - #### DERBY_GETSCHEMAVER_QUERY

          public static final java.lang.String DERBY_GETSCHEMAVER_QUERY

      See Also:
        Constant Field Values

    - #### SQLSERVER_GETSCHEMAVER_QUERY

          public static final java.lang.String SQLSERVER_GETSCHEMAVER_QUERY

      Stored procedure used to check version of the schema
      neither MS SQL Server JDBC driver supports default schema prefix in connection string for stored functions
      See Also:
        Constant Field Values

    - #### JDBC_GETSCHEMAVER_QUERY

          public static final java.lang.String JDBC_GETSCHEMAVER_QUERY

      See Also:
        Constant Field Values

    - #### SCHEMA_UPGRADE_LINK

          public static final java.lang.String SCHEMA_UPGRADE_LINK

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JDBCRepository

          public JDBCRepository()

  - ### Method Detail

    - #### addDataList

          public void addDataList​(BareJID user_id,
                                  java.lang.String subnode,
                                  java.lang.String key,
                                  java.lang.String[] list)
                           throws UserNotFoundException,
                                  TigaseDBException

      Description copied from interface: `UserRepository`
      `addDataList` method adds mode entries to existing data list associated with given key in repository under given node path. This method is very similar to `setDataList(...)` except it doesn't remove existing data.
      Specified by:
        `addDataList` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` with which the specified values list is to be associated.
        `list` - a `String[]` is an array of values to be associated with the specified key.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### addUser

          public void addUser​(BareJID user_id)
                       throws UserExistsException,
                              TigaseDBException

      Description copied from interface: `UserRepository`
      This `addUser` method allows to add new user to repository. It must throw en exception `UserExistsException` if such user already exists because user must be unique within user repository data base.
      As one XMPP server can support many virtual internet domains it is required that `user` id consists of user name and domain address: username@domain.address.net for example.
      Specified by:
        `addUser` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user id consisting of user name and domain address.
      Throws:
        `UserExistsException` - if user with the same id already exists.
        `TigaseDBException` - if database backend error occurs.

    - #### addUser

          public void addUser​(BareJID user,
                              java.lang.String password)
                       throws UserExistsException,
                              TigaseDBException

      Specified by:
        `addUser` in interface `AuthRepository`
      Throws:
        `UserExistsException`
        `TigaseDBException`

    - #### getData

          public java.lang.String getData​(BareJID user_id,
                                          java.lang.String subnode,
                                          java.lang.String key,
                                          java.lang.String def)
                                   throws UserNotFoundException,
                                          TigaseDBException

      Description copied from interface: `UserRepository`
      `getData` method returns a value associated with given key for user repository in given subnode. If key is not found in repository given default value is returned.
      Specified by:
        `getData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` with which the needed value is associated.
        `def` - a `String` value which is returned in case if data for specified key does not exixist in repository.
      Returns:
        a `String` value
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getData

          public java.lang.String getData​(BareJID user_id,
                                          java.lang.String subnode,
                                          java.lang.String key)
                                   throws UserNotFoundException,
                                          TigaseDBException

      Description copied from interface: `UserRepository`
      `getData` method returns a value associated with given key for user repository in given subnode. If key is not found in repository `null` value is returned.
      Specified by:
        `getData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` with which the needed value is associated.
      Returns:
        a `String` value
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getData

          public java.lang.String getData​(BareJID user_id,
                                          java.lang.String key)
                                   throws UserNotFoundException,
                                          TigaseDBException

      Description copied from interface: `UserRepository`
      `getData` method returns a value associated with given key for user repository in default subnode. If key is not found in repository `null` value is returned.
      Specified by:
        `getData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `key` - a `String` with which the needed value is associated.
      Returns:
        a `String` value
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getDataMap

          public java.util.Map<java.lang.String,​java.lang.String> getDataMap​(BareJID user_id,
                                                                                   java.lang.String subnode)
                                                                            throws TigaseDBException

      Description copied from interface: `UserRepository`
      `getDataMap` method returns a values associated with each key for user repository in given subnode.
      Specified by:
        `getDataMap` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
      Returns:
        a `Map` with values
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getDataMap

          public <T> java.util.Map<java.lang.String,​T> getDataMap​(BareJID user,
                                                                        java.lang.String subnode,
                                                                        java.util.function.Function<java.lang.String,​T> converter)
                                                                 throws TigaseDBException

      Description copied from interface: `UserRepository`
      `getDataMap` method returns a values associated with each key for user repository in given subnode.
      Specified by:
        `getDataMap` in interface `UserRepository`
      Parameters:
        `user` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `converter` - a `Function` which takes value for a key and converts to expected value type
      Returns:
        a `Map` with values
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getDataList

          public java.lang.String[] getDataList​(BareJID user_id,
                                                java.lang.String subnode,
                                                java.lang.String key)
                                         throws UserNotFoundException,
                                                TigaseDBException

      Description copied from interface: `UserRepository`
      `getDataList` method returns array of values associated with given key or `null` if given key does not exist for given user ID in given node path.
      Specified by:
        `getDataList` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` with which the needed values list is associated.
      Returns:
        a `String[]` value
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getKeys

          public java.lang.String[] getKeys​(BareJID user_id,
                                            java.lang.String subnode)
                                     throws UserNotFoundException,
                                            TigaseDBException

      Description copied from interface: `UserRepository`
      `getKeys` method returns list of all keys stored in given subnode in user repository. There is a value (or list of values) associated with each key. It is up to user (developer) to know what key keeps one value and what key keeps list of values.
      Specified by:
        `getKeys` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
      Returns:
        a `String[]` value
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getKeys

          public java.lang.String[] getKeys​(BareJID user_id)
                                     throws UserNotFoundException,
                                            TigaseDBException

      Description copied from interface: `UserRepository`
      `getKeys` method returns list of all keys stored in default user repository node. There is some a value (or list of values) associated with each key. It is up to user (developer) to know what key keeps one value and what key keeps list of values.
      Specified by:
        `getKeys` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored or retrieved. User ID consists of user name and domain name.
      Returns:
        a `String[]` value
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getResourceUri

          public java.lang.String getResourceUri()

      Description copied from interface: `AuthRepository`
      `getResourceUri` method returns database connection string.
      Specified by:
        `getResourceUri` in interface `AuthRepository`
      Specified by:
        `getResourceUri` in interface `UserRepository`
      Returns:
        a `String` value of database connection string.

    - #### getSubnodes

          @Deprecated
          public java.lang.String[] getSubnodes​(BareJID user_id,
                                                java.lang.String subnode)
                                         throws UserNotFoundException,
                                                TigaseDBException

      Deprecated.
      Description copied from interface: `UserRepository`
      `getSubnodes` method returns list of all direct subnodes from given node.
      Specified by:
        `getSubnodes` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
      Returns:
        a `String[]` value is an array of all direct subnodes.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getSubnodes

          public java.lang.String[] getSubnodes​(BareJID user_id)
                                         throws UserNotFoundException,
                                                TigaseDBException

      Description copied from interface: `UserRepository`
      `getSubnodes` method returns list of all root nodes for given user.
      Specified by:
        `getSubnodes` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
      Returns:
        a `String[]` value is an array of all root nodes for given user.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### getUserUID

          public long getUserUID​(BareJID user_id)
                          throws TigaseDBException

      Description copied from interface: `UserRepository`
      Returns a user unique ID number within the given repository. Please note it is also possible that the ID number is unique only for the user domain. The ID is a positive number if the user exists and negative if the user was not found in the repository.
      Specified by:
        `getUserUID` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored or retrieved. User ID consists of user name and domain name.
      Returns:
        a user inique ID number within the repository or domain. The ID is a positive number if the user exists and negative if the user was not found in the repository.
      Throws:
        `TigaseDBException` - if there is a problem with accessing user repository.

    - #### getUsers

          public java.util.List<BareJID> getUsers()
                                           throws TigaseDBException

      Description copied from interface: `UserRepository`
      This method is only used by the data conversion tools. They attempt to copy whole user repositories from one to another database. Databases might not be compatible but as long as the API is implemented and they support adding user the user database can be copied to a different data source.
      Specified by:
        `getUsers` in interface `UserRepository`
      Returns:
        returns a collection of all user IDs (Jabber IDs) stored in the user repository.
      Throws:
        `TigaseDBException`

    - #### getUsersCount

          public long getUsersCount()

      Description copied from interface: `AuthRepository`
      This method is only used by the server statistics component to report number of registered users.
      Specified by:
        `getUsersCount` in interface `AuthRepository`
      Specified by:
        `getUsersCount` in interface `UserRepository`
      Returns:
        a `long` number of registered users in the repository.

    - #### getUsersCount

          public long getUsersCount​(java.lang.String domain)

      Description copied from interface: `AuthRepository`
      This method is only used by the server statistics component to report number of registered users for given domain.
      Specified by:
        `getUsersCount` in interface `AuthRepository`
      Specified by:
        `getUsersCount` in interface `UserRepository`
      Parameters:
        `domain` - for which get the statistics
      Returns:
        a `long` number of registered users in the repository.

    - #### setDataSource

          public void setDataSource​(DataRepository dataSource)
                             throws DBInitException

      Description copied from interface: `DataSourceAware`
      Method called to provide class with instance of a data source.
      Specified by:
        `setDataSource` in interface `DataSourceAware<DataRepository>`
      Throws:
        `DBInitException`

    - #### isMechanismSupported

          public boolean isMechanismSupported​(java.lang.String domain,
                                              java.lang.String mechanism)

      Specified by:
        `isMechanismSupported` in interface `AuthRepository`

    - #### initRepository

          @Deprecated
          public void initRepository​(java.lang.String connection_str,
                                     java.util.Map<java.lang.String,​java.lang.String> params)
                              throws DBInitException

      Deprecated.
      Description copied from interface: `Repository`
      Method 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 via `resource_uri` parameter as the database connection string or via `params` map if the required repository parameters are more complex or both.
      Specified by:
        `initRepository` in interface `Repository`
      Parameters:
        `connection_str` - value in most cases representing the database connection string.
        `params` - is a `Map` with 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.

    - #### logout

          public void logout​(BareJID user)
                      throws UserNotFoundException,
                             TigaseDBException

      Specified by:
        `logout` in interface `AuthRepository`
      Throws:
        `UserNotFoundException`
        `TigaseDBException`

    - #### loggedIn

          public void loggedIn​(BareJID user)
                        throws TigaseDBException

      Description copied from interface: `AuthRepository`
      Do some actions on repository, when user logs in. (for example update `last_login_time`)
      Specified by:
        `loggedIn` in interface `AuthRepository`
      Parameters:
        `user` - JID of logged user.
      Throws:
        `TigaseDBException` - if an error occurs

    - #### otherAuth

          public boolean otherAuth​(java.util.Map<java.lang.String,​java.lang.Object> props)
                            throws UserNotFoundException,
                                   TigaseDBException,
                                   AuthorizationException

      Specified by:
        `otherAuth` in interface `AuthRepository`
      Throws:
        `UserNotFoundException`
        `TigaseDBException`
        `AuthorizationException`

    - #### queryAuth

          public void queryAuth​(java.util.Map<java.lang.String,​java.lang.Object> authProps)

      Description copied from interface: `AuthRepository`
      `queryAuth` returns mechanisms available for authentication.
      Specified by:
        `queryAuth` in interface `AuthRepository`
      Parameters:
        `authProps` - a `Map` value with parameters for authentication.

    - #### removeData

          public void removeData​(BareJID user_id,
                                 java.lang.String subnode,
                                 java.lang.String key)
                          throws UserNotFoundException,
                                 TigaseDBException

      Description copied from interface: `UserRepository`
      `removeData` method removes pair (key, value) from user repository in given subnode. If the key exists in user repository there is always a value associated with this key - even empty `String`. If key does not exist the `null` value is returned from repository backend or given default value.
      Specified by:
        `removeData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` for which the value is to be removed.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### removeData

          public void removeData​(BareJID user_id,
                                 java.lang.String key)
                          throws UserNotFoundException,
                                 TigaseDBException

      Description copied from interface: `UserRepository`
      `removeData` method removes pair (key, value) from user repository in default repository node. If the key exists in user repository there is always a value associated with this key - even empty `String`. If key does not exist the `null` value is returned from repository backend or given default value.
      Specified by:
        `removeData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `key` - a `String` for which the value is to be removed.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### removeSubnode

          public void removeSubnode​(BareJID user_id,
                                    java.lang.String subnode)
                             throws UserNotFoundException,
                                    TigaseDBException

      Description copied from interface: `UserRepository`
      `removeSubnode` method removes given subnode with all subnodes in this node and all data stored in this node and in all subnodes. Effectively it removes entire repository tree starting from given node.
      Specified by:
        `removeSubnode` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path to subnode which has to be removed. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### removeUser

          public void removeUser​(BareJID user_id)
                          throws UserNotFoundException,
                                 TigaseDBException

      `removeUser` method is thread safe. It uses local variable for storing `Statement`.
      Specified by:
        `removeUser` in interface `AuthRepository`
      Specified by:
        `removeUser` in interface `UserRepository`
      Parameters:
        `user_id` - a `String` value the user Jabber ID.
      Throws:
        `UserNotFoundException` - if an error occurs
        `TigaseDBException` - if database backend error occurs.

    - #### setData

          public void setData​(BareJID user_id,
                              java.lang.String subnode,
                              java.lang.String key,
                              java.lang.String value)
                       throws UserNotFoundException,
                              TigaseDBException

      Description copied from interface: `UserRepository`
      `setData` method sets data value for given user ID in repository under given node path and associates it with given key. If there already exists value for given key in given node, old value is replaced with new value. No warning or exception is thrown in case if methods overwrites old value.
      Specified by:
        `setData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` with which the specified value is to be associated.
        `value` - a `String` value to be associated with the specified key.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### setData

          public void setData​(BareJID user_id,
                              java.lang.String key,
                              java.lang.String value)
                       throws UserNotFoundException,
                              TigaseDBException

      Description copied from interface: `UserRepository`
      This `setData` method sets data value for given user ID associated with given key in default repository node. Default node is dependent on implementation and usually it is root user node. If there already exists value for given key in given node, old value is replaced with new value. No warning or exception is thrown in case if methods overwrites old value.
      Specified by:
        `setData` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `key` - a `String` with which the specified value is to be associated.
        `value` - a `String` value to be associated with the specified key.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### setDataList

          public void setDataList​(BareJID user_id,
                                  java.lang.String subnode,
                                  java.lang.String key,
                                  java.lang.String[] list)
                           throws UserNotFoundException,
                                  TigaseDBException

      Description copied from interface: `UserRepository`
      `setDataList` method sets list of values for given user associated given key in repository under given node path. If there already exist values for given key in given node, all old values are replaced with new values. No warning or exception is thrown in case if methods overwrites old value.
      Specified by:
        `setDataList` in interface `UserRepository`
      Parameters:
        `user_id` - a `BareJID` value of user ID for which data must be stored. User ID consists of user name and domain name.
        `subnode` - a `String` value is a node path where data is stored. Node path has the same form as directory path on file system:

            /root/subnode1/subnode2

        .
        `key` - a `String` with which the specified values list is to be associated.
        `list` - a `String[]` is an array of values to be associated with the specified key.
      Throws:
        `UserNotFoundException` - if user id hasn't been found in repository.
        `TigaseDBException` - if database backend error occurs.

    - #### updatePassword

          public void updatePassword​(BareJID user,
                                     java.lang.String password)
                              throws TigaseDBException

      Specified by:
        `updatePassword` in interface `AuthRepository`
      Throws:
        `TigaseDBException`

    - #### userExists

          public boolean userExists​(BareJID user)

      Description copied from interface: `UserRepository`
      Method `userExists` checks whether the user (or repository top node) exists in the database. The method doesn't throw any exception nor it creates the user in case it is missing. It just checks whether the user is already in the database.
      Please don't overuse this method. All other methods throw `UserNotFoundException` exception in case the user is missing for which you executed the method. The exception is thrown unless `userAutoCreate` property is set to true. In such case the exception is never thrown and the methods are executed for given parameters prior to creating user entry if it is missing.
      Therefore this method should be used only to check whether the account exists without creating it.
      Specified by:
        `userExists` in interface `UserRepository`
      Parameters:
        `user` - a `BareJID` value
      Returns:
        a `boolean` value

    - #### getPassword

          public java.lang.String getPassword​(BareJID user)
                                       throws UserNotFoundException,
                                              TigaseDBException

      Specified by:
        `getPassword` in interface `AuthRepository`
      Throws:
        `UserNotFoundException`
        `TigaseDBException`

    - #### isUserDisabled

          public boolean isUserDisabled​(BareJID user)
                                 throws UserNotFoundException,
                                        TigaseDBException

      Specified by:
        `isUserDisabled` in interface `AuthRepository`
      Throws:
        `UserNotFoundException`
        `TigaseDBException`

    - #### setAccountStatus

          public void setAccountStatus​(BareJID user,
                                       AuthRepository.AccountStatus status)
                                throws TigaseDBException

      Specified by:
        `setAccountStatus` in interface `AuthRepository`
      Throws:
        `TigaseDBException`

    - #### getAccountStatus

          public AuthRepository.AccountStatus getAccountStatus​(BareJID user)
                                                        throws TigaseDBException

      Specified by:
        `getAccountStatus` in interface `AuthRepository`
      Throws:
        `TigaseDBException`

    - #### setUserDisabled

          public void setUserDisabled​(BareJID user,
                                      java.lang.Boolean value)
                               throws UserNotFoundException,
                                      TigaseDBException

      Specified by:
        `setUserDisabled` in interface `AuthRepository`
      Throws:
        `UserNotFoundException`
        `TigaseDBException`

    - #### getRepository

          protected DataRepository getRepository()

    - #### isExceptionKeyViolation

          protected boolean isExceptionKeyViolation​(java.sql.SQLException ex)