|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttigase.db.jdbc.JDBCRepository
public class JDBCRepository
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
Field Summary | |
---|---|
static String |
DEF_MAXIDS_TBL
|
static String |
DEF_NODES_TBL
|
static String |
DEF_PAIRS_TBL
|
static String |
DEF_ROOT_NODE
|
static String |
DEF_USERS_TBL
|
static String |
DERBY_CONNVALID_QUERY
|
static String |
DERBY_GETSCHEMAVER_QUERY
|
static String |
JDBC_CONNVALID_QUERY
|
static String |
JDBC_GETSCHEMAVER_QUERY
|
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 | |
---|---|
JDBCRepository()
|
Method Summary | |
---|---|
void |
addDataList(String user_id,
String subnode,
String key,
String[] list)
Describe addDataList method here. |
void |
addUser(String user_id)
Describe addUser method here. |
void |
addUser(String user,
String password)
Describe addUser method here. |
boolean |
digestAuth(String user,
String digest,
String id,
String alg)
Describe digestAuth method here. |
String |
getData(String user_id,
String key)
Describe getData method here. |
String |
getData(String user_id,
String subnode,
String key)
Describe getData method here. |
String |
getData(String user_id,
String subnode,
String key,
String def)
Describe getData method here. |
String[] |
getDataList(String user_id,
String subnode,
String key)
Describe getDataList method here. |
String[] |
getKeys(String user_id)
Describe getKeys method here. |
String[] |
getKeys(String user_id,
String subnode)
Describe getKeys method here. |
String |
getResourceUri()
getResourceUri method returns database connection string. |
String[] |
getSubnodes(String user_id)
Describe getSubnodes method here. |
String[] |
getSubnodes(String user_id,
String subnode)
Describe getSubnodes method here. |
List<String> |
getUsers()
getUsers method is thread safe. |
long |
getUsersCount()
getUsersCount method is thread safe. |
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 connection_str,
Map<String,String> params)
Describe initRepository method here. |
void |
logout(String user)
Describe logout method here. |
boolean |
otherAuth(Map<String,Object> props)
Describe otherAuth method here. |
boolean |
plainAuth(String user,
String password)
Describe plainAuth method here. |
void |
queryAuth(Map<String,Object> authProps)
queryAuth returns mechanisms available for authentication. |
void |
removeData(String user_id,
String key)
Describe removeData method here. |
void |
removeData(String user_id,
String subnode,
String key)
Describe removeData method here. |
void |
removeSubnode(String user_id,
String subnode)
Describe removeSubnode method here. |
void |
removeUser(String user_id)
removeUser method is thread safe. |
void |
setData(String user_id,
String key,
String value)
Describe setData method here. |
void |
setData(String user_id,
String subnode,
String key,
String value)
Describe setData method here. |
void |
setDataList(String user_id,
String subnode,
String key,
String[] list)
Describe setDataList method here. |
void |
updatePassword(String user,
String password)
Describe updatePassword 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 |
Field Detail |
---|
public static final String DEF_USERS_TBL
public static final String DEF_NODES_TBL
public static final String DEF_PAIRS_TBL
public static final String DEF_MAXIDS_TBL
public static final String DEF_ROOT_NODE
public static final String DERBY_CONNVALID_QUERY
public static final String JDBC_CONNVALID_QUERY
public static final String DERBY_GETSCHEMAVER_QUERY
public static final String JDBC_GETSCHEMAVER_QUERY
Constructor Detail |
---|
public JDBCRepository()
Method Detail |
---|
public boolean userExists(String user)
UserRepository
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.
userExists
in interface UserRepository
user
- a String
value
boolean
valuepublic String getResourceUri()
UserAuthRepository
getResourceUri
method returns database connection string.
getResourceUri
in interface UserAuthRepository
getResourceUri
in interface UserRepository
String
value of database connection string.public void initRepository(String connection_str, Map<String,String> params) throws DBInitException
initRepository
method here.
initRepository
in interface UserAuthRepository
initRepository
in interface UserRepository
connection_str
- a String
value
DBInitException
- if an error occurs during access database. It won't
happen however as in this method we do simple variable assigment.public long getUsersCount()
getUsersCount
method is thread safe. It uses local variable
for storing Statement
.
getUsersCount
in interface UserAuthRepository
getUsersCount
in interface UserRepository
long
number of user accounts in database.public long getUsersCount(String domain)
UserAuthRepository
getUsersCount
in interface UserAuthRepository
getUsersCount
in interface UserRepository
long
number of registered users in the repository.public List<String> getUsers() throws TigaseDBException
getUsers
method is thread safe. It uses local variable
for storing Statement
.
getUsers
in interface UserRepository
List
of user IDs from database.
TigaseDBException
public void addUser(String user_id) throws UserExistsException, TigaseDBException
addUser
method here.
addUser
in interface UserRepository
user_id
- a String
value
UserExistsException
- if an error occurs
TigaseDBException
public void removeUser(String user_id) throws UserNotFoundException, TigaseDBException
removeUser
method is thread safe. It uses local variable
for storing Statement
.
removeUser
in interface UserAuthRepository
removeUser
in interface UserRepository
user_id
- a String
value the user Jabber ID.
UserNotFoundException
- if an error occurs
TigaseDBException
- if an error occurspublic String[] getDataList(String user_id, String subnode, String key) throws UserNotFoundException, TigaseDBException
getDataList
method here.
getDataList
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
value
String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String[] getSubnodes(String user_id, String subnode) throws UserNotFoundException, TigaseDBException
getSubnodes
method here.
getSubnodes
in interface UserRepository
user_id
- a String
valuesubnode
- a String
value
String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String[] getSubnodes(String user_id) throws UserNotFoundException, TigaseDBException
getSubnodes
method here.
getSubnodes
in interface UserRepository
user_id
- a String
value
String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void removeSubnode(String user_id, String subnode) throws UserNotFoundException, TigaseDBException
removeSubnode
method here.
removeSubnode
in interface UserRepository
user_id
- a String
valuesubnode
- a String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void setDataList(String user_id, String subnode, String key, String[] list) throws UserNotFoundException, TigaseDBException
setDataList
method here.
setDataList
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
valuelist
- a String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void addDataList(String user_id, String subnode, String key, String[] list) throws UserNotFoundException, TigaseDBException
addDataList
method here.
addDataList
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
valuelist
- a String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String[] getKeys(String user_id, String subnode) throws UserNotFoundException, TigaseDBException
getKeys
method here.
getKeys
in interface UserRepository
user_id
- a String
valuesubnode
- a String
value
String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String[] getKeys(String user_id) throws UserNotFoundException, TigaseDBException
getKeys
method here.
getKeys
in interface UserRepository
user_id
- a String
value
String[]
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String getData(String user_id, String subnode, String key, String def) throws UserNotFoundException, TigaseDBException
getData
method here.
getData
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
valuedef
- a String
value
String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String getData(String user_id, String subnode, String key) throws UserNotFoundException, TigaseDBException
getData
method here.
getData
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
value
String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public String getData(String user_id, String key) throws UserNotFoundException, TigaseDBException
getData
method here.
getData
in interface UserRepository
user_id
- a String
valuekey
- a String
value
String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void setData(String user_id, String subnode, String key, String value) throws UserNotFoundException, TigaseDBException
setData
method here.
setData
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
valuevalue
- a String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void setData(String user_id, String key, String value) throws UserNotFoundException, TigaseDBException
setData
method here.
setData
in interface UserRepository
user_id
- a String
valuekey
- a String
valuevalue
- a String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void removeData(String user_id, String subnode, String key) throws UserNotFoundException, TigaseDBException
removeData
method here.
removeData
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valuekey
- a String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public void removeData(String user_id, String key) throws UserNotFoundException, TigaseDBException
removeData
method here.
removeData
in interface UserRepository
user_id
- a String
valuekey
- a String
value
UserNotFoundException
- if an error occurs
TigaseDBException
public boolean plainAuth(String user, String password) throws UserNotFoundException, TigaseDBException, AuthorizationException
plainAuth
method here.
plainAuth
in interface UserAuthRepository
user
- 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(String user, String digest, String id, String alg) throws UserNotFoundException, TigaseDBException, AuthorizationException
digestAuth
method here.
digestAuth
in interface UserAuthRepository
user
- 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(Map<String,Object> props) throws UserNotFoundException, TigaseDBException, AuthorizationException
otherAuth
method here.
otherAuth
in interface UserAuthRepository
props
- a Map
value
boolean
value
UserNotFoundException
- if an error occurs
TigaseDBException
- if an error occurs
AuthorizationException
- if an error occurspublic void updatePassword(String user, String password) throws TigaseDBException
UserAuthRepository
updatePassword
method here.
updatePassword
in interface UserAuthRepository
user
- a String
valuepassword
- a String
value
UserNotFoundException
TigaseDBException
- if an error occurspublic void logout(String user) throws UserNotFoundException, TigaseDBException
UserAuthRepository
logout
method here.
logout
in interface UserAuthRepository
user
- a String
value
UserNotFoundException
- if an error occurs
TigaseDBException
- if an error occurspublic void addUser(String user, String password) throws UserExistsException, TigaseDBException
addUser
method here.
addUser
in interface UserAuthRepository
user
- a String
valuepassword
- a String
value
UserExistsException
- if an error occurs
TigaseDBException
- if an error occurspublic void queryAuth(Map<String,Object> authProps)
UserAuthRepository
queryAuth
returns mechanisms available for authentication.
queryAuth
in interface UserAuthRepository
authProps
- a Map
value with parameters for authentication.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |