tigase.xmpp
Class XMPPResourceConnection

java.lang.Object
  extended by tigase.xmpp.RepositoryAccess
      extended by tigase.xmpp.XMPPResourceConnection

public class XMPPResourceConnection
extends RepositoryAccess

Describe class XMPPResourceConnection here. Created: Wed Feb 8 22:30:37 2006

Version:
$Rev: 1182 $
Author:
Artur Hefczyc

Field Summary
 
Fields inherited from class tigase.xmpp.RepositoryAccess
NO_ACCESS_TO_REP_MSG, NOT_AUTHORIZED_MSG
 
Constructor Summary
XMPPResourceConnection(java.lang.String connectionId, UserRepository rep, UserAuthRepository authRepo, LoginHandler loginHandler, boolean anon_allowed)
          Creates a new XMPPResourceConnection instance.
 
Method Summary
 java.util.List<XMPPResourceConnection> getActiveSessions()
           
 java.lang.String[] getAllResourcesJIDs()
           
 long getAuthTime()
           
 java.lang.String getConnectionId()
          Gets the value of connectionId
 java.lang.String getConnectionId(java.lang.String jid)
           
 ConnectionStatus getConnectionStatus()
           
 long getCreationTime()
           
 java.lang.String getDefLang()
           
 java.lang.String getDomain()
           
 java.lang.String 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
 XMPPSession getParentSession()
           
 int getPriority()
           
 java.lang.String getResource()
          Gets the value of resource
 java.lang.Object getSessionData(java.lang.String key)
          Retrieves session data.
 java.lang.String getSessionId()
          Gets the value of sessionId
 java.lang.String getUserId()
          Returns user JID but without resource part.
 java.lang.String getUserName()
           
 boolean isResourceSet()
           
protected  void login()
           
 Authorization loginDigest(java.lang.String user, java.lang.String digest, java.lang.String id, java.lang.String alg)
           
 Authorization loginOther(java.util.Map<java.lang.String,java.lang.Object> props)
           
 Authorization loginPlain(java.lang.String user, java.lang.String password)
          authorize method performs authorization with given password as plain text.
 void logout()
           
 java.lang.String nextStanzaId()
           
 void putSessionData(java.lang.String key, java.lang.Object value)
          Saves given session data.
 void queryAuth(java.util.Map<java.lang.String,java.lang.Object> authProps)
           
 void removeSessionData(java.lang.String key)
           
 void setConnectionStatus(ConnectionStatus status)
           
 void setDefLang(java.lang.String lang)
           
 void setDomain(java.lang.String domain)
           
 void setLastAccessed(long argLastAccessed)
          Sets the value of lastAccessed
 void setParentSession(XMPPSession parent)
           
 void setPriority(int priority)
           
 void setResource(java.lang.String argResource)
          Sets the value of resource
 void setSessionId(java.lang.String argSessionId)
          Sets the value of sessionId
 void streamClosed()
           
 Authorization unregister(java.lang.String name_param)
           
 
Methods inherited from class tigase.xmpp.RepositoryAccess
addDataList, addOfflineDataList, addPublicDataList, getAuthenticationToken, getAuthState, getData, getDataGroups, getDataKeys, getDataList, getOfflineData, getOfflineDataList, getPublicData, getPublicDataList, isAnonymous, isAuthorized, loginToken, register, removeData, removeDataGroup, removeOfflineData, removeOfflineDataGroup, removePublicData, removePublicDataGroup, setData, setDataList, setOfflineData, setOfflineDataList, setPublicData, setPublicDataList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMPPResourceConnection

public XMPPResourceConnection(java.lang.String connectionId,
                              UserRepository rep,
                              UserAuthRepository authRepo,
                              LoginHandler loginHandler,
                              boolean anon_allowed)
Creates a new XMPPResourceConnection instance.

Method Detail

setConnectionStatus

public void setConnectionStatus(ConnectionStatus status)

getConnectionStatus

public ConnectionStatus getConnectionStatus()

putSessionData

public final void putSessionData(java.lang.String key,
                                 java.lang.Object value)
Saves given session data. Data are saved to temporary storage only and are accessible during this session life only and only from this session instance.
Any Object can be stored and retrieved through getSessionData(...).
To access permanent storage to keep data between session instances you must use one of 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.

Parameters:
key - a String value of stored data key ID.
value - a Object value of data stored in session.
See Also:
getSessionData(String)

getSessionData

public final java.lang.Object getSessionData(java.lang.String key)
Retrieves session data. This method gives access to temporary session data only. You can retrieve earlier saved data giving key ID to receive needed value. Please see putSessionData description for more details.

Parameters:
key - a String value of stored data ID.
Returns:
a Object value of data for given key.
See Also:
putSessionData(String, Object)

removeSessionData

public final void removeSessionData(java.lang.String key)

setPriority

public void setPriority(int priority)

getPriority

public int getPriority()

streamClosed

public void streamClosed()

setParentSession

public void setParentSession(XMPPSession parent)

getParentSession

public XMPPSession getParentSession()

getJID

public final java.lang.String getJID()
                              throws NotAuthorizedException
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.

Returns:
a String value of calculated user full JID for this session including resource name.
Throws:
NotAuthorizedException - when this session has not been authorized yet and some parts of user JID are not known yet.

getUserId

public final java.lang.String getUserId()
                                 throws NotAuthorizedException
Returns user JID but without resource part. This is real user ID not session ID. To retrieve session ID - full JID refer to getJID() method.
If session has not been authorized yet this method throws NotAuthorizedException.

Specified by:
getUserId in class RepositoryAccess
Returns:
a String value of user ID - this is user JID without resource part. To obtain full user JID please refer to getJID method.
Throws:
NotAuthorizedException - when this session has not been authorized yet and some parts of user JID are not known yet.
See Also:
getJID()

getUserName

public final java.lang.String getUserName()
                                   throws NotAuthorizedException
Specified by:
getUserName in class RepositoryAccess
Throws:
NotAuthorizedException

getActiveSessions

public java.util.List<XMPPResourceConnection> getActiveSessions()
                                                         throws NotAuthorizedException
Throws:
NotAuthorizedException

getAllResourcesJIDs

public java.lang.String[] getAllResourcesJIDs()
                                       throws NotAuthorizedException
Throws:
NotAuthorizedException

setDomain

public void setDomain(java.lang.String domain)

getDomain

public java.lang.String getDomain()
Specified by:
getDomain in class RepositoryAccess

getSessionId

public java.lang.String getSessionId()
Gets the value of sessionId

Returns:
the value of sessionId

setSessionId

public void setSessionId(java.lang.String argSessionId)
Sets the value of sessionId

Parameters:
argSessionId - Value to assign to this.sessionId

getDefLang

public java.lang.String getDefLang()

setDefLang

public void setDefLang(java.lang.String lang)

isResourceSet

public boolean isResourceSet()

getResource

public java.lang.String getResource()
Gets the value of resource

Returns:
the value of resource

setResource

public void setResource(java.lang.String argResource)
                 throws NotAuthorizedException
Sets the value of resource

Parameters:
argResource - Value to assign to this.resource
Throws:
NotAuthorizedException

getLastAccessed

public long getLastAccessed()
Gets the value of lastAccessed

Returns:
the value of lastAccessed

setLastAccessed

public void setLastAccessed(long argLastAccessed)
Sets the value of lastAccessed

Parameters:
argLastAccessed - Value to assign to this.lastAccessed

getConnectionId

public java.lang.String getConnectionId()
Gets the value of connectionId

Returns:
the value of connectionId

getConnectionId

public java.lang.String getConnectionId(java.lang.String jid)

logout

public final void logout()
                  throws NotAuthorizedException
Overrides:
logout in class RepositoryAccess
Throws:
NotAuthorizedException

login

protected void login()
Specified by:
login in class RepositoryAccess

getAuthTime

public long getAuthTime()

getCreationTime

public long getCreationTime()

unregister

public Authorization unregister(java.lang.String name_param)
                         throws NotAuthorizedException,
                                TigaseDBException
Overrides:
unregister in class RepositoryAccess
Throws:
NotAuthorizedException
TigaseDBException

loginPlain

public final Authorization loginPlain(java.lang.String user,
                                      java.lang.String password)
                               throws NotAuthorizedException,
                                      AuthorizationException,
                                      TigaseDBException
Description copied from class: RepositoryAccess
authorize method performs authorization with given password as plain text. If AUTHORIZED has been returned it means authorization process is successful and session has been activated, otherwise session hasn't been authorized and return code gives more detailed information of fail reason. Please refer to Authorizaion documentation for more details.

Overrides:
loginPlain in class RepositoryAccess
Returns:
a Authorization value of result code.
Throws:
NotAuthorizedException
AuthorizationException
TigaseDBException

loginDigest

public final Authorization loginDigest(java.lang.String user,
                                       java.lang.String digest,
                                       java.lang.String id,
                                       java.lang.String alg)
                                throws NotAuthorizedException,
                                       AuthorizationException,
                                       TigaseDBException
Overrides:
loginDigest in class RepositoryAccess
Throws:
NotAuthorizedException
AuthorizationException
TigaseDBException

loginOther

public final Authorization loginOther(java.util.Map<java.lang.String,java.lang.Object> props)
                               throws NotAuthorizedException,
                                      AuthorizationException,
                                      TigaseDBException
Overrides:
loginOther in class RepositoryAccess
Throws:
NotAuthorizedException
AuthorizationException
TigaseDBException

nextStanzaId

public java.lang.String nextStanzaId()

queryAuth

public void queryAuth(java.util.Map<java.lang.String,java.lang.Object> authProps)
Overrides:
queryAuth in class RepositoryAccess


Copyright © 2008 Tigase. All Rights Reserved.