Package com.isode.som

Class SomSession

java.lang.Object
com.isode.som.SomSession
Direct Known Subclasses:
SomPumiceSession, SomQmgrSession

public class SomSession extends Object
Class which implements a SOM connection between a client application and a SOM server - i.e. the Queue Manager or a Isode M-Store X.400 server. Functionality for opening and closing connections (including use of SASL is included.
Author:
tc
  • Field Details

  • Constructor Details

    • SomSession

      public SomSession()
      Create a new SomSession object
    • SomSession

      public SomSession(SomHandler handler)
      Create a new SomSession object.
      Parameters:
      handler - object which will handle command responses
  • Method Details

    • setProtocol

      public void setProtocol(String prot)
    • setConnectionTimeout

      public void setConnectionTimeout(int t)
      Set connection timeout.
      Parameters:
      t - timeout in seconds
    • getErrorText

      public static String getErrorText(int status)
      Obtain a string representation of a given error code.
      Parameters:
      status - error code
      Returns:
      string representation of error code
    • hasRight

      public boolean hasRight(SomSession.SomRights r)
    • getRights

      public String getRights()
    • isConnected

      public boolean isConnected()
      Test whether the session is connected
      Returns:
      true if connected
    • isConnecting

      public boolean isConnecting()
      Test whether we are in the process of establishing a connection.
      Returns:
      true if we are in the middle of connection establishment
    • isDisconnected

      public boolean isDisconnected()
      Test whether the session is disconnected
      Returns:
      true if not connected
    • isAsync

      public boolean isAsync()
      Test whether session is an asynchonous one
      Returns:
      true if asynchronous
    • setAsync

      public void setAsync(boolean async)
      Set session to be asynchronous
      Parameters:
      async - whether session should be asynchronous or not
    • getOpStatus

      public int getOpStatus()
      Get operation status value
      Returns:
      operation status
    • setOpStatus

      public void setOpStatus(int val)
      Set operation status
      Parameters:
      val - value to set
    • open

      public void open(String host, int port, String username, String password) throws SomException
      Open a connection, using SIMPLE authentication
      Parameters:
      host - hostname or IP address to connect to
      port - port to use
      username - username to use
      password - password to use
      Throws:
      SomException - on error
    • open

      public void open(String host, int port, String username, String password, String mechanism) throws SomException
      Open a connection using a specific SASL mechanism
      Parameters:
      host - hostname or IP address to connect to
      port - port to use
      username - username to use
      password - password to use
      mechanism - SASL mechanism to use
      Throws:
      SomException - on error
    • open

      public void open(String host, int port, String username, String password, String mechanism, boolean useTls) throws SomException
      Open a connection using a specific SASL mechanism over TLS
      Parameters:
      host - hostname or IP address to connect to
      port - port to use
      username - username to use
      password - password to use
      mechanism - SASL mechanism to use
      useTls - whether to use TLS or not
      Throws:
      SomException - on error
    • open

      public void open(String host, int port, String authid, String authzid, String password, String mechanism, boolean useTls) throws SomException
      Open a connection using a specific SASL mechanism over TLS
      Parameters:
      host - hostname or IP address to connect to
      port - port to use
      authid - authid to use
      authzid - authzid to use
      password - password to use
      mechanism - SASL mechanism to use
      useTls - whether to use TLS or not
      Throws:
      SomException - on error
    • somSessionDebugPrefix

      public void somSessionDebugPrefix(String prefix)
      The prefix given is used to name the SomSession thread, making it easy to indetify in a debugger.
      Parameters:
      prefix -
    • getPeerCertificates

      public List<com.isode.crypto.x509.SSLCertificate> getPeerCertificates()
      Get a list of the SSL Certificates which the server has returned when a TLS-encrypted connection is in use.
      Returns:
      list of SSLCertificates, or null if TLS not in use.
    • close

      public void close()
      Close an open connection
    • authenticated

      public boolean authenticated()
      Check whether the connection is authenticated or not
      Returns:
      true if authenticated connection
    • getSupportedMechanisms

      public String[] getSupportedMechanisms()
      Get the list of SASL mechanisms which this Queue Manager supports.
      Returns:
      list of mechanisms, which may be null
      Since:
      16.1
    • waitForCommand

      public void waitForCommand(long timeout) throws SomException
      Wait for some sort of response to come back to a command
      Parameters:
      timeout - length of time to wait
      Throws:
      SomException - on error
    • pauseResults

      public void pauseResults(boolean cache)
    • sendCommand

      public void sendCommand(SomCommand commandObj) throws SomException
      Send a command out over the wire
      Parameters:
      commandObj - Command object to send
      Throws:
      SomException - on error
    • sendCommand

      public void sendCommand(SomCommand commandObj, boolean withCrlfs) throws SomException
      Send a command out over the wire
      Parameters:
      commandObj - Command object to send
      withCrlfs - true if the command should be followed by CRLFs before sending, false otherwise
      Throws:
      SomException - on error
    • sendResponse

      public void sendResponse(SomCommand commandObj, String resp) throws SomException
      Send a response back to the server.
      Parameters:
      commandObj - Command object with which response is associated
      resp - Response string
      Throws:
      SomException - on error
    • registerLogMonitorCommand

      public void registerLogMonitorCommand(SomCommand commandObj) throws SomException
      Register a persistent handler for LOGMON responses
      Parameters:
      commandObj - Command object which handler is associated with
      Throws:
      SomException - on error
    • registerStoreMonitorCommand

      public void registerStoreMonitorCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerRecapListCommand

      public void registerRecapListCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorWriteCommand

      public void registerACP127MonitorWriteCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127CircuitDeleteCommand

      public void registerACP127CircuitDeleteCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127CircuitCreateCommand

      public void registerACP127CircuitCreateCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127CircuitUpdate

      public void registerACP127CircuitUpdate(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorReadCommand

      public void registerACP127MonitorReadCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorRateCommand

      public void registerACP127MonitorRateCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorReadMissCommand

      public void registerACP127MonitorReadMissCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorWriteMissCommand

      public void registerACP127MonitorWriteMissCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorMsgStatusCommand

      public void registerACP127MonitorMsgStatusCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonitorDataSameCommand

      public void registerACP127MonitorDataSameCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127OTAMStatusCommand

      public void registerACP127OTAMStatusCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127MonStatusCommand

      public void registerACP127MonStatusCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127AnonStatusCommand

      public void registerACP127AnonStatusCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • registerACP127NewMsgOutCommand

      public void registerACP127NewMsgOutCommand(SomCommand commandObj) throws SomException
      Throws:
      SomException
    • getHostName

      public String getHostName()
      Get the hostname for this session
      Returns:
      host name