nl.justobjects.pushlet.core
Class Session

java.lang.Object
  extended by nl.justobjects.pushlet.core.Session
All Implemented Interfaces:
ConfigDefs, Protocol

public class Session
extends java.lang.Object
implements Protocol, ConfigDefs

Represents client pushlet session state.

Version:
$Id: Session.java,v 1.8 2007/11/23 14:33:07 justb Exp $
Author:
Just van den Broecke - Just Objects ©

Field Summary
private  java.lang.String address
           
private  Controller controller
           
static java.lang.String[] FORCED_PULL_AGENTS
           
private  java.lang.String format
           
private  java.lang.String id
           
private  long LEASE_TIME_MILLIS
           
private  Subscriber subscriber
           
private  long timeToLive
           
private  java.lang.String userAgent
           
 
Fields inherited from interface nl.justobjects.pushlet.core.Protocol
DEFAULT_SERVLET_URI, E_ABORT, E_DATA, E_HEARTBEAT, E_HEARTBEAT_ACK, E_JOIN, E_JOIN_ACK, E_JOIN_LISTEN, E_JOIN_LISTEN_ACK, E_LEAVE, E_LEAVE_ACK, E_LISTEN, E_LISTEN_ACK, E_NACK, E_PUBLISH, E_PUBLISH_ACK, E_REFRESH, E_REFRESH_ACK, E_SUBSCRIBE, E_SUBSCRIBE_ACK, E_UNSUBSCRIBE, E_UNSUBSCRIBE_ACK, FORMAT_JAVASCRIPT, FORMAT_SERIALIZED_JAVA_OBJECT, FORMAT_XML, FORMAT_XML_STRICT, MODE_POLL, MODE_PULL, MODE_STREAM, P_EVENT, P_FORMAT, P_FROM, P_ID, P_MODE, P_REASON, P_SEQ, P_SUBJECT, P_SUBSCRIPTION_ID, P_SUBSCRIPTION_LABEL, P_TIME, P_TO, P_URL, P_WAIT, SUBJECT_META, SUBJECT_META_JOINS, SUBJECT_META_SUBS
 
Fields inherited from interface nl.justobjects.pushlet.core.ConfigDefs
CONTROLLER_CLASS, DISPATCHER_CLASS, LISTEN_FORCE_PULL_AGENTS, LISTEN_FORCE_PULL_ALL, LOG_LEVEL, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_INFO, LOG_LEVEL_TRACE, LOG_LEVEL_WARN, LOGGER_CLASS, POLL_REFRESH_TIMEOUT_MILLIS, POLL_REFRESH_WAIT_MAX_MILLIS, POLL_REFRESH_WAIT_MIN_MILLIS, PULL_REFRESH_TIMEOUT_MILLIS, PULL_REFRESH_WAIT_MAX_MILLIS, PULL_REFRESH_WAIT_MIN_MILLIS, QUEUE_READ_TIMEOUT_MILLIS, QUEUE_SIZE, QUEUE_WRITE_TIMEOUT_MILLIS, SESSION_CLASS, SESSION_ID_GENERATION, SESSION_ID_GENERATION_RANDOMSTRING, SESSION_ID_GENERATION_UUID, SESSION_ID_SIZE, SESSION_MANAGER_CLASS, SESSION_TIMEOUT_MINS, SOURCES_ACTIVATE, SUBSCRIBER_CLASS, SUBSCRIPTION_CLASS
 
Constructor Summary
protected Session()
          Protected constructor as we create through factory method.
 
Method Summary
 void age(long aDeltaMillis)
          Decrease time to live.
static Session create(java.lang.String anId)
          Create instance through factory method.
 void debug(java.lang.String s)
          Exceptional print util.
 java.lang.String getAddress()
          Return (remote) Subscriber client's IP address.
 Controller getController()
          Return command controller.
 java.lang.String getFormat()
          Return Event format to send to client.
 java.lang.String getId()
          Return (remote) Subscriber client's unique id.
 Subscriber getSubscriber()
          Return subscriber.
 java.lang.String getUserAgent()
          Return remote HTTP User-Agent.
 void info(java.lang.String s)
          Info.
 boolean isExpired()
          Has session timed out?
 void kick()
          Keep alive by resetting TTL.
protected  void setAddress(java.lang.String anAddress)
          Set address.
protected  void setFormat(java.lang.String aFormat)
          Set event format to encode.
 void setUserAgent(java.lang.String aUserAgent)
          Set client HTTP UserAgent.
 void start()
           
 void stop()
           
 java.lang.String toString()
           
 void warn(java.lang.String s)
          Exceptional print util.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

controller

private Controller controller

subscriber

private Subscriber subscriber

userAgent

private java.lang.String userAgent

LEASE_TIME_MILLIS

private long LEASE_TIME_MILLIS

timeToLive

private volatile long timeToLive

FORCED_PULL_AGENTS

public static java.lang.String[] FORCED_PULL_AGENTS

address

private java.lang.String address

format

private java.lang.String format

id

private java.lang.String id
Constructor Detail

Session

protected Session()
Protected constructor as we create through factory method.

Method Detail

create

public static Session create(java.lang.String anId)
                      throws PushletException
Create instance through factory method.

Parameters:
anId - a session id
Returns:
a Session object (or derived)
Throws:
PushletException - exception, usually misconfiguration

getAddress

public java.lang.String getAddress()
Return (remote) Subscriber client's IP address.


getController

public Controller getController()
Return command controller.


getFormat

public java.lang.String getFormat()
Return Event format to send to client.


getId

public java.lang.String getId()
Return (remote) Subscriber client's unique id.


getSubscriber

public Subscriber getSubscriber()
Return subscriber.


getUserAgent

public java.lang.String getUserAgent()
Return remote HTTP User-Agent.


setAddress

protected void setAddress(java.lang.String anAddress)
Set address.


setFormat

protected void setFormat(java.lang.String aFormat)
Set event format to encode.


setUserAgent

public void setUserAgent(java.lang.String aUserAgent)
Set client HTTP UserAgent.


age

public void age(long aDeltaMillis)
Decrease time to live.


isExpired

public boolean isExpired()
Has session timed out?


kick

public void kick()
Keep alive by resetting TTL.


start

public void start()

stop

public void stop()

info

public void info(java.lang.String s)
Info.


warn

public void warn(java.lang.String s)
Exceptional print util.


debug

public void debug(java.lang.String s)
Exceptional print util.


toString

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


Copyright 2000-2003 - Just Objects B.V.