|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttigase.db.xml.XMLRepository
public class XMLRepository
Class XMLRepository is a XML implementation of
UserRepository.
It uses tigase.xml.db package as repository backend and uses
Bridge design pattern to translate XMLDB calls to
UserRepository functions.
Created: Tue Oct 26 15:27:33 2004
| Field Summary |
|---|
| Fields inherited from interface tigase.db.UserAuthRepository |
|---|
DATA_KEY, MACHANISM_KEY, PROTOCOL_KEY, PROTOCOL_VAL_NONSASL, PROTOCOL_VAL_SASL, REALM_KEY, RESULT_KEY, SERVER_NAME_KEY, USER_ID_KEY |
| Constructor Summary | |
|---|---|
XMLRepository()
|
|
| Method Summary | |
|---|---|
void |
addDataList(java.lang.String user,
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(java.lang.String user)
This addUser method allows to add new user to repository. |
void |
addUser(java.lang.String user,
java.lang.String password)
Describe addUser method here. |
boolean |
digestAuth(java.lang.String user,
java.lang.String digest,
java.lang.String id,
java.lang.String alg)
Describe digestAuth method here. |
java.lang.String |
getData(java.lang.String user,
java.lang.String key)
getData method returns a value associated with given key for
user repository in default subnode. |
java.lang.String |
getData(java.lang.String user,
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(java.lang.String user,
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(java.lang.String user,
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.lang.String[] |
getKeys(java.lang.String user)
getKeys method returns list of all keys stored in default user
repository node. |
java.lang.String[] |
getKeys(java.lang.String user,
java.lang.String subnode)
getKeys method returns list of all keys stored in given
subnode in user repository. |
java.lang.String |
getResourceUri()
getResourceUri method returns database connection string. |
java.lang.String[] |
getSubnodes(java.lang.String user)
getSubnodes method returns list of all root nodes for
given user. |
java.lang.String[] |
getSubnodes(java.lang.String user,
java.lang.String subnode)
getSubnodes method returns list of all direct subnodes from
given node. |
java.util.List<java.lang.String> |
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. |
void |
initRepository(java.lang.String file,
java.util.Map<java.lang.String,java.lang.String> params)
initRepository method is doing initialization for database
connection. |
void |
logout(java.lang.String user)
Describe logout method here. |
boolean |
otherAuth(java.util.Map<java.lang.String,java.lang.Object> props)
Describe otherAuth method here. |
boolean |
plainAuth(java.lang.String user,
java.lang.String password)
Describe plainAuth method here. |
void |
queryAuth(java.util.Map<java.lang.String,java.lang.Object> authProps)
queryAuth returns mechanisms available for authentication. |
void |
removeData(java.lang.String user,
java.lang.String key)
removeData method removes pair (key, value) from user
repository in default repository node. |
void |
removeData(java.lang.String user,
java.lang.String subnode,
java.lang.String key)
removeData method removes pair (key, value) from user
repository in given subnode. |
void |
removeSubnode(java.lang.String user,
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(java.lang.String user)
This removeUser method allows to remove user and all his data
from user repository. |
void |
setData(java.lang.String user,
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(java.lang.String user,
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(java.lang.String user,
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 |
updatePassword(java.lang.String user,
java.lang.String password)
Describe updatePassword method here. |
boolean |
userExists(java.lang.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 |
|---|
public XMLRepository()
| Method Detail |
|---|
public void initRepository(java.lang.String file,
java.util.Map<java.lang.String,java.lang.String> params)
UserAuthRepositoryinitRepository method is doing initialization for database
connection. It may also do lazy initialization with database.
Connection to database might be established during the first authentication
request.
initRepository in interface UserAuthRepositoryinitRepository in interface UserRepositoryfile - a String value of database connection string.
The string must also contain database user name and password if required
for connection.public java.lang.String getResourceUri()
UserAuthRepositorygetResourceUri method returns database connection string.
getResourceUri in interface UserAuthRepositorygetResourceUri in interface UserRepositoryString value of database connection string.
public void addUser(java.lang.String user)
throws UserExistsException
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.user id consists of user name and domain
address: username@domain.address.net for example.
addUser in interface UserRepositoryuser - a String value of user id consisting of user name
and domain address.
UserExistsException - if user with the same id already exists.public boolean userExists(java.lang.String user)
UserRepositoryuserExists 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.
userExists in interface UserRepositoryuser - a String value
boolean value
public void removeUser(java.lang.String user)
throws UserNotFoundException
removeUser method allows to remove user and all his data
from user repository.
If given user id does not exist UserNotFoundException must be
thrown. 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.
removeUser in interface UserAuthRepositoryremoveUser in interface UserRepositoryuser - a String value of user id consisting of user name
and domain address.
UserNotFoundException - if user id hasn't been found in repository.public java.util.List<java.lang.String> getUsers()
UserRepository
getUsers in interface UserRepositorypublic long getUsersCount(java.lang.String domain)
UserAuthRepository
getUsersCount in interface UserAuthRepositorygetUsersCount in interface UserRepositorylong number of registered users in the repository.public long getUsersCount()
UserAuthRepository
getUsersCount in interface UserAuthRepositorygetUsersCount in interface UserRepositorylong number of registered users in the repository.
public void setData(java.lang.String user,
java.lang.String subnode,
java.lang.String key,
java.lang.String value)
throws UserNotFoundException,
TigaseDBException
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.
setData in interface UserRepositoryuser - 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.
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public void setData(java.lang.String user,
java.lang.String key,
java.lang.String value)
throws UserNotFoundException,
TigaseDBException
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.
setData in interface UserRepositoryuser - 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.
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public void setDataList(java.lang.String user,
java.lang.String subnode,
java.lang.String key,
java.lang.String[] list)
throws UserNotFoundException,
TigaseDBException
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.
setDataList in interface UserRepositoryuser - 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 associated
with the specified key.
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public void addDataList(java.lang.String user,
java.lang.String subnode,
java.lang.String key,
java.lang.String[] list)
throws UserNotFoundException,
TigaseDBException
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.
addDataList in interface UserRepositoryuser - 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 associated
with the specified key.
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String[] getDataList(java.lang.String user,
java.lang.String subnode,
java.lang.String key)
throws UserNotFoundException,
TigaseDBException
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.
getDataList in interface UserRepositoryuser - 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.
String[] value
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String getData(java.lang.String user,
java.lang.String subnode,
java.lang.String key,
java.lang.String def)
throws UserNotFoundException,
TigaseDBException
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.
getData in interface UserRepositoryuser - 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 exist in repository.
String value
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String getData(java.lang.String user,
java.lang.String subnode,
java.lang.String key)
throws UserNotFoundException,
TigaseDBException
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.
getData in interface UserRepositoryuser - 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.
String value
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String getData(java.lang.String user,
java.lang.String key)
throws UserNotFoundException,
TigaseDBException
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.
getData in interface UserRepositoryuser - 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.
String value
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String[] getSubnodes(java.lang.String user,
java.lang.String subnode)
throws UserNotFoundException,
TigaseDBException
getSubnodes method returns list of all direct subnodes from
given node.
getSubnodes in interface UserRepositoryuser - 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.
String[] value is an array of all direct subnodes.
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String[] getSubnodes(java.lang.String user)
throws UserNotFoundException,
TigaseDBException
getSubnodes method returns list of all root nodes for
given user.
getSubnodes in interface UserRepositoryuser - a String value of user ID for which data must be
stored. User ID consists of user name and domain name.
String[] value is an array of all root
nodes for given user.
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String[] getKeys(java.lang.String user,
java.lang.String subnode)
throws UserNotFoundException,
TigaseDBException
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.
getKeys in interface UserRepositoryuser - 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.
String[] value
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public java.lang.String[] getKeys(java.lang.String user)
throws UserNotFoundException,
TigaseDBException
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.
getKeys in interface UserRepositoryuser - a String value of user ID for which data must be
stored. User ID consists of user name and domain name.
String[] value
UserNotFoundException - if user id hasn't been found in repository.
TigaseDBException - if database backend error occurs.
public void removeData(java.lang.String user,
java.lang.String subnode,
java.lang.String key)
throws UserNotFoundException
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.
removeData in interface UserRepositoryuser - 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.
UserNotFoundException - if user id hasn't been found in repository.
public void removeData(java.lang.String user,
java.lang.String key)
throws UserNotFoundException
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.
removeData in interface UserRepositoryuser - 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.
UserNotFoundException - if user id hasn't been found in repository.
public void removeSubnode(java.lang.String user,
java.lang.String subnode)
throws UserNotFoundException
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.
removeSubnode in interface UserRepositoryuser - 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.
UserNotFoundException - if user id hasn't been found in repository.
public boolean plainAuth(java.lang.String user,
java.lang.String password)
throws UserNotFoundException,
TigaseDBException,
AuthorizationException
plainAuth method here.
plainAuth in interface UserAuthRepositoryuser - a String valuepassword - a String value
boolean value
UserNotFoundException - if an error occurs
TigaseDBException - if an error occurs
AuthorizationException - if an error occurs during authentication
process.
public boolean digestAuth(java.lang.String user,
java.lang.String digest,
java.lang.String id,
java.lang.String alg)
throws UserNotFoundException,
TigaseDBException,
AuthorizationException
digestAuth method here.
digestAuth in interface UserAuthRepositoryuser - a String valuedigest - a String valueid - a String valuealg - a String value
boolean value
UserNotFoundException - if an error occurs
TigaseDBException - if an error occurs
AuthorizationException - if an error occurs during authentication
process.
public boolean otherAuth(java.util.Map<java.lang.String,java.lang.Object> props)
throws UserNotFoundException,
TigaseDBException,
AuthorizationException
otherAuth method here.
otherAuth in interface UserAuthRepositoryprops - a Map value
boolean value
UserNotFoundException - if an error occurs
TigaseDBException - if an error occurs
AuthorizationException - if an error occurs
public void logout(java.lang.String user)
throws UserNotFoundException,
TigaseDBException
UserAuthRepositorylogout method here.
logout in interface UserAuthRepositoryuser - a String value
UserNotFoundException - if an error occurs
TigaseDBException - if an error occurs
public void updatePassword(java.lang.String user,
java.lang.String password)
throws UserExistsException,
TigaseDBException
UserAuthRepositoryupdatePassword method here.
updatePassword in interface UserAuthRepositoryuser - a String valuepassword - a String value
UserNotFoundException
TigaseDBException - if an error occurs
UserExistsException
public void addUser(java.lang.String user,
java.lang.String password)
throws UserExistsException,
TigaseDBException
addUser method here.
addUser in interface UserAuthRepositoryuser - a String valuepassword - a String value
UserExistsException - if an error occurs
TigaseDBException - if an error occurspublic void queryAuth(java.util.Map<java.lang.String,java.lang.Object> authProps)
UserAuthRepositoryqueryAuth returns mechanisms available for authentication.
queryAuth in interface UserAuthRepositoryauthProps - a Map value with parameters for authentication.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||