com.tibbo.aggregate.common.protocol

## Class DefaultClientController<T extends CallerData>

- java.lang.Object
- - com.tibbo.aggregate.common.protocol.AbstractClientController<T>
  - - com.tibbo.aggregate.common.protocol.DefaultClientController<T>

- All Implemented Interfaces:
    CommandParserListener
  Direct Known Subclasses:
    AgentImplementationController

      public abstract class DefaultClientController<T extends CallerData>
      extends AbstractClientController<T>
      implements CommandParserListener

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `DefaultClientController.ForwardingEventListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long` | `discardedEventsCount`
    `protected boolean` | `json`
    `static int` | `KEEP_ALIVE_PERIOD`
    `protected KnownFormatCollector` | `knownFormatCollector`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultClientController(BlockingChannel dataChannel, ContextManager contextManager, java.util.concurrent.ExecutorService commandExecutionService, FormatCache formatCache, DataTableRegistry globalDataTableRegistry, int pendingEventsQueueCapacity)`
    `DefaultClientController(BlockingChannel dataChannel, ContextManager contextManager, java.util.concurrent.ExecutorService commandExecutionService, FormatCache formatCache, DataTableRegistry globalDataTableRegistry, int pendingEventsQueueCapacity, boolean json, boolean keepAliveDisabled)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addCustomListeners(Context con)`
    `protected boolean` | `addNormalListener(java.lang.String context, java.lang.String name, ContextEventListener cel)`
    `protected DataTable` | `callFunction(Context con, java.lang.String name, DataTable parameters)`
    `OutgoingAggreGateCommand` | `constructEventCommand(Event event, java.lang.Integer listenerCode)`
    `abstract boolean` | `controllerShouldHandle(Event ev, ContextEventListener listener)`
    `protected ClassicEncodingSettings` | `createClassicEncodingSettings(boolean useFormatCache)`
    `ContextEventListener` | `createListener(java.lang.Integer listenerHashCode, Expression filter, java.lang.String fingerprint)`
    `protected void` | `discardEvent()`
    `java.lang.String` | `getAddress()`
    `protected Context` | `getContext(java.lang.String path)`
    `ContextEventListener` | `getDefaultEventListener()`
    `long` | `getDiscardedEventsCount()`
    `protected java.lang.String` | `getErrorDetails(java.lang.Throwable error)`
    `protected FunctionDefinition` | `getFunctionDefinition(Context con, java.lang.String name)`
    `java.lang.Long` | `getLastDataTimestamp()`
    `int` | `getPendingEventsCount()`
    `long` | `getStartMessageCount()`
    `protected DataTable` | `getVariable(Context con, java.lang.String name)`
    `protected VariableDefinition` | `getVariableDefinition(Context con, java.lang.String name)`
    `boolean` | `isConnected()`
    `boolean` | `isJson()`
    `protected void` | `logoutUser()`
    `void` | `newDataReceived()`
    `OutgoingAggreGateCommand` | `processCommand(IncomingAggreGateCommand cmd)`
    `protected OutgoingAggreGateCommand` | `processMessage(IncomingAggreGateCommand cmd, OutgoingAggreGateCommand ans)`
    `protected OutgoingAggreGateCommand` | `processMessageOperation(IncomingAggreGateCommand cmd, OutgoingAggreGateCommand ans)`
    `OutgoingAggreGateCommand` | `processMessageStart(IncomingAggreGateCommand cmd, OutgoingAggreGateCommand ans)`
    `void` | `processOperationAddEventListener(java.lang.String id, java.lang.String context, java.lang.String name, java.lang.Integer listener, java.lang.String filter, java.lang.String fingerprint, OutgoingAggreGateCommand ans)`
    `OutgoingAggreGateCommand` | `processOperationCallFunction(java.lang.String id, Context con, java.lang.String name, java.lang.String encodedParameters, java.lang.String flags, OutgoingAggreGateCommand ans)`
    `void` | `processOperationGetVar(java.lang.String id, Context con, java.lang.String name, OutgoingAggreGateCommand ans)`
    `void` | `processOperationRemoveEventListener(java.lang.String id, java.lang.String context, java.lang.String name, java.lang.Integer listenerHashCode, java.lang.String filter, java.lang.String fingerprint, OutgoingAggreGateCommand ans)`
    `void` | `processOperationSetVar(java.lang.String id, Context con, java.lang.String name, java.lang.String encodedValue, OutgoingAggreGateCommand ans)`
    `boolean` | `run()`
    `void` | `runImpl()`
    `static java.lang.String` | `searchForCode(java.lang.Throwable ex)`
    `static java.lang.String` | `searchForCode(java.lang.Throwable ex, java.lang.String fallbackCode)`
    `void` | `sendCommand(OutgoingAggreGateCommand cmd)`
    `void` | `setFormatCache(FormatCache formatCache)`
    `void` | `setKnownFormatCollector(KnownFormatCollector knownFormatCollector)`
    `protected void` | `setVariable(Context con, java.lang.String name, DataTable value)`
    `void` | `shutdown()`

    - ### Methods inherited from class com.tibbo.aggregate.common.protocol.AbstractClientController

      `addMaskListener, getCallerController, getContextManager, getEventListeners, removeMaskListener, setCallerController, setContextManager`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### KEEP_ALIVE_PERIOD

          public static final int KEEP_ALIVE_PERIOD

      See Also:
        Constant Field Values

    - #### json

          protected final boolean json

    - #### discardedEventsCount

          protected long discardedEventsCount

    - #### knownFormatCollector

          protected KnownFormatCollector knownFormatCollector

  - ### Constructor Detail

    - #### DefaultClientController

          public DefaultClientController(BlockingChannel dataChannel,
                                         ContextManager contextManager,
                                         java.util.concurrent.ExecutorService commandExecutionService,
                                         FormatCache formatCache,
                                         DataTableRegistry globalDataTableRegistry,
                                         int pendingEventsQueueCapacity)

    - #### DefaultClientController

          public DefaultClientController(BlockingChannel dataChannel,
                                         ContextManager contextManager,
                                         java.util.concurrent.ExecutorService commandExecutionService,
                                         FormatCache formatCache,
                                         DataTableRegistry globalDataTableRegistry,
                                         int pendingEventsQueueCapacity,
                                         boolean json,
                                         boolean keepAliveDisabled)

  - ### Method Detail

    - #### searchForCode

          public static java.lang.String searchForCode(java.lang.Throwable ex)

    - #### searchForCode

          public static java.lang.String searchForCode(java.lang.Throwable ex,
                                                       java.lang.String fallbackCode)

    - #### setKnownFormatCollector

          public void setKnownFormatCollector(KnownFormatCollector knownFormatCollector)

    - #### processOperationGetVar

          public void processOperationGetVar(java.lang.String id,
                                             Context con,
                                             java.lang.String name,
                                             OutgoingAggreGateCommand ans)
                                      throws ContextException

      Throws:
        `ContextException`

    - #### getVariable

          protected DataTable getVariable(Context con,
                                          java.lang.String name)
                                   throws ContextException

      Throws:
        `ContextException`

    - #### processOperationSetVar

          public void processOperationSetVar(java.lang.String id,
                                             Context con,
                                             java.lang.String name,
                                             java.lang.String encodedValue,
                                             OutgoingAggreGateCommand ans)
                                      throws ContextException

      Throws:
        `ContextException`

    - #### getVariableDefinition

          protected VariableDefinition getVariableDefinition(Context con,
                                                             java.lang.String name)

    - #### setVariable

          protected void setVariable(Context con,
                                     java.lang.String name,
                                     DataTable value)
                              throws ContextException

      Throws:
        `ContextException`

    - #### processOperationCallFunction

          public OutgoingAggreGateCommand processOperationCallFunction(java.lang.String id,
                                                                       Context con,
                                                                       java.lang.String name,
                                                                       java.lang.String encodedParameters,
                                                                       java.lang.String flags,
                                                                       OutgoingAggreGateCommand ans)
                                                                throws ContextException

      Throws:
        `ContextException`

    - #### getFunctionDefinition

          protected FunctionDefinition getFunctionDefinition(Context con,
                                                             java.lang.String name)

    - #### callFunction

          protected DataTable callFunction(Context con,
                                           java.lang.String name,
                                           DataTable parameters)
                                    throws ContextException

      Throws:
        `ContextException`

    - #### addNormalListener

          protected boolean addNormalListener(java.lang.String context,
                                              java.lang.String name,
                                              ContextEventListener cel)

    - #### processOperationAddEventListener

          public void processOperationAddEventListener(java.lang.String id,
                                                       java.lang.String context,
                                                       java.lang.String name,
                                                       java.lang.Integer listener,
                                                       java.lang.String filter,
                                                       java.lang.String fingerprint,
                                                       OutgoingAggreGateCommand ans)

    - #### processOperationRemoveEventListener

          public void processOperationRemoveEventListener(java.lang.String id,
                                                          java.lang.String context,
                                                          java.lang.String name,
                                                          java.lang.Integer listenerHashCode,
                                                          java.lang.String filter,
                                                          java.lang.String fingerprint,
                                                          OutgoingAggreGateCommand ans)

    - #### processMessageStart

          public OutgoingAggreGateCommand processMessageStart(IncomingAggreGateCommand cmd,
                                                              OutgoingAggreGateCommand ans)

    - #### processMessageOperation

          protected OutgoingAggreGateCommand processMessageOperation(IncomingAggreGateCommand cmd,
                                                                     OutgoingAggreGateCommand ans)
                                                              throws SyntaxErrorException,
                                                                     ContextException

      Throws:
        `SyntaxErrorException`
        `ContextException`

    - #### addCustomListeners

          protected void addCustomListeners(Context con)

    - #### processMessage

          protected OutgoingAggreGateCommand processMessage(IncomingAggreGateCommand cmd,
                                                            OutgoingAggreGateCommand ans)
                                                     throws SyntaxErrorException,
                                                            ContextException

      Throws:
        `SyntaxErrorException`
        `ContextException`

    - #### processCommand

          public OutgoingAggreGateCommand processCommand(IncomingAggreGateCommand cmd)

    - #### shutdown

          public void shutdown()

      Overrides:
        `shutdown` in class `AbstractClientController<T extends CallerData>`

    - #### logoutUser

          protected void logoutUser()
                             throws ContextException

      Throws:
        `ContextException`

    - #### run

          public boolean run()

      Specified by:
        `run` in class `AbstractClientController<T extends CallerData>`

    - #### runImpl

          public void runImpl()
                       throws java.io.IOException,
                              DisconnectionException,
                              SyntaxErrorException

      Throws:
        `java.io.IOException`
        `DisconnectionException`
        `SyntaxErrorException`

    - #### getErrorDetails

          protected java.lang.String getErrorDetails(java.lang.Throwable error)

    - #### sendCommand

          public void sendCommand(OutgoingAggreGateCommand cmd)
                           throws DisconnectionException,
                                  java.io.IOException

      Throws:
        `DisconnectionException`
        `java.io.IOException`

    - #### createListener

          public ContextEventListener createListener(java.lang.Integer listenerHashCode,
                                                     Expression filter,
                                                     java.lang.String fingerprint)

    - #### getContext

          protected Context getContext(java.lang.String path)

    - #### controllerShouldHandle

          public abstract boolean controllerShouldHandle(Event ev,
                                                         ContextEventListener listener)
                                                  throws EventHandlingException

      Throws:
        `EventHandlingException`

    - #### getPendingEventsCount

          public int getPendingEventsCount()

    - #### getDiscardedEventsCount

          public long getDiscardedEventsCount()

    - #### discardEvent

          protected void discardEvent()

    - #### getDefaultEventListener

          public ContextEventListener getDefaultEventListener()

    - #### createClassicEncodingSettings

          protected ClassicEncodingSettings createClassicEncodingSettings(boolean useFormatCache)

    - #### constructEventCommand

          public OutgoingAggreGateCommand constructEventCommand(Event event,
                                                                java.lang.Integer listenerCode)

    - #### setFormatCache

          public void setFormatCache(FormatCache formatCache)

    - #### isConnected

          public boolean isConnected()

    - #### getAddress

          public java.lang.String getAddress()

    - #### newDataReceived

          public void newDataReceived()

      Specified by:
        `newDataReceived` in interface `CommandParserListener`

    - #### getStartMessageCount

          public long getStartMessageCount()

    - #### getLastDataTimestamp

          public java.lang.Long getLastDataTimestamp()

    - #### isJson

          public boolean isJson()