xmlBlaster 2.2.0 API

org.xmlBlaster.util.qos
Class SessionQos

java.lang.Object
  extended by org.xmlBlaster.util.qos.SessionQos
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class SessionQos
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class encapsulates the qos of session attributes of a login() or connect().

See Also:
The interface.connect requirement, ConnectQosSaxFactory, ConnectQosTest, Serialized Form

Field Summary
private  PropBoolean clearSessions
          Clear on login all other sessions of this user (for recovery reasons) "session.clearSessions false"
static int DEFAULT_maxSessions
          Maximum of ten parallel logins for the same client "session.maxSessions 10"
private  Global glob
           
private static java.util.logging.Logger log
           
private  PropInt maxSessions
           
private  NodeId nodeId
          The node id to which we want to connect
protected  PropBoolean reconnectSameClientOnly
          If reconnectSameClientOnly=true a client with a given publicSessionId can only reconnect to xmlBlaster if it is the the client instance which created the login session (other clients can't capture the session).
private static long serialVersionUID
           
private  java.lang.String sessionId
          Passing own secret sessionId
private  SessionName sessionName
          The unified session name which is a clusterwide unique identifier
private  boolean sessionNameModified
           
private  PropLong sessionTimeout
          Default session span of life is one day, given in millis "-session.timeout 86400000"
 
Constructor Summary
SessionQos(Global glob)
          Constructor for client side.
SessionQos(Global glob, NodeId nodeId)
          Constructor for cluster server.
 
Method Summary
 boolean clearSessions()
          If clearSessions is true, all old sessions of this user are discarded.
 void clearSessions(boolean clear)
          If clearSessions is true, all old sessions of this user are discarded.
 java.lang.Object clone()
          Returns a shallow clone, you can change safely all basic or immutable types like boolean, String, int.
 int getMaxSessions()
          If maxSession == 1, only a single login is possible
 long getPublicSessionId()
          The public session ID to support reconnect to an existing session.
 java.lang.String getSecretSessionId()
          Get our secret session identifier which authenticates us for xmlBlaster.
 SessionName getSessionName()
          Get our unique SessionName.
 long getSessionTimeout()
          Timeout until session expires if no communication happens
 boolean hasPublicSessionId()
           
private  void initialize()
           
 boolean isSessionNameModified()
           
 boolean reconnectSameClientOnly()
           
 PropBoolean reconnectSameClientOnlyProp()
           
 void setMaxSessions(int max)
          If maxSession == 1, only a single login is possible
 void setReconnectSameClientOnly(boolean reconnectSameClientOnly)
           
 void setSecretSessionId(java.lang.String id)
          Set our session identifier which authenticates us for xmlBlaster.
 void setSessionName(SessionName sessionName)
          Set our unique SessionName.
(package private)  void setSessionName(SessionName sessionName, boolean markAsModified)
          Set our unique SessionName.
 void setSessionTimeout(long timeout)
          Timeout until session expires if no communication happens
 java.lang.String toString()
          Converts the data into a valid XML ASCII string.
 java.lang.String toXml()
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 java.lang.String usage()
          Get a usage string for the connection parameters
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

glob

private final transient Global glob

log

private static java.util.logging.Logger log

sessionTimeout

private PropLong sessionTimeout
Default session span of life is one day, given in millis "-session.timeout 86400000"


DEFAULT_maxSessions

public static final int DEFAULT_maxSessions
Maximum of ten parallel logins for the same client "session.maxSessions 10"

See Also:
Constant Field Values

maxSessions

private PropInt maxSessions

clearSessions

private PropBoolean clearSessions
Clear on login all other sessions of this user (for recovery reasons) "session.clearSessions false"


reconnectSameClientOnly

protected PropBoolean reconnectSameClientOnly
If reconnectSameClientOnly=true a client with a given publicSessionId can only reconnect to xmlBlaster if it is the the client instance which created the login session (other clients can't capture the session). This option is useful if you want to assure a singleton client (set additionally maxSessions=1). Defaults to false.


sessionId

private java.lang.String sessionId
Passing own secret sessionId


sessionName

private SessionName sessionName
The unified session name which is a clusterwide unique identifier


sessionNameModified

private boolean sessionNameModified

nodeId

private NodeId nodeId
The node id to which we want to connect

Constructor Detail

SessionQos

public SessionQos(Global glob)
Constructor for client side.


SessionQos

public SessionQos(Global glob,
                  NodeId nodeId)
Constructor for cluster server.

Parameters:
nodeId - The the unique cluster node id, supports configuration per node
Method Detail

initialize

private final void initialize()

getSessionTimeout

public final long getSessionTimeout()
Timeout until session expires if no communication happens


setSessionTimeout

public final void setSessionTimeout(long timeout)
Timeout until session expires if no communication happens

Parameters:
timeout - The login session will be destroyed after given milliseconds.
Session lasts forever if set to 0L

getMaxSessions

public final int getMaxSessions()
If maxSession == 1, only a single login is possible


setMaxSessions

public final void setMaxSessions(int max)
If maxSession == 1, only a single login is possible

Parameters:
max - How often the same client may login

clearSessions

public final boolean clearSessions()
If clearSessions is true, all old sessions of this user are discarded.


clearSessions

public void clearSessions(boolean clear)
If clearSessions is true, all old sessions of this user are discarded.

Parameters:
clear - Defaults to false

setReconnectSameClientOnly

public void setReconnectSameClientOnly(boolean reconnectSameClientOnly)
Parameters:
Set - if we allow multiple updates for the same message if we have subscribed multiple times to it.

reconnectSameClientOnly

public boolean reconnectSameClientOnly()
Returns:
true if we allow multiple updates for the same message if we have subscribed multiple times to it.

reconnectSameClientOnlyProp

public PropBoolean reconnectSameClientOnlyProp()

setSecretSessionId

public void setSecretSessionId(java.lang.String id)
Set our session identifier which authenticates us for xmlBlaster.

This is used server side only.

Parameters:
id - The unique and secret sessionId

getSecretSessionId

public final java.lang.String getSecretSessionId()
Get our secret session identifier which authenticates us for xmlBlaster.

Returns:
The unique, secret sessionId

getPublicSessionId

public final long getPublicSessionId()
The public session ID to support reconnect to an existing session.

This is extracted from the sessionName.getPublicSessionId()

Returns:
0 if no session but a login name
<0 if session ID is generated by xmlBlaster
>0 if session ID is given by user

hasPublicSessionId

public final boolean hasPublicSessionId()

setSessionName

public void setSessionName(SessionName sessionName)
Set our unique SessionName.

Parameters:
sessionName -

setSessionName

void setSessionName(SessionName sessionName,
                    boolean markAsModified)
Set our unique SessionName.

Parameters:
sessionName -
markAsModified - false if you are setting a default sessionName, true if the user set the sessionName

isSessionNameModified

public boolean isSessionNameModified()

getSessionName

public final SessionName getSessionName()
Get our unique SessionName.

Returns:
The unique SessionName (null if not known)

toString

public java.lang.String toString()
Converts the data into a valid XML ASCII string.

Overrides:
toString in class java.lang.Object
Returns:
An XML ASCII string

toXml

public final java.lang.String toXml()
Dump state of this object into a XML ASCII string.


toXml

public final java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of the SessionQos as a XML ASCII string

clone

public java.lang.Object clone()
Returns a shallow clone, you can change safely all basic or immutable types like boolean, String, int.

Overrides:
clone in class java.lang.Object

usage

public java.lang.String usage()
Get a usage string for the connection parameters


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.