org.cometd.server
Class ChannelImpl

java.lang.Object
  extended by org.cometd.server.ChannelImpl
All Implemented Interfaces:
Channel, ConfigurableChannel
Direct Known Subclasses:
AbstractBayeux.ServiceChannel

public class ChannelImpl
extends Object
implements Channel

A Bayeux Channel

Version:
$Revision: 1035 $ $Date: 2010-03-22 11:59:52 +0100 (Mon, 22 Mar 2010) $

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.cometd.ConfigurableChannel
ConfigurableChannel.Initializer
 
Constructor Summary
protected ChannelImpl(String id, AbstractBayeux bayeux)
           
 
Method Summary
 ChannelImpl addChild(ChannelImpl channel)
          Adds a channel
 void addDataFilter(DataFilter filter)
           
 void addListener(ChannelListener listener)
           
 void deliver(Client from, Iterable<Client> to, Object data, String id)
           
protected  void doDelivery(ChannelId to, Client from, Message msg)
           
 boolean doRemove(ChannelImpl channel, List<ChannelBayeuxListener> listeners)
           
 int getChannelCount()
           
 ChannelId getChannelId()
           
 void getChannels(List<Channel> list)
           
 ChannelImpl getChild(ChannelId id)
           
 Collection<DataFilter> getDataFilters()
           
 String getId()
           
 int getSubscriberCount()
           
 Collection<Client> getSubscribers()
           
 boolean isLazy()
          A Lazy channel marks published messages as lazy.
 boolean isPersistent()
           
 void publish(Client fromClient, Object data, String msgId)
           
 void publishLazy(Client fromClient, Object data, String msgId)
           
 boolean remove()
           
 DataFilter removeDataFilter(DataFilter filter)
           
 void removeListener(ChannelListener listener)
           
 void setLazy(boolean lazy)
          A Lazy channel marks published messages as lazy.
 void setPersistent(boolean persistent)
           
 void subscribe(Client client)
           
 String toString()
           
 void unsubscribe(Client c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChannelImpl

protected ChannelImpl(String id,
                      AbstractBayeux bayeux)
Method Detail

isLazy

public boolean isLazy()
A Lazy channel marks published messages as lazy. Lazy messages are queued but do not wake up waiting clients.

Specified by:
isLazy in interface ConfigurableChannel
Returns:
true if message is lazy

setLazy

public void setLazy(boolean lazy)
A Lazy channel marks published messages as lazy. Lazy messages are queued but do not wake up waiting clients.

Specified by:
setLazy in interface ConfigurableChannel
Parameters:
lazy - true if message is lazy

addChild

public ChannelImpl addChild(ChannelImpl channel)
Adds a channel

Parameters:
channel - the child channel to add
Returns:
The added channel, or the existing channel if another thread already added the channel

addDataFilter

public void addDataFilter(DataFilter filter)
Specified by:
addDataFilter in interface ConfigurableChannel
Parameters:
filter - the data filter to add

getChannelId

public ChannelId getChannelId()
Returns:
the ChannelId of this channel

getChild

public ChannelImpl getChild(ChannelId id)

getChannels

public void getChannels(List<Channel> list)

getChannelCount

public int getChannelCount()

getId

public String getId()
Specified by:
getId in interface ConfigurableChannel
Returns:
the id of this channel in string form

isPersistent

public boolean isPersistent()
Specified by:
isPersistent in interface ConfigurableChannel

deliver

public void deliver(Client from,
                    Iterable<Client> to,
                    Object data,
                    String id)

publish

public void publish(Client fromClient,
                    Object data,
                    String msgId)
Specified by:
publish in interface Channel

publishLazy

public void publishLazy(Client fromClient,
                        Object data,
                        String msgId)

remove

public boolean remove()
Specified by:
remove in interface Channel

doRemove

public boolean doRemove(ChannelImpl channel,
                        List<ChannelBayeuxListener> listeners)

removeDataFilter

public DataFilter removeDataFilter(DataFilter filter)
Specified by:
removeDataFilter in interface ConfigurableChannel
Parameters:
filter - the data filter to remove

setPersistent

public void setPersistent(boolean persistent)
Specified by:
setPersistent in interface ConfigurableChannel

subscribe

public void subscribe(Client client)
Specified by:
subscribe in interface Channel
Parameters:
client - the client to subscribe to this channel

toString

public String toString()
Overrides:
toString in class Object

unsubscribe

public void unsubscribe(Client c)
Specified by:
unsubscribe in interface Channel
Parameters:
c - the client to unsubscribe from this channel

doDelivery

protected void doDelivery(ChannelId to,
                          Client from,
                          Message msg)

getSubscribers

public Collection<Client> getSubscribers()
Specified by:
getSubscribers in interface Channel

getSubscriberCount

public int getSubscriberCount()
Specified by:
getSubscriberCount in interface Channel

getDataFilters

public Collection<DataFilter> getDataFilters()
Specified by:
getDataFilters in interface ConfigurableChannel

addListener

public void addListener(ChannelListener listener)
Specified by:
addListener in interface ConfigurableChannel

removeListener

public void removeListener(ChannelListener listener)
Specified by:
removeListener in interface ConfigurableChannel


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