Jive Messenger 2.2.2 Javadoc

org.jivesoftware.messenger
Class Session

java.lang.Object
  extended by org.jivesoftware.messenger.Session
All Implemented Interfaces:
ChannelHandler, RoutableChannelHandler
Direct Known Subclasses:
ClientSession, ComponentSession, IncomingServerSession, OutgoingServerSession

public abstract class Session
extends Object
implements RoutableChannelHandler

The session represents a connection between the server and a client (c2s) or another server (s2s) as well as a connection with a component. Authentication and user accounts are associated with c2s connections while s2s has an optional authentication association but no single user user.

Obtain object managers from the session in order to access server resources.

Author:
Gaston Dombiak

Field Summary
protected  AuthToken authToken
          The authentication token for this session.
protected static String CHARSET
          The utf-8 charset for decoding and encoding Jabber packet streams.
protected  Connection conn
          The connection that this session represents.
protected  SessionManager sessionManager
           
protected  int status
          The current session status.
static int STATUS_AUTHENTICATED
           
static int STATUS_CLOSED
           
static int STATUS_CONNECTED
           
static int STATUS_STREAMING
           
 
Constructor Summary
Session(String serverName, Connection connection, StreamID streamID)
          Creates a session with an underlying connection and permission protection.
 
Method Summary
 JID getAddress()
          Obtain the address of the user.
 Connection getConnection()
          Returns the connection associated with this Session.
 Date getCreationDate()
          Obtain the date the session was created.
 Date getLastActiveDate()
          Obtain the time the session last had activity.
 long getNumClientPackets()
          Obtain the number of packets sent from the client to the server.
 long getNumServerPackets()
          Obtain the number of packets sent from the server to the client.
 String getServerName()
          Obtain the name of the server this session belongs to.
 int getStatus()
          Obtain the current status of this session.
 StreamID getStreamID()
          Obtain the stream ID associated with this sesison.
 void incrementClientPacketCount()
          Obtain the number of packets sent from the client to the server.
 void incrementServerPacketCount()
          Obtain the number of packets sent from the server to the client.
 void setAddress(JID address)
          Sets the new address of this session.
 void setStatus(int status)
          Set the new status of this session.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jivesoftware.messenger.ChannelHandler
process
 

Field Detail

CHARSET

protected static String CHARSET
The utf-8 charset for decoding and encoding Jabber packet streams.


STATUS_CLOSED

public static final int STATUS_CLOSED
See Also:
Constant Field Values

STATUS_CONNECTED

public static final int STATUS_CONNECTED
See Also:
Constant Field Values

STATUS_STREAMING

public static final int STATUS_STREAMING
See Also:
Constant Field Values

STATUS_AUTHENTICATED

public static final int STATUS_AUTHENTICATED
See Also:
Constant Field Values

status

protected int status
The current session status.


conn

protected Connection conn
The connection that this session represents.


authToken

protected AuthToken authToken
The authentication token for this session.


sessionManager

protected SessionManager sessionManager
Constructor Detail

Session

public Session(String serverName,
               Connection connection,
               StreamID streamID)
Creates a session with an underlying connection and permission protection.

Parameters:
connection - The connection we are proxying
Method Detail

getAddress

public JID getAddress()
Obtain the address of the user. The address is used by services like the core server packet router to determine if a packet should be sent to the handler. Handlers that are working on behalf of the server should use the generic server hostname address (e.g. server.com).

Specified by:
getAddress in interface RoutableChannelHandler
Returns:
the address of the packet handler.

setAddress

public void setAddress(JID address)
Sets the new address of this session. The address is used by services like the core server packet router to determine if a packet should be sent to the handler. Handlers that are working on behalf of the server should use the generic server hostname address (e.g. server.com).


getConnection

public Connection getConnection()
Returns the connection associated with this Session.

Returns:
The connection for this session

getStatus

public int getStatus()
Obtain the current status of this session.

Returns:
The status code for this session

setStatus

public void setStatus(int status)
Set the new status of this session. Setting a status may trigger certain events to occur (setting a closed status will close this session).

Parameters:
status - The new status code for this session

getStreamID

public StreamID getStreamID()
Obtain the stream ID associated with this sesison. Stream ID's are generated by the server and should be unique and random.

Returns:
This session's assigned stream ID

getServerName

public String getServerName()
Obtain the name of the server this session belongs to.

Returns:
the server name.

getCreationDate

public Date getCreationDate()
Obtain the date the session was created.

Returns:
the session's creation date.

getLastActiveDate

public Date getLastActiveDate()
Obtain the time the session last had activity.

Returns:
The last time the session received activity.

incrementClientPacketCount

public void incrementClientPacketCount()
Obtain the number of packets sent from the client to the server.


incrementServerPacketCount

public void incrementServerPacketCount()
Obtain the number of packets sent from the server to the client.


getNumClientPackets

public long getNumClientPackets()
Obtain the number of packets sent from the client to the server.

Returns:
The number of packets sent from the client to the server.

getNumServerPackets

public long getNumServerPackets()
Obtain the number of packets sent from the server to the client.

Returns:
The number of packets sent from the server to the client.

toString

public String toString()
Overrides:
toString in class Object

Jive Messenger 2.2.2 Javadoc

Copyright © 1999-2004 Jive Software.