org.androidpn.server.xmpp.session
Class SessionManager

java.lang.Object
  extended by org.androidpn.server.xmpp.session.SessionManager

public class SessionManager
extends java.lang.Object

This class manages the sessions connected to the server.

Author:
Sehwan Noh (devnoh@gmail.com)

Method Summary
 void addSession(ClientSession session)
          Adds a new session that has been authenticated.
 void closeAllSessions()
          Closes the all sessions.
 ClientSession createClientSession(Connection conn)
          Creates a new ClientSession and returns it.
static SessionManager getInstance()
          Returns the singleton instance of SessionManager.
 ClientSession getSession(org.xmpp.packet.JID from)
          Returns the session associated with the JID.
 ClientSession getSession(java.lang.String username)
          Returns the session associated with the username.
 java.util.Collection<ClientSession> getSessions()
          Returns a list that contains all authenticated client sessions.
 boolean removeSession(ClientSession session)
          Removes a client session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionManager getInstance()
Returns the singleton instance of SessionManager.

Returns:
the instance

createClientSession

public ClientSession createClientSession(Connection conn)
Creates a new ClientSession and returns it.

Parameters:
conn - the connection
Returns:
a newly created session

addSession

public void addSession(ClientSession session)
Adds a new session that has been authenticated.

Parameters:
session - the session

getSession

public ClientSession getSession(java.lang.String username)
Returns the session associated with the username.

Parameters:
username - the username of the client address
Returns:
the session associated with the username

getSession

public ClientSession getSession(org.xmpp.packet.JID from)
Returns the session associated with the JID.

Parameters:
from - the client address
Returns:
the session associated with the JID

getSessions

public java.util.Collection<ClientSession> getSessions()
Returns a list that contains all authenticated client sessions.

Returns:
a list that contains all client sessions

removeSession

public boolean removeSession(ClientSession session)
Removes a client session.

Parameters:
session - the session to be removed
Returns:
true if the session was successfully removed

closeAllSessions

public void closeAllSessions()
Closes the all sessions.