public class XMPPResourceConnection extends RepositoryAccess
Modifier and Type | Field and Description |
---|---|
static String |
ALL_RESOURCES_CAPS_KEY
Field description
|
static String |
ALL_RESOURCES_KEY
Field description
|
static String |
ALL_RESOURCES_PRIORITY_KEY
Field description
|
static String |
AUTHENTICATION_TIMEOUT_KEY
Field description
|
static String |
CLOSING_KEY
Field description
|
static String |
ERROR_KEY
Field description
|
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(tigase.xmpp.JID connectionId,
UserRepository rep,
AuthRepository authRepo,
SessionManagerHandler loginHandler)
Creates a new
XMPPResourceConnection instance. |
Modifier and Type | Method and Description |
---|---|
void |
authorizeJID(tigase.xmpp.BareJID jid,
boolean anonymous)
Method description
|
List<XMPPResourceConnection> |
getActiveSessions()
Method description
|
tigase.xmpp.JID[] |
getAllResourcesJIDs()
Method description
|
AuthRepository |
getAuthRepository()
Method description
|
long |
getAuthTime()
Method description
|
tigase.xmpp.BareJID |
getBareJID()
Returns user JID but without resource part.
|
Object |
getCommonSessionData(String key) |
tigase.xmpp.JID |
getConnectionId()
Gets the value of connectionId
|
tigase.xmpp.JID |
getConnectionId(tigase.xmpp.JID jid)
Method description
|
long |
getCreationTime()
Method description
|
String |
getDefLang()
Method description
|
tigase.xmpp.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. |
tigase.xmpp.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()
Method description
|
XMPPSession |
getParentSession()
Method description
|
tigase.xml.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()
Method description
|
String |
getResource()
Gets the value of resource
|
Object |
getSessionData(String key)
Retrieves session data.
|
String |
getSessionId()
Gets the value of sessionId
|
tigase.xmpp.JID |
getSMComponentId()
Method description
|
tigase.xmpp.BareJID |
getUserId()
Deprecated.
|
String |
getUserName()
Method description
|
void |
incPacketsCounter()
Method description
|
boolean |
isAuthorized()
Method description
|
boolean |
isEncrypted() |
boolean |
isLocalDomain(String outDomain,
boolean includeComponents)
Method description
|
boolean |
isResourceSet()
Method description
|
boolean |
isServerSession()
Returns information whether this is a server (SessionManager) session or
normal user session.
|
boolean |
isTlsRequired() |
boolean |
isTmpSession()
Method description
|
boolean |
isUserId(tigase.xmpp.BareJID bareJID)
Method description
|
protected void |
login()
Method description
|
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()
Method description
|
String |
nextStanzaId()
Method description
|
void |
putCommonSessionData(String key,
Object value)
Method description
|
void |
putSessionData(String key,
Object value)
Saves given session data.
|
void |
queryAuth(Map<String,Object> authProps)
Method description
|
Object |
removeCommonSessionData(String key)
Method description
|
void |
removeParentSession(XMPPSession parent)
Method description
|
void |
removeSessionData(String key)
Method description
|
void |
setConnectionId(tigase.xmpp.JID connectionId)
Sets the value of connectionId
|
void |
setDefLang(String lang)
Method description
|
void |
setLastAccessed(long argLastAccessed)
Sets the value of lastAccessed
|
void |
setParentSession(XMPPSession parent)
Method description
|
void |
setPresence(tigase.xml.Element packet)
Method description
|
void |
setPriority(int priority)
Method description
|
void |
setResource(String argResource)
Sets the connection resource
|
void |
setSessionId(String argSessionId)
Sets the value of sessionId
|
void |
setTmpSession(boolean tmp)
Method description
|
void |
streamClosed()
Method description
|
String |
toString() |
Authorization |
unregister(String name_param)
Method description
|
addDataList, addOfflineDataList, addPublicDataList, 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
public 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(tigase.xmpp.JID connectionId, UserRepository rep, AuthRepository authRepo, SessionManagerHandler loginHandler)
XMPPResourceConnection
instance.connectionId
- rep
- authRepo
- loginHandler
- public void authorizeJID(tigase.xmpp.BareJID jid, boolean anonymous)
jid
- anonymous
- public final tigase.xmpp.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, tigase.util.TigaseStringprepException
user
- digest
- id
- alg
- Authorization
AuthorizationException
NotAuthorizedException
TigaseDBException
tigase.util.TigaseStringprepException
@Deprecated public final Authorization loginOther(Map<String,Object> props) throws NotAuthorizedException, AuthorizationException, TigaseDBException
loginOther
in class RepositoryAccess
props
- Authorization
AuthorizationException
NotAuthorizedException
TigaseDBException
@Deprecated public final Authorization loginPlain(String user, String password) throws NotAuthorizedException, AuthorizationException, TigaseDBException, tigase.util.TigaseStringprepException
user
- password
- Authorization
AuthorizationException
NotAuthorizedException
TigaseDBException
tigase.util.TigaseStringprepException
public final void logout() throws NotAuthorizedException
logout
in class RepositoryAccess
NotAuthorizedException
public String nextStanzaId()
String
public void putCommonSessionData(String key, Object value)
key
- 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 void queryAuth(Map<String,Object> authProps) throws TigaseDBException
queryAuth
in class RepositoryAccess
authProps
- TigaseDBException
public Object removeCommonSessionData(String key)
key
- Object
public void removeParentSession(XMPPSession parent)
parent
- public final void removeSessionData(String key)
key
- public void streamClosed()
public Authorization unregister(String name_param) throws NotAuthorizedException, TigaseDBException, tigase.util.TigaseStringprepException
unregister
in class RepositoryAccess
name_param
- Authorization
NotAuthorizedException
TigaseDBException
tigase.util.TigaseStringprepException
public List<XMPPResourceConnection> getActiveSessions() throws NotAuthorizedException
List
NotAuthorizedException
public tigase.xmpp.JID[] getAllResourcesJIDs()
JID[]
public AuthRepository getAuthRepository()
AuthRepository
public long getAuthTime()
long
public final tigase.xmpp.BareJID getBareJID() throws NotAuthorizedException
getJID()
method.NotAuthorizedException
.getBareJID
in class RepositoryAccess
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.getJID()
public Object getCommonSessionData(String key)
key
- Object
public tigase.xmpp.JID getConnectionId() throws NoConnectionIdException
NoConnectionIdException
public tigase.xmpp.JID getConnectionId(tigase.xmpp.JID jid) throws NoConnectionIdException
jid
- JID
NoConnectionIdException
public long getCreationTime()
long
public String getDefLang()
String
public final tigase.xmpp.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.NotAuthorizedException
public long getLastAccessed()
public long getPacketsCounter()
long
public XMPPSession getParentSession()
XMPPSession
public tigase.xml.Element getPresence()
null
if the user has not yet sent an initial presence.Element
with last presence status received from the
user.public int getPriority()
int
public String getResource()
public 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 tigase.xmpp.JID getSMComponentId()
JID
@Deprecated public tigase.xmpp.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.BareJID
NotAuthorizedException
public final String getUserName() throws NotAuthorizedException
getUserName
in class RepositoryAccess
String
NotAuthorizedException
public boolean isAuthorized()
isAuthorized
in class RepositoryAccess
boolean
public boolean isLocalDomain(String outDomain, boolean includeComponents)
outDomain
- includeComponents
- boolean
public boolean isResourceSet()
boolean
public boolean isServerSession()
boolean
value of true
if this is the
server session and false
otherwise.public boolean isTmpSession()
boolean
public boolean isUserId(tigase.xmpp.BareJID bareJID) throws NotAuthorizedException
bareJID
- boolean
NotAuthorizedException
public void setConnectionId(tigase.xmpp.JID connectionId)
connectionId
- is a JID
public void setDefLang(String lang)
lang
- public void setLastAccessed(long argLastAccessed)
argLastAccessed
- Value to assign to this.lastAccessedpublic void setParentSession(XMPPSession parent) throws tigase.util.TigaseStringprepException
parent
- tigase.util.TigaseStringprepException
public void setPresence(tigase.xml.Element packet)
packet
- public void setPriority(int priority)
priority
- public void setResource(String argResource) throws NotAuthorizedException, tigase.util.TigaseStringprepException
argResource
- Value to assign to this.resourceNotAuthorizedException
tigase.util.TigaseStringprepException
public void setSessionId(String argSessionId)
argSessionId
- Value to assign to this.sessionIdpublic void setTmpSession(boolean tmp)
tmp
- is a boolean
protected void login()
login
in class RepositoryAccess
public boolean isEncrypted()
public boolean isTlsRequired()
Copyright © 2014 "Tigase, Inc.". All rights reserved.