## org.mortbay.cometd
Class ChannelImpl

    java.lang.Object
      org.mortbay.cometd.ChannelImpl

All Implemented Interfaces:
  Channel

    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` `deliver(ChannelId to, Client from, Map<String,Object> msg)`
`ChannelId` `getChannelId()`
`ChannelImpl` `getChild(ChannelId id)`
`String` `getId()`
`int` `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()`
`void` `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)

  Parameters:
    `filter` -

### getChannelId

    public ChannelId getChannelId()

  Returns:

### getChild

    public ChannelImpl getChild(ChannelId id)

### 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 void removeDataFilter(DataFilter filter)

  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` -

### deliver

    protected void deliver(ChannelId to,
                           Client from,
                           Map<String,Object> msg)

### getSubscribers

    public int getSubscribers()

  Specified by:
    `getSubscribers` in interface `Channel`
  Returns:
    the number of subscribers for this channel.

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.