tigase.db
Class DummyRepository

java.lang.Object
  extended by tigase.db.DummyRepository
All Implemented Interfaces:
UserRepository

public class DummyRepository
extends Object
implements UserRepository

DummyRepository is a class with all methods empty. They don't return anything and they don't throw exception. SessionManager requires a user repository to work properly but in some installations there is no need for user repository as authentication is done through external data source and user roster is pulled dynamically. Created: Sat Nov 3 16:17:03 2007

Version:
$Rev: 1604 $
Author:
Artur Hefczyc

Constructor Summary
DummyRepository()
           
 
Method Summary
 void addDataList(String user, String subnode, String key, String[] list)
          Describe addDataList method here.
 void addUser(String user)
          Describe addUser method here.
 String getData(String user, String key)
          Describe getData method here.
 String getData(String user, String subnode, String key)
          Describe getData method here.
 String getData(String user, String subnode, String key, String def)
          Describe getData method here.
 String[] getDataList(String user, String subnode, String key)
          Describe getDataList method here.
 String[] getKeys(String user)
          Describe getKeys method here.
 String[] getKeys(String user, String subnode)
          Describe getKeys method here.
 String getResourceUri()
          Describe getResourceUri method here.
 String[] getSubnodes(String user)
          Describe getSubnodes method here.
 String[] getSubnodes(String user, String subnode)
          Describe getSubnodes method here.
 List<String> getUsers()
          Describe getUsers method here.
 long getUsersCount()
          Describe getUsersCount method here.
 long getUsersCount(String domain)
          This method is only used by the server statistics component to report number of registered users for given domain.
 void initRepository(String string, Map<String,String> params)
          Describe initRepository method here.
 void removeData(String user, String key)
          Describe removeData method here.
 void removeData(String user, String subnode, String key)
          Describe removeData method here.
 void removeSubnode(String user, String subnode)
          Describe removeSubnode method here.
 void removeUser(String user)
          Describe removeUser method here.
 void setData(String user, String key, String value)
          Describe setData method here.
 void setData(String user, String subnode, String key, String value)
          Describe setData method here.
 void setDataList(String user, String subnode, String key, String[] list)
          Describe setDataList method here.
 boolean userExists(String 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
 

Constructor Detail

DummyRepository

public DummyRepository()
Method Detail

getData

public String getData(String user,
                      String subnode,
                      String key,
                      String def)
Describe getData method here.

Specified by:
getData in interface UserRepository
Parameters:
user - a String 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 of null always.

getData

public String getData(String user,
                      String subnode,
                      String key)
Describe getData method here.

Specified by:
getData in interface UserRepository
Parameters:
user - a String 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 of null always.

getData

public String getData(String user,
                      String key)
Describe getData method here.

Specified by:
getData in interface UserRepository
Parameters:
user - a String 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 of null always.

initRepository

public void initRepository(String string,
                           Map<String,String> params)
Describe initRepository method here.

Specified by:
initRepository in interface UserRepository
Parameters:
string - a String value
Throws:
DBInitException - if an error occurs

getResourceUri

public String getResourceUri()
Describe getResourceUri method here.

Specified by:
getResourceUri in interface UserRepository
Returns:
a String value

getUsers

public List<String> getUsers()
Describe getUsers method here.

Specified by:
getUsers in interface UserRepository
Returns:
a List value
Throws:
TigaseDBException - if an error occurs

getUsersCount

public long getUsersCount()
Describe getUsersCount method here.

Specified by:
getUsersCount in interface UserRepository
Returns:
a long value

addUser

public void addUser(String user)
Describe addUser method here.

Specified by:
addUser in interface UserRepository
Parameters:
user - a String value of user id consisting of user name and domain address.

userExists

public boolean userExists(String 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 String value
Returns:
a boolean value

removeUser

public void removeUser(String user)
Describe removeUser method here.

Specified by:
removeUser in interface UserRepository
Parameters:
user - a String value
Throws:
UserNotFoundException - if an error occurs
TigaseDBException - if an error occurs

getDataList

public String[] getDataList(String user,
                            String subnode,
                            String key)
Describe getDataList method here.

Specified by:
getDataList in interface UserRepository
Parameters:
user - a String 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

getSubnodes

public String[] getSubnodes(String user,
                            String subnode)
Describe getSubnodes method here.

Specified by:
getSubnodes in interface UserRepository
Parameters:
user - a String 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

getSubnodes

public String[] getSubnodes(String user)
Describe getSubnodes method here.

Specified by:
getSubnodes in interface UserRepository
Parameters:
user - a String value of user ID for which data must be stored. User ID consists of user name and domain name.
Returns:
a String[] value

getKeys

public String[] getKeys(String user,
                        String subnode)
Describe getKeys method here.

Specified by:
getKeys in interface UserRepository
Parameters:
user - a String 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 an error occurs
TigaseDBException - if an error occurs

getKeys

public String[] getKeys(String user)
Describe getKeys method here.

Specified by:
getKeys in interface UserRepository
Parameters:
user - a String value of user ID for which data must be stored. User ID consists of user name and domain name.
Returns:
a String[] value

removeData

public void removeData(String user,
                       String subnode,
                       String key)
Describe removeData method here.

Specified by:
removeData in interface UserRepository
Parameters:
user - a String 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.

removeData

public void removeData(String user,
                       String key)
Describe removeData method here.

Specified by:
removeData in interface UserRepository
Parameters:
user - a String 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.

removeSubnode

public void removeSubnode(String user,
                          String subnode)
Describe removeSubnode method here.

Specified by:
removeSubnode in interface UserRepository
Parameters:
user - a String 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
.

setData

public void setData(String user,
                    String subnode,
                    String key,
                    String value)
Describe setData method here.

Specified by:
setData in interface UserRepository
Parameters:
user - a String 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.

setData

public void setData(String user,
                    String key,
                    String value)
Describe setData method here.

Specified by:
setData in interface UserRepository
Parameters:
user - a String 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.

setDataList

public void setDataList(String user,
                        String subnode,
                        String key,
                        String[] list)
Describe setDataList method here.

Specified by:
setDataList in interface UserRepository
Parameters:
user - a String 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 assosiated with the specified key.

addDataList

public void addDataList(String user,
                        String subnode,
                        String key,
                        String[] list)
Describe addDataList method here.

Specified by:
addDataList in interface UserRepository
Parameters:
user - a String 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 assosiated with the specified key.

getUsersCount

public long getUsersCount(String domain)
Description copied from interface: UserRepository
This method is only used by the server statistics component to report number of registered users for given domain.

Specified by:
getUsersCount in interface UserRepository
Returns:
a long number of registered users in the repository.


Copyright © 2001-2006 Tigase Developers Team. All rights Reserved.