public class JDBCRepository extends Object implements AuthRepository, UserRepository
Thanks to Daniele for better unique IDs handling. Created: Thu Oct 26 11:48:53 2006
Repository.Meta
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_DB_SCHEMA_VER
Field description
|
static String |
DEF_MAXIDS_TBL
Field description
|
static String |
DEF_NODES_TBL
Field description
|
static String |
DEF_PAIRS_TBL
Field description
|
static String |
DEF_ROOT_NODE
Field description
|
static String |
DEF_USERS_TBL
Field description
|
static String |
DERBY_GETSCHEMAVER_QUERY
Field description
|
static String |
JDBC_GETSCHEMAVER_QUERY
Field description
|
static String |
SCHEMA_UPGRADE_LINK
Field description
|
static 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
|
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, USERNAME_KEY
Constructor and Description |
---|
JDBCRepository() |
Modifier and Type | Method and Description |
---|---|
void |
addDataList(tigase.xmpp.BareJID user_id,
String subnode,
String key,
String[] list)
Describe
addDataList method here. |
void |
addUser(tigase.xmpp.BareJID user_id)
Describe
addUser method here. |
void |
addUser(tigase.xmpp.BareJID user,
String password)
Describe
addUser method here. |
boolean |
digestAuth(tigase.xmpp.BareJID user,
String digest,
String id,
String alg)
Deprecated.
|
String |
getData(tigase.xmpp.BareJID user_id,
String key)
Describe
getData method here. |
String |
getData(tigase.xmpp.BareJID user_id,
String subnode,
String key)
Describe
getData method here. |
String |
getData(tigase.xmpp.BareJID user_id,
String subnode,
String key,
String def)
Describe
getData method here. |
String[] |
getDataList(tigase.xmpp.BareJID user_id,
String subnode,
String key)
Describe
getDataList method here. |
String[] |
getKeys(tigase.xmpp.BareJID user_id)
Describe
getKeys method here. |
String[] |
getKeys(tigase.xmpp.BareJID user_id,
String subnode)
Describe
getKeys method here. |
String |
getPassword(tigase.xmpp.BareJID user) |
String |
getResourceUri()
Method description
|
String[] |
getSubnodes(tigase.xmpp.BareJID user_id)
Describe
getSubnodes method here. |
String[] |
getSubnodes(tigase.xmpp.BareJID user_id,
String subnode)
Describe
getSubnodes method here. |
List<tigase.xmpp.BareJID> |
getUsers()
getUsers method is thread safe. |
long |
getUsersCount()
getUsersCount method is thread safe. |
long |
getUsersCount(String domain)
Method description
|
long |
getUserUID(tigase.xmpp.BareJID user_id)
Method description
|
long |
getUserUID(DataRepository repo,
tigase.xmpp.BareJID user_id)
Method description
|
void |
initRepository(String connection_str,
Map<String,String> params)
Describe
initRepository method here. |
void |
logout(tigase.xmpp.BareJID user)
Method description
|
boolean |
otherAuth(Map<String,Object> props)
Describe
otherAuth method here. |
boolean |
plainAuth(tigase.xmpp.BareJID user,
String password)
Deprecated.
|
void |
queryAuth(Map<String,Object> authProps)
Method description
|
void |
removeData(tigase.xmpp.BareJID user_id,
String key)
Describe
removeData method here. |
void |
removeData(tigase.xmpp.BareJID user_id,
String subnode,
String key)
Describe
removeData method here. |
void |
removeSubnode(tigase.xmpp.BareJID user_id,
String subnode)
Describe
removeSubnode method here. |
void |
removeUser(tigase.xmpp.BareJID user_id)
removeUser method is thread safe. |
void |
setData(tigase.xmpp.BareJID user_id,
String key,
String value)
Describe
setData method here. |
void |
setData(tigase.xmpp.BareJID user_id,
String subnode,
String key,
String value)
Describe
setData method here. |
void |
setDataList(tigase.xmpp.BareJID user_id,
String subnode,
String key,
String[] list)
Describe
setDataList method here. |
void |
updatePassword(tigase.xmpp.BareJID user,
String password)
Method description
|
boolean |
userExists(tigase.xmpp.BareJID user)
Method description
|
public static final String CURRENT_DB_SCHEMA_VER
public static final String DEF_MAXIDS_TBL
public static final String DEF_NODES_TBL
public static final String DEF_PAIRS_TBL
public static final String DEF_ROOT_NODE
public static final String DEF_USERS_TBL
public static final String DERBY_GETSCHEMAVER_QUERY
public static final String SQLSERVER_GETSCHEMAVER_QUERY
public static final String JDBC_GETSCHEMAVER_QUERY
public static final String SCHEMA_UPGRADE_LINK
public void addDataList(tigase.xmpp.BareJID 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[]
valueUserNotFoundException
- if an error occursTigaseDBException
public void addUser(tigase.xmpp.BareJID user_id) throws UserExistsException, TigaseDBException
addUser
method here.addUser
in interface UserRepository
user_id
- a String
valueUserExistsException
- if an error occursTigaseDBException
public void addUser(tigase.xmpp.BareJID user, String password) throws UserExistsException, TigaseDBException
addUser
method here.addUser
in interface AuthRepository
user
- a String
valuepassword
- a String
valueUserExistsException
- if an error occursTigaseDBException
- if an error occurs@Deprecated public boolean digestAuth(tigase.xmpp.BareJID user, String digest, String id, String alg) throws UserNotFoundException, TigaseDBException, AuthorizationException
digestAuth
method here.digestAuth
in interface AuthRepository
user
- a String
valuedigest
- a String
valueid
- a String
valuealg
- a String
valueboolean
valueAuthorizationException
UserNotFoundException
- if an error occursTigaseDBException
- if an error occurspublic String getData(tigase.xmpp.BareJID 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
valueString
valueUserNotFoundException
- if an error occursTigaseDBException
public String getData(tigase.xmpp.BareJID 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
valueString
valueUserNotFoundException
- if an error occursTigaseDBException
public String getData(tigase.xmpp.BareJID user_id, String key) throws UserNotFoundException, TigaseDBException
getData
method here.getData
in interface UserRepository
user_id
- a String
valuekey
- a String
valueString
valueUserNotFoundException
- if an error occursTigaseDBException
public String[] getDataList(tigase.xmpp.BareJID 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
valueString[]
valueUserNotFoundException
- if an error occursTigaseDBException
public String[] getKeys(tigase.xmpp.BareJID user_id, String subnode) throws UserNotFoundException, TigaseDBException
getKeys
method here.getKeys
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valueString[]
valueUserNotFoundException
- if an error occursTigaseDBException
public String[] getKeys(tigase.xmpp.BareJID user_id) throws UserNotFoundException, TigaseDBException
getKeys
method here.getKeys
in interface UserRepository
user_id
- a String
valueString[]
valueUserNotFoundException
- if an error occursTigaseDBException
public String getResourceUri()
getResourceUri
in interface AuthRepository
getResourceUri
in interface UserRepository
String
value of database connection string.public String[] getSubnodes(tigase.xmpp.BareJID user_id, String subnode) throws UserNotFoundException, TigaseDBException
getSubnodes
method here.getSubnodes
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valueString[]
valueUserNotFoundException
- if an error occursTigaseDBException
public String[] getSubnodes(tigase.xmpp.BareJID user_id) throws UserNotFoundException, TigaseDBException
getSubnodes
method here.getSubnodes
in interface UserRepository
user_id
- a String
valueString[]
valueUserNotFoundException
- if an error occursTigaseDBException
public long getUserUID(tigase.xmpp.BareJID user_id) throws TigaseDBException
getUserUID
in interface UserRepository
user_id
- TigaseDBException
public long getUserUID(DataRepository repo, tigase.xmpp.BareJID user_id) throws SQLException
repo
- user_id
- SQLException
public List<tigase.xmpp.BareJID> getUsers() throws TigaseDBException
getUsers
method is thread safe.getUsers
in interface UserRepository
List
of user IDs from database.TigaseDBException
public long getUsersCount()
getUsersCount
method is thread safe. It uses local variable
for storing Statement
.getUsersCount
in interface AuthRepository
getUsersCount
in interface UserRepository
long
number of user accounts in database.public long getUsersCount(String domain)
getUsersCount
in interface AuthRepository
getUsersCount
in interface UserRepository
domain
- long
number of registered users in the repository.public void initRepository(String connection_str, Map<String,String> params) throws DBInitException
initRepository
method here.initRepository
in interface Repository
connection_str
- a String
valueparams
- DBInitException
public void logout(tigase.xmpp.BareJID user) throws UserNotFoundException, TigaseDBException
logout
in interface AuthRepository
user
- TigaseDBException
UserNotFoundException
public boolean otherAuth(Map<String,Object> props) throws UserNotFoundException, TigaseDBException, AuthorizationException
otherAuth
method here.otherAuth
in interface AuthRepository
props
- a Map
valueboolean
valueUserNotFoundException
- if an error occursTigaseDBException
- if an error occursAuthorizationException
- if an error occurs@Deprecated public boolean plainAuth(tigase.xmpp.BareJID user, String password) throws UserNotFoundException, TigaseDBException, AuthorizationException
plainAuth
method here.plainAuth
in interface AuthRepository
user
- a String
valuepassword
- a String
valueboolean
valueAuthorizationException
UserNotFoundException
- if an error occursTigaseDBException
- if an error occurspublic void queryAuth(Map<String,Object> authProps)
queryAuth
in interface AuthRepository
authProps
- public void removeData(tigase.xmpp.BareJID 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
valueUserNotFoundException
- if an error occursTigaseDBException
public void removeData(tigase.xmpp.BareJID user_id, String key) throws UserNotFoundException, TigaseDBException
removeData
method here.removeData
in interface UserRepository
user_id
- a String
valuekey
- a String
valueUserNotFoundException
- if an error occursTigaseDBException
public void removeSubnode(tigase.xmpp.BareJID user_id, String subnode) throws UserNotFoundException, TigaseDBException
removeSubnode
method here.removeSubnode
in interface UserRepository
user_id
- a String
valuesubnode
- a String
valueUserNotFoundException
- if an error occursTigaseDBException
public void removeUser(tigase.xmpp.BareJID user_id) throws UserNotFoundException, TigaseDBException
removeUser
method is thread safe. It uses local variable for
storing Statement
.removeUser
in interface AuthRepository
removeUser
in interface UserRepository
user_id
- a String
value the user Jabber ID.TigaseDBException
UserNotFoundException
- if an error occurspublic void setData(tigase.xmpp.BareJID 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
valueUserNotFoundException
- if an error occursTigaseDBException
public void setData(tigase.xmpp.BareJID 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
valueUserNotFoundException
- if an error occursTigaseDBException
public void setDataList(tigase.xmpp.BareJID 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[]
valueUserNotFoundException
- if an error occursTigaseDBException
public void updatePassword(tigase.xmpp.BareJID user, String password) throws TigaseDBException
updatePassword
in interface AuthRepository
user
- password
- TigaseDBException
UserNotFoundException
public boolean userExists(tigase.xmpp.BareJID user)
userExists
in interface UserRepository
user
- boolean
valuepublic String getPassword(tigase.xmpp.BareJID user) throws UserNotFoundException, TigaseDBException
getPassword
in interface AuthRepository
UserNotFoundException
TigaseDBException
Copyright © 2014 "Tigase, Inc.". All rights reserved.