JsonNioService
Date: 2019-10-22

org.openscience.jmol.app.jsonkiosk

## Class JsonNioService

- java.lang.Object
- - naga.NIOService
  - - org.openscience.jmol.app.jsonkiosk.JsonNioService

- All Implemented Interfaces:
    JsonNioServer

      public class JsonNioService
      extends naga.NIOService
      implements JsonNioServer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `JsonNioService.JsonNioServerThread`
    `protected class` | `JsonNioService.JsonNioThread`
    `(package private) class` | `JsonNioService.JSONObject`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private JsonNioClient` | `client`
    `private boolean` | `contentDisabled`
    `private java.lang.String` | `contentPath`
    `protected boolean` | `halt`
    `private naga.NIOSocket` | `inSocket`
    `protected boolean` | `isPaused`
    `protected long` | `latestMoveTime`
    `private boolean` | `motionDisabled`
    `protected java.lang.String` | `myName`
    `private int` | `nFast`
    `protected naga.NIOSocket` | `outSocket`
    `protected int` | `port`
    `private long` | `previousMoveTime`
    `private java.lang.String` | `resetMessage`
    `private naga.NIOServerSocket` | `serverSocket`
    `private java.lang.Thread` | `serverThread`
    `private int` | `swipeCount`
    `private float` | `swipeCutoff`
    `private float` | `swipeDelayMs`
    `private float` | `swipeFactor`
    `private long` | `swipeStartTime`
    `private java.lang.String` | `terminatorMessage`
    `private java.lang.Thread` | `thread`
    `protected int` | `version`
    `(package private) Viewer` | `vwr`
    `private boolean` | `wasSpinOn`

    - ### Fields inherited from class naga.NIOService

      `DEFAULT_IO_BUFFER_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsonNioService()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `static java.lang.String` | `getJmolValueAsString(Viewer vwr, java.lang.String var)`
    `int` | `getPort()`
    `protected void` | `initialize(java.lang.String role, naga.NIOSocket nioSocket)`
    `protected void` | `pauseScript(boolean isPause)`
    `private void` | `processJSON(JsonNioService.JSONObject json, java.lang.String msg)`
    `protected void` | `processMessage(byte[] packet, naga.NIOSocket socket)`
    `void` | `scriptCallback(java.lang.String msg)` from StatusManager
    `void` | `send(int port, java.lang.String msg)` from JmolPanel and SYNC command
    `private void` | `sendMessage(JsonNioService.JSONObject json, java.lang.String msg, naga.NIOSocket socket)`
    `private void` | `sendScript(java.lang.String script)`
    `private void` | `setBanner(java.lang.String bannerText, boolean andCenter)`
    `private void` | `setEnabled()`
    `private void` | `startServerService()`
    `void` | `startService(int port, JsonNioClient client, Viewer jmolViewer, java.lang.String name, int version)`
    `private void` | `syncScript(java.lang.String script)`

    - ### Methods inherited from class naga.NIOService

      `getBufferSize, getQueue, isOpen, notifyException, openServerSocket, openServerSocket, openServerSocket, openSocket, openSocket, openSSLServerSocket, openSSLServerSocket, openSSLServerSocket, openSSLSocket, openSSLSocket, queue, selectBlocking, selectBlocking, selectNonBlocking, setBufferSize, setExceptionObserver, wakeup`

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

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

- - ### Field Detail

    - #### myName

          protected java.lang.String myName

    - #### halt

          protected boolean halt

    - #### isPaused

          protected boolean isPaused

    - #### latestMoveTime

          protected long latestMoveTime

    - #### port

          protected int port

    - #### thread

          private java.lang.Thread thread

    - #### serverThread

          private java.lang.Thread serverThread

    - #### inSocket

          private naga.NIOSocket inSocket

    - #### outSocket

          protected naga.NIOSocket outSocket

    - #### serverSocket

          private naga.NIOServerSocket serverSocket

    - #### vwr

          Viewer vwr

    - #### client

          private JsonNioClient client

    - #### wasSpinOn

          private boolean wasSpinOn

    - #### contentPath

          private java.lang.String contentPath

    - #### terminatorMessage

          private java.lang.String terminatorMessage

    - #### resetMessage

          private java.lang.String resetMessage

    - #### version

          protected int version

    - #### nFast

          private int nFast

    - #### swipeCutoff

          private float swipeCutoff

    - #### swipeCount

          private int swipeCount

    - #### swipeDelayMs

          private float swipeDelayMs

    - #### previousMoveTime

          private long previousMoveTime

    - #### swipeStartTime

          private long swipeStartTime

    - #### swipeFactor

          private float swipeFactor

    - #### motionDisabled

          private boolean motionDisabled

    - #### contentDisabled

          private boolean contentDisabled

  - ### Constructor Detail

    - #### JsonNioService

          public JsonNioService()
                         throws java.io.IOException

      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### scriptCallback

          public void scriptCallback(java.lang.String msg)

      Description copied from interface: `JsonNioServer`
      from StatusManager
      Specified by:
        `scriptCallback` in interface `JsonNioServer`

    - #### getPort

          public int getPort()

      Specified by:
        `getPort` in interface `JsonNioServer`

    - #### send

          public void send(int port,
                           java.lang.String msg)

      Description copied from interface: `JsonNioServer`
      from JmolPanel and SYNC command
      Specified by:
        `send` in interface `JsonNioServer`

    - #### startService

          public void startService(int port,
                                   JsonNioClient client,
                                   Viewer jmolViewer,
                                   java.lang.String name,
                                   int version)
                            throws java.io.IOException

      Specified by:
        `startService` in interface `JsonNioServer`
      Throws:
        `java.io.IOException`

    - #### setEnabled

          private void setEnabled()

    - #### getJmolValueAsString

          public static java.lang.String getJmolValueAsString(Viewer vwr,
                                                              java.lang.String var)

    - #### close

          public void close()

      Specified by:
        `close` in interface `JsonNioServer`
      Overrides:
        `close` in class `naga.NIOService`

    - #### initialize

          protected void initialize(java.lang.String role,
                                    naga.NIOSocket nioSocket)

    - #### startServerService

          private void startServerService()

    - #### processMessage

          protected void processMessage(byte[] packet,
                                        naga.NIOSocket socket)

    - #### processJSON

          private void processJSON(JsonNioService.JSONObject json,
                                   java.lang.String msg)
                            throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### sendScript

          private void sendScript(java.lang.String script)

    - #### syncScript

          private void syncScript(java.lang.String script)

    - #### setBanner

          private void setBanner(java.lang.String bannerText,
                                 boolean andCenter)

    - #### pauseScript

          protected void pauseScript(boolean isPause)

    - #### sendMessage

          private void sendMessage(JsonNioService.JSONObject json,
                                   java.lang.String msg,
                                   naga.NIOSocket socket)