public class ClientChannel extends Object implements DataChannel
DataChannel implementation that accesses a remote server
via a ClientConnection.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
channelEventsEnabled |
protected ClientConnection |
connection |
protected GraphDiffCompressor |
diffCompressor |
protected EntityResolver |
entityResolver |
protected EventManager |
eventManager |
FLUSH_CASCADE_SYNC, FLUSH_NOCASCADE_SYNC, GRAPH_CHANGED_SUBJECT, GRAPH_FLUSHED_SUBJECT, GRAPH_ROLLEDBACK_SUBJECT, ROLLBACK_CASCADE_SYNC| Constructor and Description |
|---|
ClientChannel(ClientConnection connection,
boolean channelEventsEnabled,
EventManager eventManager,
boolean remoteEventsOptional) |
| Modifier and Type | Method and Description |
|---|---|
ClientConnection |
getConnection() |
EntityResolver |
getEntityResolver()
Returns EntityResolver obtained from the server.
|
EventManager |
getEventManager()
Returns an EventManager associated with this channel.
|
boolean |
isChannelEventsEnabled() |
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
synchronization.
|
protected <T> T |
send(ClientMessage message,
Class<T> 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.
|
protected ClientConnection connection
protected EventManager eventManager
protected EntityResolver entityResolver
protected boolean channelEventsEnabled
protected GraphDiffCompressor diffCompressor
public ClientChannel(ClientConnection connection, boolean channelEventsEnabled, EventManager eventManager, boolean remoteEventsOptional) throws CayenneRuntimeException
remoteEventsOptional - if true, failure to start an EventBridge will not
result in an exception.CayenneRuntimeExceptionpublic ClientConnection getConnection()
public boolean isChannelEventsEnabled()
public EventManager getEventManager()
DataChannelgetEventManager in interface DataChannelpublic QueryResponse onQuery(ObjectContext context, Query query)
DataChannelonQuery in interface DataChannelcontext - an ObjectContext that originated the query, used to
register result objects.public GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType)
DataChannelonSync in interface DataChanneloriginatingContext - 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.public EntityResolver getEntityResolver()
getEntityResolver in interface DataChannelprotected boolean setupRemoteChannelListener()
throws CayenneRuntimeException
CayenneRuntimeExceptionprotected <T> T send(ClientMessage message, Class<T> resultClass)
CayenneRuntimeException - if an underlying connector
exception occurred, or a result is not of expected type.Copyright © 2001–2023 Apache Cayenne. All rights reserved.