Class ClientChannel

  • All Implemented Interfaces:
    DataChannel

    public class ClientChannel
    extends Object
    implements DataChannel
    A DataChannel implementation that accesses a remote server via a ClientConnection.
    Since:
    1.2
    • Method Detail

      • isChannelEventsEnabled

        public boolean isChannelEventsEnabled()
        Since:
        3.1
      • 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.
      • getEntityResolver

        public EntityResolver getEntityResolver()
        Returns EntityResolver obtained from the server. On first access, this method sends a message to the server to retrieve the EntityResolver. On subsequent calls locally cached resolver is used.
        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 <T> T send​(org.apache.cayenne.remote.ClientMessage message,
                             Class<T> resultClass)
        Sends a message via connector, getting a result as an instance of a specific class.
        Throws:
        CayenneRuntimeException - if an underlying connector exception occurred, or a result is not of expected type.