cdac.medinfo.sdk.hl7282.hl7net.upperlayer

## Class Controller

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.hl7net.upperlayer.Controller

- All Implemented Interfaces:
    IClientStatusListener

      public class Controller
      extends java.lang.Object
      implements IClientStatusListener

  The Class SCPController.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Controller()` Instantiates a new sCP controller.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept(java.net.SocketAddress objSocketAddress, int itimeout)` Accepts the connection.
    `void` | `accept(java.net.Socket socket, int itimeout)` Accepts socket and starts client session at given socket.
    `void` | `close()` Closes the SCP Controller.
    `ISingleCollection<java.net.InetSocketAddress>` | `getClientsConnectionInfo()` Retrieves list of connection info for all currently active clients
    `IProcessHandler` | `getIProcessHandler()` Gets the IProcessHandler.
    `boolean` | `isClientConnected(java.net.InetSocketAddress objAddress)` Shows current status of client,whether it is active or not, for given Inet Socket Address
    `int` | `noOfClientsConnected()` Retrieves number of clients currently connected to Service Provider.
    `void` | `setBatchProcessor(IBatchProcessor objIBatchProcessor)` Sets the Batch Processor
    `void` | `setFragmentProcessor(IFragmentProcessor objIFragmentProcessor)` Sets the Fragment Processor
    `void` | `setIProcessHandler(IProcessHandler objIProcessHandler)` Sets the IProcessHandler.
    `void` | `setMLLPProcessor(IMLLP objIMLLP)` Sets the MLLP Processor.
    `void` | `setReadWriteLength(int iReadLength, int iWriteLength)` Sets max length limit of reading and writing.
    `void` | `setServerSideTransactionHandler(ITransactionHandler objServerSideTransactionHandler)` This will set the ITransactionHandler on Client session.
    `void` | `updateStatus(ClientSession objClientSession)` Update status.

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

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

- - ### Constructor Detail

    - #### Controller

          public Controller()
                     throws java.io.IOException

      Instantiates a new sCP controller.
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

  - ### Method Detail

    - #### setReadWriteLength

          public void setReadWriteLength(int iReadLength,
                                int iWriteLength)

      Sets max length limit of reading and writing.
      Parameters:
        `iReadLength` - value of Reading max length
        `iWriteLength` - value of Writing max length

    - #### setFragmentProcessor

          public void setFragmentProcessor(IFragmentProcessor objIFragmentProcessor)

      Sets the Fragment Processor
      Parameters:
        `objIFragmentProcessor` - the objIFragmentProcessor to set

    - #### setMLLPProcessor

          public void setMLLPProcessor(IMLLP objIMLLP)

      Sets the MLLP Processor.
      Parameters:
        `objIMLLP` - the MLLP to set.

    - #### setBatchProcessor

          public void setBatchProcessor(IBatchProcessor objIBatchProcessor)

      Sets the Batch Processor
      Parameters:
        `objIBatchProcessor` - the objIBatchProcessor to set

    - #### getIProcessHandler

          public IProcessHandler getIProcessHandler()

      Gets the IProcessHandler.
      Returns:
        IProcessHandler the IProcessHandler

    - #### setIProcessHandler

          public void setIProcessHandler(IProcessHandler objIProcessHandler)

      Sets the IProcessHandler.
      Parameters:
        `objIProcessHandler` - new IIProcessHandler

    - #### setServerSideTransactionHandler

          public void setServerSideTransactionHandler(ITransactionHandler objServerSideTransactionHandler)

      This will set the ITransactionHandler on Client session.
      Parameters:
        `objServerSideTransactionHandler` - - implementor of ITransactionHandler

    - #### accept

          public void accept(java.net.SocketAddress objSocketAddress,
                    int itimeout)
                      throws java.io.IOException

      Accepts the connection. For each connected client it creates a client session and perform call back to user process handler. If user sets the acceptance status as true for that client session only then it proceeds further else that request will be rejected and connection will be closed.
      Parameters:
        `objSocketAddress` - object of Socket Address.
        `itimeout` - timeout period for which connection could be idle
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### accept

          public void accept(java.net.Socket socket,
                    int itimeout)
                      throws java.io.IOException

      Accepts socket and starts client session at given socket.
      Parameters:
        `socket` - Specifies socket to accept connection.
        `itimeout` - timeout period for which connection could be idle.
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### updateStatus

          public void updateStatus(ClientSession objClientSession)

      Update status.
      Specified by:
        `updateStatus` in interface `IClientStatusListener`
      Parameters:
        `objClientSession` - the obj client session

    - #### noOfClientsConnected

          public int noOfClientsConnected()

      Retrieves number of clients currently connected to Service Provider.
      Returns:
        int - no. of Clients connected

    - #### isClientConnected

          public boolean isClientConnected(java.net.InetSocketAddress objAddress)

      Shows current status of client,whether it is active or not, for given Inet Socket Address
      Parameters:
        `objAddress` - InetSocketAddress of client
      Returns:
        boolean - shows status as true or false.

    - #### getClientsConnectionInfo

          public ISingleCollection<java.net.InetSocketAddress> getClientsConnectionInfo()

      Retrieves list of connection info for all currently active clients
      Returns:
        ISingleCollection - list of InetSocketAddress for all active clients

    - #### close

          public void close()
                     throws java.io.IOException

      Closes the SCP Controller.
      Throws:
        `java.io.IOException`