public class XMPPResourceConnection extends RepositoryAccess
| Modifier and Type | Field and Description |
|---|---|
static String |
ALL_RESOURCES_CAPS_KEY |
static String |
ALL_RESOURCES_KEY |
static String |
ALL_RESOURCES_PRIORITY_KEY |
static String |
AUTHENTICATION_TIMEOUT_KEY |
static String |
CLOSING_KEY |
static String |
ERROR_KEY |
static String |
PRESENCE_KEY
Constant
PRESENCE_KEY is a key in temporary session data where the last presence sent by the user to
server is stored, either initial presence or off-line presence before disconnecting. |
authRepo, authState, domain, is_anonymous, NO_ACCESS_TO_REP_MSG, NOT_AUTHORIZED_MSG| Constructor and Description |
|---|
XMPPResourceConnection(JID connectionId,
UserRepository rep,
AuthRepository authRepo,
SessionManagerHandler loginHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
authorizeJID(BareJID jid,
boolean anonymous) |
Object |
computeCommonSessionDataIfAbsent(String key,
Function<String,Object> valueFactory)
Method checks if in
parentSession in session data there is value for passed key and returns it if
exists. |
Object |
computeSessionDataIfAbsent(String key,
Function<String,Object> valueFactory)
Method checks if in session data is value for passed
key and returns it if exists. |
List<XMPPResourceConnection> |
getActiveSessions()
Method returns list of active connection for the same
XMPPSession. |
JID[] |
getAllResourcesJIDs()
Method returns list of jids of all connections for the same
XMPPSession (same user). |
AuthRepository |
getAuthRepository() |
long |
getAuthTime() |
BareJID |
getBareJID()
Returns user JID but without resource part.
|
Object |
getCommonSessionData(String key) |
JID |
getConnectionId()
Gets the value of connectionId
|
JID |
getConnectionId(boolean updateLastAccessed) |
JID |
getConnectionId(JID jid) |
long |
getCreationTime() |
String |
getDefLang() |
JID |
getjid()
Returns full user JID for this session without throwing the
NotAuthorizedException exception if
session is not authorized yet and therefore user name and resource is not known yet. |
JID |
getJID()
Returns full user JID for this session or throws
NotAuthorizedException if session is not authorized
yet and therefore user name and resource is not known yet. |
long |
getLastAccessed()
Gets the value of lastAccessed
|
long |
getPacketsCounter() |
XMPPSession |
getParentSession() |
Element |
getPresence()
Returns last presence packet with the user presence status or
null if the user has not yet sent an
initial presence. |
int |
getPriority() |
String |
getResource()
Gets the value of resource
|
Object |
getSessionData(String key)
Retrieves session data.
|
String |
getSessionId()
Gets the value of sessionId
|
JID |
getSMComponentId() |
BareJID |
getUserId()
Deprecated.
|
String |
getUserName() |
void |
incPacketsCounter() |
boolean |
isAuthorized()
This method allows you test this session if it already has been authorized.
|
boolean |
isEncrypted() |
boolean |
isLocalDomain(String outDomain,
boolean includeComponents) |
boolean |
isResourceSet() |
boolean |
isServerSession()
Returns information whether this is a server (SessionManager) session or normal user session.
|
boolean |
isTlsRequired() |
boolean |
isTmpSession() |
boolean |
isUserId(BareJID bareJID) |
protected void |
login() |
Authorization |
loginDigest(String user,
String digest,
String id,
String alg)
Deprecated.
|
Authorization |
loginOther(Map<String,Object> props)
Deprecated.
|
Authorization |
loginPlain(String user,
String password)
Deprecated.
|
void |
logout() |
String |
nextStanzaId() |
void |
putCommonSessionData(String key,
Object value)
Method sets passed value under passed key in common sessionData kept in parentSession
|
Object |
putCommonSessionDataIfAbsent(String key,
Object value)
Method sets passed value under passed
key in common sessionData kept in parentSession but
only if there is no value for this key already |
void |
putSessionData(String key,
Object value)
Saves given session data.
|
Object |
putSessionDataIfAbsent(String key,
Object value)
Method sets passed value under passed
key in sessionData but only if there is no value for this
key already |
void |
queryAuth(Map<String,Object> authProps) |
Object |
removeCommonSessionData(String key) |
void |
removeParentSession(XMPPSession parent) |
void |
removeSessionData(String key) |
void |
setConnectionId(JID connectionId)
Sets the value of connectionId
|
void |
setDefLang(String lang) |
void |
setLastAccessed(long argLastAccessed)
Sets the value of lastAccessed
|
void |
setParentSession(XMPPSession parent) |
void |
setPresence(Element packet) |
void |
setPriority(int priority) |
void |
setResource(String argResource)
Sets the connection resource
|
void |
setSessionId(String argSessionId)
Sets the value of sessionId
|
void |
setTmpSession(boolean tmp) |
void |
streamClosed() |
String |
toString() |
Authorization |
unregister(String name_param)
Deprecated.
|
addDataList, addOfflineDataList, addPublicDataList, changeRegistration, getAuthenticationToken, getAuthState, getData, getDataGroups, getDataKeys, getDataList, getDomain, getDomainAsJID, getOfflineData, getOfflineDataList, getPublicData, getPublicDataList, isAnonymous, loginDigest, loginPlain, loginToken, register, register, removeData, removeDataGroup, removeOfflineData, removeOfflineDataGroup, removePublicData, removePublicDataGroup, setData, setDataList, setDomain, setOfflineData, setOfflineDataList, setPublicData, setPublicDataList, setRegistrationpublic static final String ALL_RESOURCES_CAPS_KEY
public static final String ALL_RESOURCES_KEY
public static final String ALL_RESOURCES_PRIORITY_KEY
public static final String AUTHENTICATION_TIMEOUT_KEY
public static final String CLOSING_KEY
public static final String ERROR_KEY
public static final String PRESENCE_KEY
PRESENCE_KEY is a key in temporary session data where the last presence sent by the user to
server is stored, either initial presence or off-line presence before disconnecting.public XMPPResourceConnection(JID connectionId, UserRepository rep, AuthRepository authRepo, SessionManagerHandler loginHandler)
public void authorizeJID(BareJID jid, boolean anonymous) throws TigaseStringprepException
TigaseStringprepExceptionpublic Object computeCommonSessionDataIfAbsent(String key, Function<String,Object> valueFactory)
parentSession in session data there is value for passed key and returns it if
exists. If not then it uses passed valueFactory to generate value and sets it in parentSession in
session data under passed key and returns newly set valuekey - valueFactory - public Object computeSessionDataIfAbsent(String key, Function<String,Object> valueFactory)
key and returns it if exists. If not then it uses
passed valueFactory to generate value and sets it in session data under passed key and returns
newly set valuekey - valueFactory - public final JID getjid()
NotAuthorizedException exception if
session is not authorized yet and therefore user name and resource is not known yet. Please note this method is
for logging using only to avoid excessive use of try/catch for debugging code. It may return null.String value of calculated user full JID for this session including resource name.public void incPacketsCounter()
@Deprecated public final Authorization loginDigest(String user, String digest, String id, String alg) throws NotAuthorizedException, AuthorizationException, TigaseDBException, TigaseStringprepException
@Deprecated public final Authorization loginOther(Map<String,Object> props) throws NotAuthorizedException, AuthorizationException, TigaseDBException
loginOther in class RepositoryAccessNotAuthorizedExceptionAuthorizationExceptionTigaseDBException@Deprecated public final Authorization loginPlain(String user, String password) throws NotAuthorizedException, AuthorizationException, TigaseDBException, TigaseStringprepException
public final void logout()
throws NotAuthorizedException
logout in class RepositoryAccessNotAuthorizedExceptionpublic String nextStanzaId()
public void putCommonSessionData(String key, Object value)
key - value - public Object putCommonSessionDataIfAbsent(String key, Object value)
key in common sessionData kept in parentSession but
only if there is no value for this key alreadykey - value - public final void putSessionData(String key, Object value)
Object can be stored and retrieved through
getSessionData(...).get/setData...(...) methods familly. They gives you access to hierachical permanent data
base. Permanent data base however can be accessed after successuf authorization while session storage is availble
all the time.key - a String value of stored data key ID.value - a Object value of data stored in session.getSessionData(String)public Object putSessionDataIfAbsent(String key, Object value)
key in sessionData but only if there is no value for this
key alreadykey - value - public void queryAuth(Map<String,Object> authProps) throws TigaseDBException
queryAuth in class RepositoryAccessTigaseDBExceptionpublic void removeParentSession(XMPPSession parent)
public final void removeSessionData(String key)
public void streamClosed()
public List<XMPPResourceConnection> getActiveSessions() throws NotAuthorizedException
XMPPSession.List<XMPPResourceConnection>NotAuthorizedExceptionpublic JID[] getAllResourcesJIDs()
XMPPSession (same user).JID[]public AuthRepository getAuthRepository()
public long getAuthTime()
public final BareJID getBareJID() throws NotAuthorizedException
RepositoryAccessgetJID() method.NotAuthorizedException.getBareJID in class RepositoryAccessString 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 JID getConnectionId() throws NoConnectionIdException
NoConnectionIdExceptionpublic JID getConnectionId(boolean updateLastAccessed) throws NoConnectionIdException
NoConnectionIdExceptionpublic void setConnectionId(JID connectionId)
connectionId - is a JIDpublic JID getConnectionId(JID jid) throws NoConnectionIdException
NoConnectionIdExceptionpublic long getCreationTime()
public String getDefLang()
public void setDefLang(String lang)
public final JID getJID() throws NotAuthorizedException
NotAuthorizedException if session is not authorized
yet and therefore user name and resource is not known yet.String value of calculated user full JID for this session including resource name.NotAuthorizedExceptionpublic long getLastAccessed()
public void setLastAccessed(long argLastAccessed)
argLastAccessed - Value to assign to this.lastAccessedpublic long getPacketsCounter()
public XMPPSession getParentSession()
public void setParentSession(XMPPSession parent) throws TigaseStringprepException
TigaseStringprepExceptionpublic Element getPresence()
null if the user has not yet sent an
initial presence.Element with last presence status received from the user.public void setPresence(Element packet)
public int getPriority()
public void setPriority(int priority)
public String getResource()
public void setResource(String argResource) throws NotAuthorizedException, TigaseStringprepException
argResource - Value to assign to this.resourceNotAuthorizedExceptionTigaseStringprepExceptionpublic final Object getSessionData(String key)
putSessionData description for more details.key - a String value of stored data ID.Object value of data for given key.putSessionData(String, Object)public String getSessionId()
public void setSessionId(String argSessionId)
argSessionId - Value to assign to this.sessionIdpublic JID getSMComponentId()
@Deprecated public BareJID getUserId() throws NotAuthorizedException
getBareJID method, to check the whether the user with given
BareJID is owner of the session please use method isUserId(...). From now one the user session may
handle more than a single userId, hence getting just userId is not enough to check whether the user Id belongs to
the session.BareJIDNotAuthorizedExceptionpublic final String getUserName() throws NotAuthorizedException
getUserName in class RepositoryAccessNotAuthorizedExceptionpublic boolean isAuthorized()
RepositoryAccesstrue is returned as
method result it means session has already been authorized, if false however session is still not
authorized.isAuthorized in class RepositoryAccessboolean value which informs whether this session has been already authorized or not.public boolean isLocalDomain(String outDomain, boolean includeComponents)
public boolean isResourceSet()
public boolean isServerSession()
boolean value of true if this is the server session and false
otherwise.public boolean isTmpSession()
public void setTmpSession(boolean tmp)
public boolean isUserId(BareJID bareJID) throws NotAuthorizedException
NotAuthorizedException@Deprecated public Authorization unregister(String name_param) throws NotAuthorizedException, TigaseDBException, TigaseStringprepException
JabberIqRegister.doRemoveAccount(Packet, Element, XMPPResourceConnection, Queue)unregister in class RepositoryAccessNotAuthorizedExceptionTigaseDBExceptionTigaseStringprepExceptionpublic boolean isEncrypted()
public boolean isTlsRequired()
protected void login()
login in class RepositoryAccessCopyright © 2004–2019 "Tigase, Inc.". All rights reserved.