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

## org.objectstyle.cayenne.remote
Class ClientChannel

    java.lang.Object
      org.objectstyle.cayenne.remote.ClientChannel

All Implemented Interfaces:
  DataChannel

    public class ClientChannel

extends java.lang.Object
implements DataChannel

A `DataChannel` implementation that accesses a remote server via a ClientConnection.

Since:
  1.2
Author:
  Andrus Adamchik

Field Summary
`protected boolean` | `channelEventsEnabled`
`protected ClientConnection` | `connection`
`protected EventManager` | `eventManager`

Fields inherited from interface org.objectstyle.cayenne.DataChannel
`FLUSH_CASCADE_SYNC, FLUSH_NOCASCADE_SYNC, GRAPH_CHANGED_SUBJECT, GRAPH_FLUSHED_SUBJECT, GRAPH_ROLLEDBACK_SUBJECT, ROLLBACK_CASCADE_SYNC`

Constructor Summary
`ClientChannel(ClientConnection connection)` Creates a new channel accessing remote server via provided connection.
`ClientChannel(ClientConnection connection, boolean channelEventsEnabled)`
`ClientChannel(ClientConnection connection, boolean channelEventsEnabled, EventManager eventManager)`

Method Summary
`EntityResolver` | `getEntityResolver()` Returns an EntityResolver instance that contains runtime mapping information.
`EventManager` | `getEventManager()` Returns an EventManager associated with this channel.
`QueryResponse` | `onQuery(ObjectContext context, Query query)` Executes a query, using provided context to register persistent objects if query returns any objects.
`GraphDiff` | `onSync(ObjectContext originatingContext, GraphDiff changes, int syncType)` Processes synchronization request from a child ObjectContext, returning a GraphDiff that describes changes to objects made on the receiving end as a result of syncronization.
`protected java.lang.Object` | `send(ClientMessage message, java.lang.Class resultClass)` Sends a message via connector, getting a result as an instance of a specific class.
`protected boolean` | `setupRemoteChannelListener()` Starts up an EventBridge to listen for remote updates.

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

Field Detail

### connection

    protected ClientConnection connection

### eventManager

    protected EventManager eventManager

### channelEventsEnabled

    protected boolean channelEventsEnabled

Constructor Detail

### ClientChannel

    public ClientChannel(ClientConnection connection)

  Creates a new channel accessing remote server via provided connection. Channel created using this constructor will post no events of its own and provide its users with a multithreaded EventManager.

### ClientChannel

    public ClientChannel(ClientConnection connection,
                         boolean channelEventsEnabled)

### ClientChannel

    public ClientChannel(ClientConnection connection,
                         boolean channelEventsEnabled,
                         EventManager eventManager)
                  throws CayenneRuntimeException

Throws:
  `CayenneRuntimeException`

Method Detail

### getEventManager

    public EventManager getEventManager()

  Description copied from interface: `DataChannel`
  Returns an EventManager associated with this channel. Channel may return null if EventManager is not available for any reason.

  Specified by:
    `getEventManager` in interface `DataChannel`

### onQuery

    public QueryResponse onQuery(ObjectContext context,
                                 Query query)

  Description copied from interface: `DataChannel`
  Executes a query, using provided context to register persistent objects if query returns any objects.

  Specified by:
    `onQuery` in interface `DataChannel`
  Parameters:
    `context` - an ObjectContext that originated the query, used to register result objects.
  Returns:
    a generic response object that encapsulates result of the execution.

### onSync

    public GraphDiff onSync(ObjectContext originatingContext,
                            GraphDiff changes,
                            int syncType)

  Description copied from interface: `DataChannel`
  Processes synchronization request from a child ObjectContext, returning a GraphDiff that describes changes to objects made on the receiving end as a result of syncronization.

  Specified by:
    `onSync` in interface `DataChannel`
  Parameters:
    `originatingContext` - an ObjectContext that initiated the sync. Can be null.
    `changes` - diff from the context that initiated the sync.
    `syncType` - One of `DataChannel.FLUSH_NOCASCADE_SYNC`, `DataChannel.FLUSH_CASCADE_SYNC`, `DataChannel.ROLLBACK_CASCADE_SYNC`.

### getEntityResolver

    public EntityResolver getEntityResolver()

  Description copied from interface: `DataChannel`
  Returns an EntityResolver instance that contains runtime mapping information.

  Specified by:
    `getEntityResolver` in interface `DataChannel`

### setupRemoteChannelListener

    protected boolean setupRemoteChannelListener()
                                          throws CayenneRuntimeException

  Starts up an EventBridge to listen for remote updates. Returns true if the listener was setup, false if not. False can be returned if the underlying connection doesn't support events of if there is no EventManager available.

  Throws:
    `CayenneRuntimeException`

### send

    protected java.lang.Object send(ClientMessage message,
                                    java.lang.Class resultClass)

  Sends a message via connector, getting a result as an instance of a specific class.

  Throws:
    `org.objectstyle.cayenne.client.CayenneClientException` - if an underlying connector exception occured, or a result is not of expected type.

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

Copyright © 2001-2006 ObjectStyle.org All Rights Reserved.