org.cometd.server
Class AbstractServerTransport

java.lang.Object
  extended by org.cometd.common.AbstractTransport
      extended by org.cometd.server.AbstractServerTransport
All Implemented Interfaces:
ServerTransport, Transport
Direct Known Subclasses:
HttpTransport

public abstract class AbstractServerTransport
extends AbstractTransport
implements ServerTransport

The base class of all server transports.

Each derived Transport class should declare all options that it supports by calling AbstractTransport.setOption(String, Object) for each option. Then during the call the init(), each transport should call the variants of AbstractTransport.getOption(String) to obtained the configured value for the option.


Nested Class Summary
static interface AbstractServerTransport.OneTimeScheduler
           
static interface AbstractServerTransport.Scheduler
           
 
Field Summary
protected  org.slf4j.Logger _logger
           
static String INTERVAL_OPTION
           
static String MAX_INTERVAL_OPTION
           
static String MAX_LAZY_OPTION
           
static String META_CONNECT_DELIVERY_OPTION
           
static String TIMEOUT_OPTION
           
 
Constructor Summary
protected AbstractServerTransport(BayeuxServerImpl bayeux, String name)
          The constructor is passed the BayeuxServerImpl instance for the transport.
 
Method Summary
protected  void destroy()
           
 Object getAdvice()
           
 BayeuxServerImpl getBayeux()
          Get the bayeux.
 long getInterval()
          Get the interval.
 long getMaxInterval()
          Get the maxInterval.
 long getMaxLazyTimeout()
          Get the max time before dispatching lazy message.
 long getTimeout()
           
protected  void init()
          Initialise the transport, resolving default and direct options.
 boolean isMetaConnectDeliveryOnly()
           
protected  ServerMessage.Mutable[] parseMessages(BufferedReader reader, boolean jsonDebug)
           
protected  ServerMessage.Mutable[] parseMessages(String json)
           
 void setAdvice(Object advice)
          Set the advice.
 void setInterval(long interval)
          Set the interval.
 void setMaxInterval(long maxInterval)
          Set the maxInterval.
 void setMaxLazyTimeout(long maxLazyTimeout)
          Set the maxLazyTimeout.
 void setMetaConnectDeliveryOnly(boolean meta)
           
 void setTimeout(long timeout)
          Set the timeout.
protected  void sweep()
          Housekeeping sweep, called a regular intervals
 
Methods inherited from class org.cometd.common.AbstractTransport
getName, getOption, getOption, getOption, getOption, getOption, getOptionNames, getOptionPrefix, setOption, setOptionPrefix
 
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.server.ServerTransport
getContext, getCurrentLocalAddress, getCurrentRemoteAddress
 
Methods inherited from interface org.cometd.bayeux.Transport
getName, getOption, getOptionNames, getOptionPrefix
 

Field Detail

TIMEOUT_OPTION

public static final String TIMEOUT_OPTION
See Also:
Constant Field Values

INTERVAL_OPTION

public static final String INTERVAL_OPTION
See Also:
Constant Field Values

MAX_INTERVAL_OPTION

public static final String MAX_INTERVAL_OPTION
See Also:
Constant Field Values

MAX_LAZY_OPTION

public static final String MAX_LAZY_OPTION
See Also:
Constant Field Values

META_CONNECT_DELIVERY_OPTION

public static final String META_CONNECT_DELIVERY_OPTION
See Also:
Constant Field Values

_logger

protected final org.slf4j.Logger _logger
Constructor Detail

AbstractServerTransport

protected AbstractServerTransport(BayeuxServerImpl bayeux,
                                  String name)

The constructor is passed the BayeuxServerImpl instance for the transport. The BayeuxServerImpl.getOptions() map is populated with the default options known by this transport. The options are then inspected again when init() is called, to set the actual values used. The options are arranged into a naming hierarchy by derived classes adding prefix by calling add AbstractTransport.setOptionPrefix(String). Calls to AbstractTransport.getOption(String) will use the list of prefixes to search for the most specific option set.

Parameters:
bayeux - the BayeuxServer implementation
name - the name of the transport
Method Detail

getAdvice

public Object getAdvice()
Specified by:
getAdvice in interface ServerTransport

getInterval

public long getInterval()
Get the interval.

Specified by:
getInterval in interface ServerTransport
Returns:
the interval

getMaxInterval

public long getMaxInterval()
Get the maxInterval.

Specified by:
getMaxInterval in interface ServerTransport
Returns:
the maxInterval

getMaxLazyTimeout

public long getMaxLazyTimeout()
Get the max time before dispatching lazy message.

Specified by:
getMaxLazyTimeout in interface ServerTransport
Returns:
the max lazy timeout in MS

getTimeout

public long getTimeout()
Specified by:
getTimeout in interface ServerTransport
Returns:
the timeout

isMetaConnectDeliveryOnly

public boolean isMetaConnectDeliveryOnly()
Specified by:
isMetaConnectDeliveryOnly in interface ServerTransport

setMetaConnectDeliveryOnly

public void setMetaConnectDeliveryOnly(boolean meta)

init

protected void init()
Initialise the transport, resolving default and direct options.


destroy

protected void destroy()

parseMessages

protected ServerMessage.Mutable[] parseMessages(BufferedReader reader,
                                                boolean jsonDebug)
                                         throws ParseException,
                                                IOException
Throws:
ParseException
IOException

parseMessages

protected ServerMessage.Mutable[] parseMessages(String json)
                                         throws ParseException
Throws:
ParseException

getBayeux

public BayeuxServerImpl getBayeux()
Get the bayeux.

Returns:
the bayeux

setInterval

public void setInterval(long interval)
Set the interval.

Parameters:
interval - the interval to set

setMaxInterval

public void setMaxInterval(long maxInterval)
Set the maxInterval.

Parameters:
maxInterval - the maxInterval to set

setTimeout

public void setTimeout(long timeout)
Set the timeout.

Parameters:
timeout - the timeout to set

setMaxLazyTimeout

public void setMaxLazyTimeout(long maxLazyTimeout)
Set the maxLazyTimeout.

Parameters:
maxLazyTimeout - the maxLazyTimeout to set

setAdvice

public void setAdvice(Object advice)
Set the advice.

Parameters:
advice - the advice to set

sweep

protected void sweep()
Housekeeping sweep, called a regular intervals



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