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

## org.mortbay.cometd
Class ClientImpl

    java.lang.Object
      org.mortbay.cometd.ClientImpl

All Implemented Interfaces:
  Client

    public class ClientImpl

extends Object
implements Client

Author:
  gregw

Field Summary
`protected AbstractBayeux` | `_bayeux`

Constructor Summary
`protected` | `ClientImpl(AbstractBayeux bayeux, String idPrefix, Listener listener)`

Method Summary
`protected void` | `addSubscription(ChannelImpl channel)`
`ChannelImpl` | `connect()` Connect the client.
`void` | `deliver(Client from, Map<String,Object> message)` Deliver a message to this client only Deliver a message directly to the client.
`void` | `endBatch()` End a batch of messages.
`boolean` | `equals(Object o)`
`int` | `getAdviceVersion()`
`String` | `getBrowserId()`
`ChannelImpl` | `getConnection()`
`String` | `getConnectionType()`
`String` | `getId()`
`Listener` | `getListener()`
`boolean` | `hasMessages()`
`boolean` | `isJSONCommented()`
`boolean` | `isLocal()`
`int` | `onBrowser(String browserId)`
`void` | `publish(String toChannel, Object data, String msgId)` Publish data from this client.
`void` | `remove(boolean timeout)` Remove Client Unsubscribe client from all channels and remove it.
`protected void` | `removeSubscription(ChannelImpl channel)`
`int` | `responded()`
`int` | `responsePending()`
`void` | `resume()` Called by deliver to resume anything waiting on this client.
`void` | `setAdviceVersion(int version)`
`void` | `setBrowserId(String id)`
`protected void` | `setConnectionType(String type)`
`protected void` | `setId(String _id)`
`void` | `setJSONCommented(boolean commented)`
`void` | `setListener(Listener listener)`
`void` | `startBatch()` Start a batch of messages.
`void` | `subscribe(String toChannel)` Subscribe this client to a channel.
`Queue<Map<String,Object>>` | `takeMessages()` Take any messages queued for a client.
`String` | `toString()`
`void` | `unsubscribe(String toChannel)` Unsubscribe this client from a channel.
`protected void` | `unsubscribeAll()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### _bayeux

    protected AbstractBayeux _bayeux

Constructor Detail

### ClientImpl

    protected ClientImpl(AbstractBayeux bayeux,
                         String idPrefix,
                         Listener listener)

Method Detail

### publish

    public void publish(String toChannel,
                        Object data,
                        String msgId)

  Description copied from interface: `Client`
  Publish data from this client. This is equivalent to `Bayeux.publish(Client, String, Object, String)` with this client passed.

  Specified by:
    `publish` in interface `Client`
  Parameters:
    `toChannel` - The Channel ID to which the data is targetted
    `data` - The data itself which must be an Object that can be encoded with `JSON`.
    `msgId` - optional message ID or null for automatic generation of a message ID.

### subscribe

    public void subscribe(String toChannel)

  Description copied from interface: `Client`
  Subscribe this client to a channel. This is equivalent to `Bayeux.subscribe(String, Client)` with this client passed. Equivalent to getChannel(toChannel).subscribe(subscriber).

  Specified by:
    `subscribe` in interface `Client`

### unsubscribe

    public void unsubscribe(String toChannel)

  Description copied from interface: `Client`
  Unsubscribe this client from a channel. This is equivalent to `Bayeux.unsubscribe(String, Client)` with this client passed.

  Specified by:
    `unsubscribe` in interface `Client`

### connect

    public ChannelImpl connect()

  Connect the client.

  Returns:
    the meta Channel for the connection

### deliver

    public void deliver(Client from,
                        Map<String,Object> message)

  Description copied from interface: `Client`
  Deliver a message to this client only Deliver a message directly to the client. The message is not filtered or published to a channel.

  Specified by:
    `deliver` in interface `Client`
  Parameters:
    `from` - The Client that published the message, or null if not known/available

### startBatch

    public void startBatch()

  Description copied from interface: `Client`
  Start a batch of messages. Messages will not be delivered remotely until the corresponding endBatch is called. Batches may be nested and messages are only sent once all batches are ended.

  Specified by:
    `startBatch` in interface `Client`

### endBatch

    public void endBatch()

  Description copied from interface: `Client`
  End a batch of messages. Messages will not be delivered that have been queued since the previous startBatch is called. Batches may be nested and messages are only sent once all batches are ended.

  Specified by:
    `endBatch` in interface `Client`

### getConnection

    public ChannelImpl getConnection()

  Returns:
    the meta Channel for the connection or null if not connected.

### getConnectionType

    public String getConnectionType()

### getId

    public String getId()

  Specified by:
    `getId` in interface `Client`

### hasMessages

    public boolean hasMessages()

  Specified by:
    `hasMessages` in interface `Client`

### isJSONCommented

    public boolean isJSONCommented()

  Returns:
    the commented

### isLocal

    public boolean isLocal()

  Specified by:
    `isLocal` in interface `Client`
  Returns:
    True if the client is local. False if this client is either a remote HTTP client or a java client to a remote server.

### remove

    public void remove(boolean timeout)

  Description copied from interface: `Client`
  Remove Client Unsubscribe client from all channels and remove it.

  Specified by:
    `remove` in interface `Client`

### responded

    public int responded()

### responsePending

    public int responsePending()

### resume

    public void resume()

  Called by deliver to resume anything waiting on this client.

### setJSONCommented

    public void setJSONCommented(boolean commented)

  Parameters:
    `commented` - the commented to set

### setListener

    public void setListener(Listener listener)

  Specified by:
    `setListener` in interface `Client`

### getListener

    public Listener getListener()

  Specified by:
    `getListener` in interface `Client`

### takeMessages

    public Queue<Map<String,Object>> takeMessages()

  Description copied from interface: `Client`
  Take any messages queued for a client.

  Specified by:
    `takeMessages` in interface `Client`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### addSubscription

    protected void addSubscription(ChannelImpl channel)

### removeSubscription

    protected void removeSubscription(ChannelImpl channel)

### setConnectionType

    protected void setConnectionType(String type)

### setId

    protected void setId(String _id)

### unsubscribeAll

    protected void unsubscribeAll()

### setBrowserId

    public void setBrowserId(String id)

### getBrowserId

    public String getBrowserId()

### onBrowser

    public int onBrowser(String browserId)

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### getAdviceVersion

    public int getAdviceVersion()

  Returns:
    the advised

### setAdviceVersion

    public void setAdviceVersion(int version)

  Parameters:
    `advised` - the advised to set

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

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.