Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.httppubsub
Interface Channel

public interface Channel

Channel represents a pub/sub channel. A channel can have sub channels beneath it like a hierarchical structure.

Inner Class Summary
`static class` | `Channel.ChannelPattern` This enum provides constants of the three channel patterns that are described in section 2.2.1 Channel Globbing of Bayeux Protocol -- Bayeux 1.0draft1 .

Method Summary
`void` | `addSubChannel(Channel child)` Add one immediate child channel to this channel
`void` | `destroy(Client client)` Destroy this channel and all subchannels beneath it
`java.util.List` | `getClients(Channel.ChannelPattern pattern)` Return back list of clients who may interested in this channel or its children, depending on `pattern` parameter passed in.
`java.lang.String` | `getName()` Return the fully qualified name of this Channel.
`Channel` | `getParentChannel()` Return current channel's parent or null if current channel is root.
`long` | `getPublishedMessageCount()` Get count of messages published to the channel
`java.util.List` | `getSubChannels()` Return the list of immediate child channels for the current channel
`boolean` | `isMetaChannel()` Judge whether the channel is a meta channel.
`boolean` | `isPersistentChannel()` Judge whether the channel is a persistent channel or not.
`void` | `publish(BayeuxMessage message, Channel.ChannelPattern pattern)` Publish to this channel or its child channels with specified pattern.
`void` | `registerListener(ChannelMessageListener listener)` Register ChannelMessageListener object to this Channel.
`void` | `removeSubChannel(Channel child)` Remove sub channel from this channel.
`void` | `subscribe(Client client)` Subscribe to this channel.
`void` | `subscribe(Client client, Channel.ChannelPattern pattern)` Subscribe to this channel or its child channels with specified pattern.
`void` | `unregisterListener(ChannelMessageListener listener)` Unregister ChannnelMessageListener object from this channel
`void` | `unsubscribe(Client client)` Unsubscribe from all of this channel.
`void` | `unsubscribe(Client client, Channel.ChannelPattern pattern)` Unsubscribe from this channel.

Method Detail

### getName

    public java.lang.String getName()

  Return the fully qualified name of this Channel. It could be something like /foo/bar/baz.

  Returns:
    Channel name.

### getParentChannel

    public Channel getParentChannel()

  Return current channel's parent or null if current channel is root.

  Returns:
    parent channel

### getSubChannels

    public java.util.List getSubChannels()

  Return the list of immediate child channels for the current channel

  Returns:
    the list of immediate child channels

### addSubChannel

    public void addSubChannel(Channel child)

  Add one immediate child channel to this channel

  Parameters:
    `child` - child channel.

### removeSubChannel

    public void removeSubChannel(Channel child)

  Remove sub channel from this channel.

  Parameters:
    `child` - child channel.

### destroy

    public void destroy(Client client)

  Destroy this channel and all subchannels beneath it

  Parameters:
    `client` - Client object.

### getClients

    public java.util.List getClients(Channel.ChannelPattern pattern)

  Return back list of clients who may interested in this channel or its children, depending on `pattern` parameter passed in.

  Parameters:
    `pattern` - subscribe pattern, valid values are `ITSELF, IMMEDIATE_SUBCHANNELS, ALL_SUBCHANNELS`
  Returns:
    a list of client subscribing to this channel, or this channel's immediate child channels, or this channel's child channels.

### subscribe

    public void subscribe(Client client)
                   throws PubSubSecurityException

  Subscribe to this channel.

       This method is equivalent to:
           subscribe(client, ChannelPattern.ITSELF);

  Parameters:
    `client` - Client object.
  Throws:
    PubSubSecurityException - when any security error occurs.

### subscribe

    public void subscribe(Client client,
                          Channel.ChannelPattern pattern)
                   throws PubSubSecurityException

  Subscribe to this channel or its child channels with specified pattern.
  - If client is interested in current channel only (/current_channel), the passed-in pattern should be `ITSELF`.
  - If client is interested in current channel's immediate children ( /current_channel/*), the passed-in pattern should be `IMMEDIATE_SUBCHANNELS`
  - If client is interested in all children of current channel ( /current_channel/**), the passed-in pattern should be `ALL_SUBCHANNELS`

  Parameters:
    `client` - client to subscribe this channel
    `pattern` - pattern deciding which channels beneath the current channel should be subscribed.
  Throws:
    PubSubSecurityException - If security permission checking failure.

### unsubscribe

    public void unsubscribe(Client client)

  Unsubscribe from all of this channel.

       This method is equivalent to:
           unsubscribe(client, ChannelPattern.ITSELF);
           unsubscribe(client, ChannelPattern.IMMEDIATE_SUBCHANNELS);
           unsubscribe(client, ChannelPattern.ALL_SUBCHANNELS);

  Parameters:
    `client` - client object.

### unsubscribe

    public void unsubscribe(Client client,
                            Channel.ChannelPattern pattern)

  Unsubscribe from this channel.
  - If client is interested in current channel only (/current_channel), the passed-in pattern should be `ITSELF`.
  - If client is interested in current channel's immediate children ( /current_channel/*), the passed-in pattern should be `IMMEDIATE_SUBCHANNELS`
  - If client is interested in all children of current channel ( /current_channel/**), the passed-in pattern should be `ALL_SUBCHANNELS`

  Parameters:
    `client` - client to unsubscribe this channel
    `pattern` - pattern deciding which channels beneath the current channel should be unsubscribed.

### publish

    public void publish(BayeuxMessage message,
                        Channel.ChannelPattern pattern)
                 throws PubSubSecurityException

  Publish to this channel or its child channels with specified pattern.
  - If client wants to publish messages to the current channel only, the passed-in pattern should be `ITSELF`.
  - If client wants to publish messages to the current channel's immediate children, the passed-in pattern should be `IMMEDIATE_SUBCHANNELS`
  - If client wants to publish messages to all child channels of the current channel, the passed-in pattern should be `ALL_SUBCHANNELS`

  Parameters:
    `message` - BayeuxMessage to publish.
    `pattern` - channel pattern to decide where to publish
  Throws:
    PubSubSecurityException - If no permission to publish

### getPublishedMessageCount

    public long getPublishedMessageCount()

  Get count of messages published to the channel

  Returns:
    count of messages published to the channel

### isMetaChannel

    public boolean isMetaChannel()

  Judge whether the channel is a meta channel. A meta channel is a channel whose name starts with "/meta/" or equals to "/meta".

  Returns:
    true or false.

### isPersistentChannel

    public boolean isPersistentChannel()

  Judge whether the channel is a persistent channel or not.

  Returns:
    True of false.

### registerListener

    public void registerListener(ChannelMessageListener listener)

  Register ChannelMessageListener object to this Channel.

  Parameters:
    `listener` - ChannelMessageListener object.

### unregisterListener

    public void unregisterListener(ChannelMessageListener listener)

  Unregister ChannnelMessageListener object from this channel

  Parameters:
    `listener` - ChannelMessageListener object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 BEA Systems All Rights Reserved.