public abstract class RepositoryAccess extends Object
Modifier and Type | Field and Description |
---|---|
protected AuthRepository |
authRepo |
protected Authorization |
authState
Current authorization state - initialy session i
NOT_AUTHORIZED . |
protected VHostItem |
domain |
protected boolean |
is_anonymous |
protected static String |
NO_ACCESS_TO_REP_MSG |
protected static String |
NOT_AUTHORIZED_MSG |
Constructor and Description |
---|
RepositoryAccess(UserRepository rep,
AuthRepository auth)
Creates a new
RepositoryAccess instance. |
Modifier and Type | Method and Description |
---|---|
void |
addDataList(String subnode,
String key,
String[] list) |
void |
addOfflineDataList(String subnode,
String key,
String[] list) |
void |
addPublicDataList(String subnode,
String key,
String[] list) |
Authorization |
changeRegistration(String name_param,
String pass_param,
Map<String,String> registr_params) |
String |
getAuthenticationToken(String xmpp_sessionId) |
Authorization |
getAuthState()
Gets the value of authState
|
abstract BareJID |
getBareJID()
Returns user JID but without resource part.
|
String |
getData(String subnode,
String key,
String def)
getData method is a twin sister (brother?) |
String[] |
getDataGroups(String subnode)
This method retrieves list of all direct subnodes for given node.
|
String[] |
getDataKeys(String subnode)
This method returns all data keys available in permanent storage in given node.
|
String[] |
getDataList(String subnode,
String key)
This method allows to retrieve list of values associated with one key.
|
VHostItem |
getDomain() |
JID |
getDomainAsJID() |
String |
getOfflineData(String subnode,
String key,
String def) |
String[] |
getOfflineDataList(String subnode,
String key) |
String |
getPublicData(String subnode,
String key,
String def) |
String[] |
getPublicDataList(String subnode,
String key) |
abstract String |
getUserName() |
boolean |
isAnonymous() |
boolean |
isAuthorized()
This method allows you test this session if it already has been authorized.
|
protected abstract void |
login() |
void |
logout() |
void |
queryAuth(Map<String,Object> authProps) |
void |
removeData(String subnode,
String key) |
void |
removeDataGroup(String subnode)
Removes the last data node given in subnode path as parameter to this method.
|
void |
removeOfflineData(String subnode,
String key) |
void |
removeOfflineDataGroup(String subnode) |
void |
removePublicData(String subnode,
String key) |
void |
removePublicDataGroup(String subnode) |
void |
setData(String subnode,
String key,
String value)
This method stores given data in permanent storage in given point of hierarchy of data base.
|
void |
setDataList(String subnode,
String key,
String[] list)
This method allows to store list of values under one key ID reference.
|
void |
setDomain(VHostItem domain) |
void |
setOfflineData(String subnode,
String key,
String value) |
void |
setOfflineDataList(String subnode,
String key,
String[] list) |
void |
setPublicData(String subnode,
String key,
String value) |
void |
setPublicDataList(String subnode,
String key,
String[] list) |
void |
setRegistration(String name_param,
String pass_param,
Map<String,String> registr_params) |
Authorization |
unregister(String name_param)
Deprecated.
|
protected static final String NO_ACCESS_TO_REP_MSG
protected static final String NOT_AUTHORIZED_MSG
protected AuthRepository authRepo
protected Authorization authState
NOT_AUTHORIZED
. It becomes AUTHORIZED
protected VHostItem domain
protected boolean is_anonymous
public RepositoryAccess(UserRepository rep, AuthRepository auth)
RepositoryAccess
instance.public void addDataList(String subnode, String key, String[] list) throws NotAuthorizedException, TigaseDBException
public void addOfflineDataList(String subnode, String key, String[] list) throws NotAuthorizedException, TigaseDBException
public void addPublicDataList(String subnode, String key, String[] list) throws NotAuthorizedException, TigaseDBException
public void logout() throws NotAuthorizedException
NotAuthorizedException
public void queryAuth(Map<String,Object> authProps) throws TigaseDBException
TigaseDBException
public Authorization changeRegistration(String name_param, String pass_param, Map<String,String> registr_params) throws NotAuthorizedException, TigaseDBException, TigaseStringprepException
public void removeData(String subnode, String key) throws NotAuthorizedException, TigaseDBException
public void removeDataGroup(String subnode) throws NotAuthorizedException, TigaseDBException
(key, val)
are removed as well. Changes are commited to repository immediatelly
and there is no way to undo this operation so use it with care.subnode
- a String
value of path to node which has to be removed.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
setData(String, String, String)
public void removeOfflineData(String subnode, String key) throws NotAuthorizedException, TigaseDBException
public void removeOfflineDataGroup(String subnode) throws NotAuthorizedException, TigaseDBException
public void removePublicData(String subnode, String key) throws NotAuthorizedException, TigaseDBException
public void removePublicDataGroup(String subnode) throws NotAuthorizedException, TigaseDBException
public String getAuthenticationToken(String xmpp_sessionId) throws NotAuthorizedException, TigaseDBException
public final Authorization getAuthState()
public abstract BareJID getBareJID() throws NotAuthorizedException
getJID()
method.NotAuthorizedException
.String
value of user ID - this is user JID without resource part. To obtain full user JID
please refer to getJID
method.NotAuthorizedException
- when this session has not been authorized yet and some parts of user JID are not
known yet.public String getData(String subnode, String key, String def) throws NotAuthorizedException, TigaseDBException
getData
method is a twin sister (brother?) of setData(String, String, String)
method.
It allows you to retrieve data stored with above method. It is data stored in given node with given key
identifier. If there are no data associated with given key or given node does not exist given def
value is returned.subnode
- a String
value is path to node where pair (key, value)
are stored.key
- a String
value of key ID for data to retrieve.def
- a String
value of default returned if there is nothing stored with given key.
def
can be set to any value you wish to have back as default value or null
if you want
to have back null
if no data was found. If you set def
to null
it has
exactly the same effect as if you use getData(String)
method.String
value of data found for given key or def
if there was no data
associated with given key.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
setData(String, String, String)
public String[] getDataGroups(String subnode) throws NotAuthorizedException, TigaseDBException
ls
unix
command or dir
under DOS/Windows systems.subnode
- a String
value of path to node for which we want to retrieve list of direct
subnodes.String[]
array of direct subnodes names for given node.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
setData(String, String, String)
public String[] getDataKeys(String subnode) throws NotAuthorizedException, TigaseDBException
subnode
- a String
value pointing to specific subnode in user reposiotry where data have to be
stored.String[]
array containing all data keys found in given subnode.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
setData(String, String, String)
public String[] getDataList(String subnode, String key) throws NotAuthorizedException, TigaseDBException
null
is returned.subnode
- a String
value pointing to specific subnode in user reposiotry where data have to be
stored.key
- a String
value of data key ID.String[]
array containing all values found for given key.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
setData(String, String, String)
public VHostItem getDomain()
public void setDomain(VHostItem domain) throws TigaseStringprepException
TigaseStringprepException
public JID getDomainAsJID()
public String getOfflineData(String subnode, String key, String def) throws NotAuthorizedException, TigaseDBException
public String[] getOfflineDataList(String subnode, String key) throws NotAuthorizedException, TigaseDBException
public String getPublicData(String subnode, String key, String def) throws NotAuthorizedException, TigaseDBException
public String[] getPublicDataList(String subnode, String key) throws NotAuthorizedException, TigaseDBException
public abstract String getUserName() throws NotAuthorizedException
NotAuthorizedException
public boolean isAnonymous()
public boolean isAuthorized()
true
is returned as
method result it means session has already been authorized, if false
however session is still not
authorized.boolean
value which informs whether this session has been already authorized or not.public void setData(String subnode, String key, String value) throws NotAuthorizedException, TigaseDBException
setData(String, String)
and differs in one additional parameter which point to user data
base subnode where data must be stored. It helps to organize user data in more logical hierarchy.UserRepository
interface for general info and to
XMLRepository
for detailed explanation regarding XML implementation of user repository. subnode
is kind of path to data node. If you specify null
or empty node data will be
stored in root user node. This has exactly the same effect as you call setData(String, String)
. If
you want to store data in different node you must just specify node path like you do it to directory on most file
systems:
/roster
/just/like/path/to/file
removeDataGroup(String)
for deleting specified node as nodes are not automaticaly deleted.subnode
- a String
value pointing to specific subnode in user reposiotry where data have to be
stored.key
- a String
value of data key ID.value
- a String
actual data stored in user repository.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
removeDataGroup(String)
,
UserRepository
public void setDataList(String subnode, String key, String[] list) throws NotAuthorizedException, TigaseDBException
subnode
- a String
value pointing to specific subnode in user reposiotry where data have to be
stored.key
- a String
value of data key ID.list
- a String[]
keeping list of actual data to be stored in user repository.NotAuthorizedException
- is thrown when session has not been authorized yet and there is no access to
permanent storage.TigaseDBException
setData(String, String, String)
public void setOfflineData(String subnode, String key, String value) throws NotAuthorizedException, TigaseDBException
public void setOfflineDataList(String subnode, String key, String[] list) throws NotAuthorizedException, TigaseDBException
public void setPublicData(String subnode, String key, String value) throws NotAuthorizedException, TigaseDBException
public void setPublicDataList(String subnode, String key, String[] list) throws NotAuthorizedException, TigaseDBException
public void setRegistration(String name_param, String pass_param, Map<String,String> registr_params) throws TigaseDBException, TigaseStringprepException
@Deprecated public Authorization unregister(String name_param) throws NotAuthorizedException, TigaseDBException, TigaseStringprepException
protected abstract void login()
Copyright © 2004–2020 "Tigase, Inc.". All rights reserved.