org.cometd.common
Class AbstractClientSession

java.lang.Object
  extended by org.cometd.common.AbstractClientSession
All Implemented Interfaces:
ClientSession, Session

public abstract class AbstractClientSession
extends Object
implements ClientSession

Partial implementation of ClientSession.

It handles extensions and batching, and provides utility methods to be used by subclasses.


Nested Class Summary
protected static class AbstractClientSession.AbstractSessionChannel
          A channel scoped to a ClientSession.
 
Nested classes/interfaces inherited from interface org.cometd.bayeux.client.ClientSession
ClientSession.Extension
 
Constructor Summary
protected AbstractClientSession()
           
 
Method Summary
 void addExtension(ClientSession.Extension extension)
           
 void batch(Runnable batch)
           
 void dump(StringBuilder b, String indent)
           
 boolean endBatch()
           
protected  boolean extendRcv(Message.Mutable message)
           
protected  boolean extendSend(Message.Mutable message)
           
 Object getAttribute(String name)
           
 Set<String> getAttributeNames()
           
 ClientSessionChannel getChannel(String channelId)
           
protected  ConcurrentMap<String,AbstractClientSession.AbstractSessionChannel> getChannels()
           
protected  boolean isBatching()
           
protected abstract  AbstractClientSession.AbstractSessionChannel newChannel(ChannelId channelId)
           
protected abstract  ChannelId newChannelId(String channelId)
           
protected  String newMessageId()
           
 void receive(Message.Mutable message)
          Receives a message (from the server) and process it.
 Object removeAttribute(String name)
           
 void removeExtension(ClientSession.Extension extension)
           
protected abstract  void sendBatch()
           
 void setAttribute(String name, Object value)
           
 void startBatch()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.cometd.bayeux.client.ClientSession
handshake, handshake
 
Methods inherited from interface org.cometd.bayeux.Session
disconnect, getId, isConnected, isHandshook
 

Constructor Detail

AbstractClientSession

protected AbstractClientSession()
Method Detail

newMessageId

protected String newMessageId()

addExtension

public void addExtension(ClientSession.Extension extension)
Specified by:
addExtension in interface ClientSession

removeExtension

public void removeExtension(ClientSession.Extension extension)
Specified by:
removeExtension in interface ClientSession

extendSend

protected boolean extendSend(Message.Mutable message)

extendRcv

protected boolean extendRcv(Message.Mutable message)

newChannelId

protected abstract ChannelId newChannelId(String channelId)

newChannel

protected abstract AbstractClientSession.AbstractSessionChannel newChannel(ChannelId channelId)

getChannel

public ClientSessionChannel getChannel(String channelId)
Specified by:
getChannel in interface ClientSession

getChannels

protected ConcurrentMap<String,AbstractClientSession.AbstractSessionChannel> getChannels()

startBatch

public void startBatch()
Specified by:
startBatch in interface Session

sendBatch

protected abstract void sendBatch()

endBatch

public boolean endBatch()
Specified by:
endBatch in interface Session

batch

public void batch(Runnable batch)
Specified by:
batch in interface Session

isBatching

protected boolean isBatching()

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface Session

getAttributeNames

public Set<String> getAttributeNames()
Specified by:
getAttributeNames in interface Session

removeAttribute

public Object removeAttribute(String name)
Specified by:
removeAttribute in interface Session

setAttribute

public void setAttribute(String name,
                         Object value)
Specified by:
setAttribute in interface Session

receive

public void receive(Message.Mutable message)

Receives a message (from the server) and process it.

Processing the message involves calling the receive extensions and the channel listeners.

Parameters:
message - the message received.
mutable - the mutable version of the message received

dump

public void dump(StringBuilder b,
                 String indent)


Copyright © 2008-2010 Dojo Foundation. All Rights Reserved.