Class MessageHandler

java.lang.Object
org.medcare.igtl.network.MessageHandler
Direct Known Subclasses:
GenericServerResponseHandler

public abstract class MessageHandler extends Object
Perform request corresponding to the message received performRequest 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
  • Field Details

  • Constructor Details

    • MessageHandler

      public MessageHandler(Header header, byte[] body, ServerThread serverThread)
      Default MessageQueueManager constructor.
      Parameters:
      header - of the message
      body - of the message
      serverThread - serverThread object
  • Method Details

    • performRequest

      public boolean performRequest() throws Exception
      Perform the request job on the message performRequest methods must be 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 request 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
    • setHeader

      public void setHeader(Header header)
    • getHeader

      public Header getHeader()
    • setBody

      public void setBody(byte[] body)
    • getBody

      public byte[] getBody()