Package com.isode.som

Class SomCommand

java.lang.Object
com.isode.som.SomCommand
All Implemented Interfaces:
SomResponseProcessor
Direct Known Subclasses:
SomPumiceCommand, SomQmgrCommand

public abstract class SomCommand extends Object implements SomResponseProcessor
Class which represents a generic SOM command.
Author:
tc
  • Field Details

  • Constructor Details

    • SomCommand

      public SomCommand(SomSession sess)
      Create a new SomCommand object.
      Parameters:
      sess - SomSession to use for command
    • SomCommand

      public SomCommand(SomSession sess, SomHandler handler)
      Create a new SomCommand object.
      Parameters:
      sess - SomSession to use for command which must not be null
      handler - SomHandler which will be used during session establishment which must not be null
    • SomCommand

      public SomCommand(SomSession sess, SomHandler handler, SomCommandListener listener)
      Create a new SomCommand object.
      Parameters:
      sess - SomSession to use for command
      handler - SomHandler which be will used during session establishment which must not be null
      listener - SomCommandListener which will handle results and error info which may be null
  • Method Details

    • dispatch

      public void dispatch() throws SomException
      Send off a command once constructed. Wait for a response if we are operating synchronously.
      Throws:
      SomException - Indicating a problem with the command
    • getSession

      protected SomSession getSession()
      Obtain the SomSession object with which a command is associated.
      Returns:
      SomSession object
    • processResponse

      public void processResponse(String commandData, byte[] data, int status)
      Process response to command.
      Specified by:
      processResponse in interface SomResponseProcessor
    • getCommandString

      protected String getCommandString() throws SomException
      Returns:
      The command string to be sent over the wire.
      Throws:
      SomException - Indicating a problem with the command
    • notifyListener

      public void notifyListener(int status)
      Tell the command listener about an event.
      Parameters:
      status - the status code
    • notifyListener

      public void notifyListener(int status, String detail)
      Tell the command listener about an event which includes a detail string
      Parameters:
      status - the status code
      detail - which must not be null
    • notifyListener

      public void notifyListener(int status, String[] pairs)
      Tell the listener about an event which includes an array of data pairs
      Parameters:
      status - the status code
      pairs - which must not be null