Connection Manager 3.4.4 Javadoc

org.jivesoftware.multiplexer
Class Session

java.lang.Object
  extended by org.jivesoftware.multiplexer.Session
Direct Known Subclasses:
ClientSession, HttpSession

public abstract class Session
extends java.lang.Object

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 static java.lang.String CHARSET
          The utf-8 charset for decoding and encoding Jabber packet streams.
protected  Connection conn
          The connection that this session represents.
static StreamIDFactory idFactory
           
static int MAJOR_VERSION
          Version of the XMPP spec supported as MAJOR_VERSION.MINOR_VERSION (e.g.
static int MINOR_VERSION
           
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(java.lang.String serverName, Connection connection, java.lang.String streamID)
          Creates a session with an underlying connection and permission protection.
 
Method Summary
static void addSession(java.lang.String streamID, Session session)
           
abstract  void close()
          Indicate the server that the session has been closed.
abstract  void close(boolean isServerShuttingDown)
           
static void closeAll()
          Closes connections of connected clients since the server or the connection manager is being shut down.
protected static int[] decodeVersion(java.lang.String version)
           
abstract  void deliver(org.dom4j.Element stanza)
           
abstract  java.lang.String getAvailableStreamFeatures()
          Returns a text with the available stream features.
 java.util.Date getCreationDate()
          Obtain the date the session was created.
 java.lang.String getServerName()
          Obtain the name of the server this session belongs to.
static Session getSession(java.lang.String streamID)
          Returns the session whose stream ID matches the specified stream ID.
 int getStatus()
          Obtain the current status of this session.
 java.lang.String getStreamID()
          Obtain the stream ID associated with this sesison.
abstract  boolean isClosed()
           
static void removeSession(java.lang.String streamID)
           
 void setStatus(int status)
          Set the new status of this session.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAJOR_VERSION

public static final int MAJOR_VERSION
Version of the XMPP spec supported as MAJOR_VERSION.MINOR_VERSION (e.g. 1.0).

See Also:
Constant Field Values

MINOR_VERSION

public static final int MINOR_VERSION
See Also:
Constant Field Values

CHARSET

protected static java.lang.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.


idFactory

public static StreamIDFactory idFactory
Constructor Detail

Session

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

Parameters:
connection - The connection we are proxying
Method Detail

addSession

public static void addSession(java.lang.String streamID,
                              Session session)

removeSession

public static void removeSession(java.lang.String streamID)

getSession

public static Session getSession(java.lang.String streamID)
Returns the session whose stream ID matches the specified stream ID.

Parameters:
streamID - the stream ID of the session to look for.
Returns:
the session whose stream ID matches the specified stream ID.

closeAll

public static void closeAll()
Closes connections of connected clients since the server or the connection manager is being shut down. If the server is the one that is being shut down then the connection manager will keep running and will try to establish new connections to the server (on demand).


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 java.lang.String 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 java.lang.String getServerName()
Obtain the name of the server this session belongs to.

Returns:
the server name.

getCreationDate

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

Returns:
the session's creation date.

getAvailableStreamFeatures

public abstract java.lang.String getAvailableStreamFeatures()
Returns a text with the available stream features. Each subclass may return different values depending whether the session has been authenticated or not.

Returns:
a text with the available stream features or null to add nothing.

close

public abstract void close()
Indicate the server that the session has been closed. Do nothing if the session was the one that originated the close action.


close

public abstract void close(boolean isServerShuttingDown)

deliver

public abstract void deliver(org.dom4j.Element stanza)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

decodeVersion

protected static int[] decodeVersion(java.lang.String version)

isClosed

public abstract boolean isClosed()

Connection Manager 3.4.4 Javadoc

Copyright © 2003-2006 Jive Software.