Class ResponseHandler

java.lang.Object
org.medcare.igtl.network.ResponseHandler
Direct Known Subclasses:
GenericClientResponseHandler

public abstract class ResponseHandler extends Object
Perform response data corresponding to the message received performResponse methods must be adapted corresponding to the need of each use User must adapt Capability list, to be able to send the right capability list and to have a correct error management for incorrect capability request User must use SetStatus method so it value correspond to the real status of the client. User must use GetStatus method to set
  • Constructor Details

    • ResponseHandler

      public ResponseHandler(Header header, byte[] body, OpenIGTClient openIGTClient)
      Default ResponseHandler constructor.
      Parameters:
      header - of the response
      body - of the response
      openIGTClient - openIGTClient object
  • Method Details

    • performResponse

      public boolean performResponse() throws Exception
      Perform the response job performResponse methods must be adapted corresponding to the need of each use
      Returns:
      True if response job performed successfully
      Throws:
      Exception - received by perform method
    • perform

      public abstract boolean perform(String messageType) throws Exception
      Perform the response job this method must be adapted for each use
      Parameters:
      messageType - The messageType
      Returns:
      True if response job performed successfully
      Throws:
      Exception - CrcException will be thrown at crc check during message unpacking Other exceptions can be thrown
    • manageError

      public abstract void manageError(String message, Exception exception, int errorCode)
      manage error this method must be adapted for each use
      Parameters:
      message - The message for error datail
      exception - The exception for error
      errorCode - The error Code
    • getCapability

      public ArrayList<String> getCapability()
      ** Gets the ArrayList of Types implemented in this Handler
    • setStatus

      public void setStatus(Status status)
      ** To set client status
      Parameters:
      status - **
    • getStatus

      public Status getStatus()
      ** To set client status **
      Returns:
      the status status
    • getBody

      public byte[] getBody()
    • setBody

      public void setBody(byte[] body)
    • getHeader

      public Header getHeader()
    • setHeader

      public void setHeader(Header header)
    • getOpenIGTClient

      public OpenIGTClient getOpenIGTClient()
    • setOpenIGTClient

      public void setOpenIGTClient(OpenIGTClient openIGTClient)
    • getCapabilityList

      public ArrayList<String> getCapabilityList()
    • setCapabilityList

      public void setCapabilityList(ArrayList<String> capabilityList)