org.mortbay.cometd
Class ChannelImpl

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

public class ChannelImpl
extends Object
implements Channel

A Bayuex Channel

Author:
gregw

Field Summary
protected  AbstractBayeux _bayeux
           
 
Method Summary
 void addChild(ChannelImpl channel)
           
 void addDataFilter(DataFilter filter)
           
protected  void doDelivery(ChannelId to, Client from, Message msg)
           
 ChannelId getChannelId()
           
 void getChannels(List<Channel> list)
           
 ChannelImpl getChild(ChannelId id)
           
 Collection<DataFilter> getDataFilters()
           
 String getId()
           
 Collection<Client> getSubscribers()
           
 String getToken(Client client, boolean subscribe, boolean send, boolean oneTime)
           
 boolean isPersistent()
          Is the channel persistent.
 void publish(Client fromClient, Object data, String msgId)
          Publish a message This is equivalent to Bayeux.publish(fromClient,channel.getId(),data,msgId).
 boolean remove()
           
 DataFilter removeDataFilter(DataFilter filter)
           
 void setPersistent(boolean persistent)
           
 void subscribe(Client client)
          Subscribe to a channel.
 String toString()
           
 void unsubscribe(Client client)
          Unsubscribe to a channel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_bayeux

protected AbstractBayeux _bayeux
Method Detail

addChild

public void addChild(ChannelImpl channel)

addDataFilter

public void addDataFilter(DataFilter filter)
Specified by:
addDataFilter in interface Channel
Parameters:
filter -

getChannelId

public ChannelId getChannelId()
Returns:

getChild

public ChannelImpl getChild(ChannelId id)

getChannels

public void getChannels(List<Channel> list)

getId

public String getId()
Specified by:
getId in interface Channel
Returns:

getToken

public String getToken(Client client,
                       boolean subscribe,
                       boolean send,
                       boolean oneTime)
Parameters:
client - The client for which this token will be valid
subscribe - True if this token may be used for subscriptions
send - True if this token may be used for send
oneTime - True if this token may only be used in one request batch.
Returns:
A new token that can be used for subcriptions and or sending.

isPersistent

public boolean isPersistent()
Description copied from interface: Channel
Is the channel persistent. Non persistent channels are removed when the last subscription is removed

Specified by:
isPersistent in interface Channel
Returns:
true if the Channel will persist without any subscription.

publish

public void publish(Client fromClient,
                    Object data,
                    String msgId)
Description copied from interface: Channel
Publish a message This is equivalent to Bayeux.publish(fromClient,channel.getId(),data,msgId).

Specified by:
publish in interface Channel

remove

public boolean remove()
Specified by:
remove in interface Channel
Returns:
true if the Channel has been removed, false if it was not possible to remove the channel

removeDataFilter

public DataFilter removeDataFilter(DataFilter filter)
Specified by:
removeDataFilter in interface Channel
Parameters:
filter -

setPersistent

public void setPersistent(boolean persistent)
Specified by:
setPersistent in interface Channel
Parameters:
persistent - true if the Channel will persist without any subscription.

subscribe

public void subscribe(Client client)
Description copied from interface: Channel
Subscribe to a channel. Equivalent to bayeux.subscribe(channel.getId(),subscriber,false);

Specified by:
subscribe in interface Channel
Parameters:
client -

toString

public String toString()
Overrides:
toString in class Object

unsubscribe

public void unsubscribe(Client client)
Description copied from interface: Channel
Unsubscribe to a channel

Specified by:
unsubscribe in interface Channel
Parameters:
client -

doDelivery

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

getSubscribers

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

getDataFilters

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


Copyright © 2008 Mort Bay Consulting. All Rights Reserved.