Class SomQmgrChannel

java.lang.Object
com.isode.som.qmgr.objects.SomQmgrObject
com.isode.som.qmgr.objects.SomQmgrChannel
All Implemented Interfaces:
SomQmgrHandler, SomHandler

public class SomQmgrChannel extends SomQmgrObject implements SomQmgrHandler
This class models a Channel within M-Switch.
Author:
tc
  • Constructor Details

    • SomQmgrChannel

      public SomQmgrChannel(SomSession session)
      Create a new SOM Qmgr Channel object
      Parameters:
      session - Session within which to create channel which cannot be null
    • SomQmgrChannel

      public SomQmgrChannel(SomSession session, String[] pairs)
      Create a new SOM Qmgr Channel object, populating it
      Parameters:
      session - Session within which to create channel which cannot be null
      pairs - type/value pairs
  • Method Details

    • setSomVersion

      public void setSomVersion(Integer v)
      Set the SOM version number for the channel - this controls how the FORCE command is implemented.
      Parameters:
      v - Som version number
    • removeFromArray

      public void removeFromArray(ArrayList<SomQmgrChannel> channels)
      Remove this channel from the array of channels passed in.
      Parameters:
      channels - Array of channels which may not be null
    • getMtas

      public SomQmgrMta[] getMtas()
      Return an array containing the MTA objects which are subordinate to this channel.
      Returns:
      Array of subordinate MTAs which will not be null
    • getMessages

      public SomQmgrMessage[] getMessages()
      Return an array containing the Message objects which are subordinate to this channel.
      Returns:
      Array of subordinate Messages which will not be null
    • handleBindResponse

      public void handleBindResponse(int status, String detail)
      Description copied from interface: SomHandler
      Handle the response to a Bind operation
      Specified by:
      handleBindResponse in interface SomHandler
      Parameters:
      status - operation status
      detail - error detail on failure
    • handleResponse

      public void handleResponse(SomCommand command, int status, String detail)
      Description copied from interface: SomQmgrHandler
      Handles the response to control commands which return an OK/error response plus an info string
      Specified by:
      handleResponse in interface SomHandler
      Specified by:
      handleResponse in interface SomQmgrHandler
      Parameters:
      command - the SOM command
      status - operation status
      detail - detail on error
    • handleResponse

      public void handleResponse(SomCommand command, int status, String[] pairs)
      Description copied from interface: SomQmgrHandler
      Handles the response to commands which return data about the current object - i.e. we are refreshing an existing object.
      Specified by:
      handleResponse in interface SomQmgrHandler
      Parameters:
      command - the SOM command
      status - operation status
      pairs - data pairs
    • handleResponse

      public void handleResponse(SomCommand command, int status, SomQmgrMta object)
      Description copied from interface: SomQmgrHandler
      Handles the response to commands which return a list of MTA objects
      Specified by:
      handleResponse in interface SomQmgrHandler
      Parameters:
      command - the SOM command
      status - operation status
      object - a SOM Qmgr MTA object
    • handleResponse

      public void handleResponse(SomCommand command, int status, SomQmgrMessage object)
      Description copied from interface: SomQmgrHandler
      Handles the response to commands which return a list of message objects
      Specified by:
      handleResponse in interface SomQmgrHandler
      Parameters:
      command - the SOM command
      status - operation status
      object - a qmgr message object
    • handleResponse

      public void handleResponse(SomCommand command, int status, SomQmgrQueueManager object)
    • handleResponse

      public void handleResponse(SomCommand command, int status, SomQmgrChannel object)
      Description copied from interface: SomQmgrHandler
      Handles the response to commands which return a list of channel objects
      Specified by:
      handleResponse in interface SomQmgrHandler
      Parameters:
      command - the SOM command
      status - operation status
      object - a channel object
    • handleResponse

      public void handleResponse(SomCommand obj, int status, SomMessage msg)
      Description copied from interface: SomQmgrHandler
      Handles the response to commands which return a SomMessage object (i.e. read from the Queue or Archive).
      Specified by:
      handleResponse in interface SomQmgrHandler
      Parameters:
      obj - the SOM command
      status - operation status
      msg - a message object
    • isConnecting

      public boolean isConnecting(String mtaName) throws SomException
      Test whether this channel has a specific subordinate MTA which is currently connecting to a peer MTA
      Parameters:
      mtaName - name of MTA to test which may not be null
      Returns:
      true if this MTA exists and is currently connecting
      Throws:
      SomException - on error
    • isConnected

      public boolean isConnected(String mtaName) throws SomException
      Checks local cache of channel values to see if there is an outbound Association with the MTA given in mtaName
      Parameters:
      mtaName - the String representation of the external MTA. Must not be null.
      Returns:
      either true or false.
      Throws:
      SomException - is thrown if there is a problem reading the outboundAssociations value.
    • outAssocConnections

      public int outAssocConnections(String mtaName) throws SomException
      Returns number of out bound Associations to this MTA
      Parameters:
      mtaName - Name of mta to check.
      Returns:
      Number of out bound assoc
      Throws:
      SomException - on error
    • inAssocConnections

      public int inAssocConnections(String mtaName) throws SomException
      Returns number of in bound Associations to this MTA
      Parameters:
      mtaName - Name of MTA to check
      Returns:
      number of inbound associations
      Throws:
      SomException - on error
    • clearMTADelay

      public void clearMTADelay(String mtaName, SomCommandListener listener) throws SomException
      Sends a SOM command to clear a delay associated with a particular MTA.
      Parameters:
      mtaName - String representation of the external MTA, this channel is associated with, whose delay needs to be cleared. Must not be null.
      listener - SomCommandListener who will be called to handle the SOM response. Must not be null.
      Throws:
      SomException - is thrown if MTA delay cannot be cleared.
    • reprocess

      public void reprocess(SomCommandListener listener) throws SomException
      Perform a Reprocess operation on all Peer MTAs under this channel, or directly on any messages queued
      Parameters:
      listener - Listener to notify when operation is complete, which may be null
      Throws:
      SomException - on error
    • getMTAError

      public String getMTAError(String mtaName) throws SomException
      Returns the MTA refusal text for an MTA associated with this channel.
      Parameters:
      mtaName - The string representation of the external MTA. Must not be null.
      Returns:
      The last refuse Text.
      Throws:
      SomException - is thrown if the refuse text cannot be returned. This typically happens when there is no refuse text.
    • getMTA

      public SomQmgrMta getMTA(String mtaName) throws SomException
      Returns a SomQmgrMta object representing the external MTA this channel is connected to.
      Parameters:
      mtaName - String representation of the external MTA. Must not be null.
      Returns:
      SomQmgrMta object representing the external MTA this channel is connected to.
      Throws:
      SomException - Thrown if we are not connected to the specified MTA.
    • disconnect

      public void disconnect(String mtaName, SomCommandListener listener) throws SomException
      Disconnect this channel from the specified MTA. The SomCommandListener is called to handle the response.
      Parameters:
      mtaName - The string representation of the MTA we are disconnecting Must not be null.
      listener - The SomCommandListener called when we have a response. Must not be null.
      Throws:
      SomException - Thrown is we can't find an association, or disconnect.
    • getStatus

      public void getStatus(SomCommandListener listener) throws SomException
      Get the current status of this Channel.
      Parameters:
      listener - Listener object which will be notified when update complete which may be null
      Throws:
      SomException - on error
    • getSubordinates

      public void getSubordinates(SomCommandListener listener, Integer mtaSizeLimit, Integer messageSizeLimit) throws SomException
      Interrogate the channel object for its current set of subordinate MTAs or Messages
      Parameters:
      listener - Listener object which will be notified when update complete which may be null
      mtaSizeLimit - Specifies the maximum number of MTAs to be returned. May not be null.
      messageSizeLimit - Specifies the maximum number of Message to be returned. May not be null.
      Throws:
      SomException - on error
    • getSubordinateMessages

      public void getSubordinateMessages(SomCommandListener listener, Integer sizelimit) throws SomException
      Interrogate the channel object for its current set of subordinate Messages
      Parameters:
      listener - Listener object which will be notified when update complete which may be null
      sizelimit - Specifies the maximum number of Message to be returned. May not be null.
      Throws:
      SomException - on error
    • buildInfoString

      public String buildInfoString()
      Generate an information string for the channel object
      Returns:
      Info string containing name, number of messages etc
    • clear

      public void clear(SomCommandListener listener) throws SomException
      Sends a command to clear any delay on the channel.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • clearMtas

      public void clearMtas(SomCommandListener listener) throws SomException
      Sends a command to clear any delay on the channel's subordinate MTAs.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • clearMessages

      public void clearMessages(SomCommandListener listener) throws SomException
      Sends a command to clear any delay on the channel's subordinate Messages.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • enable

      public void enable(SomCommandListener listener) throws SomException
      Sends a command to enable the channel.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • disable

      public void disable(SomCommandListener listener) throws SomException
      Sends a command to disable the channel.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • delay

      public void delay(int mins, SomCommandListener listener) throws SomException
      Sends a command to delay the channel by a specified number of minutes.
      Parameters:
      mins - Number of minutes by which to delay channel
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • connect

      public void connect(String mtaname, SomCommandListener listener) throws SomException
      Sends a command to connect the channel to the specified MTA
      Parameters:
      mtaname - Name of peer MTA to which to connect
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • downwardsforce

      public void downwardsforce(SomCommandListener listener) throws SomException
      Performs a "downwards force" on the channel - i.e. clear any delay on the channel and its subordinate objects.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • disconnect

      public void disconnect(SomCommandListener listener) throws SomException
      Disconnect any peer MTAs which we are currently connected to.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • enableInbound

      public void enableInbound(SomCommandListener listener) throws SomException
      Enable the channel to accept inbound connection.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • disableInbound

      public void disableInbound(SomCommandListener listener) throws SomException
      Disable the channel from accepting inbound connection.
      Parameters:
      listener - Listener object which will be notified when operation completes which may be null
      Throws:
      SomException - on error
    • channel

      public String channel() throws SomException
      Get the name of the channel.
      Returns:
      channel name
      Throws:
      SomException - on error
    • channelDescription

      public String channelDescription() throws SomException
      Get the channel's description string
      Returns:
      description of channel
      Throws:
      SomException - on error
    • cachedUntil

      public String cachedUntil() throws SomException
      Get a UTC Time String giving the time which the channel is delayed until
      Returns:
      Time until which channel is delayed
      Throws:
      SomException - on error
    • isDelayed

      public boolean isDelayed()
      Uses the cachedUntil() to tell if channel is delayed.
      Returns:
      true if there is a delay, otherwise false.
    • chantype

      public String chantype() throws SomException
      Get channel type as a string
      Returns:
      String indicating channel type
      Throws:
      SomException - on error
    • chanTypeInt

      public int chanTypeInt() throws SomException
      Returns:
      0 == mta, 1 == mts, 2==internal, 3==passive
      Throws:
      SomException
    • direction

      public String direction() throws SomException
      Get channel direction string
      Returns:
      channel direction as string
      Throws:
      SomException - on error
    • directionInt

      public int directionInt() throws SomException
      Returns:
      channel direction as int. 1 == inbound, 2 == outbound, 3 == both
      Throws:
      SomException
    • enabled

      public String enabled() throws SomException
      Get string saying whether channel is enabled or not
      Returns:
      "True" if channel enabled, "False" otherwise
      Throws:
      SomException - on error
    • enabledBool

      public boolean enabledBool() throws SomException
      Get boolean indicating if channel is enabled
      Returns:
      true if channel enabled
      Throws:
      SomException - on error
    • lastAttempt

      public String lastAttempt() throws SomException
      Get UTC Time String indicating time of last connection attempt made by channel
      Returns:
      time of last connection attempt
      Throws:
      SomException - on error
    • lastSuccess

      public String lastSuccess() throws SomException
      Get UTC Time String indicating time of last successful connection attempt made by channel
      Returns:
      time of last successful connection attempt
      Throws:
      SomException - on error
    • maxProcs

      public Integer maxProcs() throws SomException
      Get maximum processes value for channel
      Returns:
      maximum processes allowed for channel
      Throws:
      SomException - on error
    • numberActiveProcesses

      public Integer numberActiveProcesses() throws SomException
      Get current number of active processes on channel
      Returns:
      active processes on channel
      Throws:
      SomException - on error
    • numberMessages

      public Integer numberMessages() throws SomException
      Get current number of messages queued on channel
      Returns:
      number messages on channel
      Throws:
      SomException - on error
    • numberMtas

      public Integer numberMtas() throws SomException
      Get current number of peer MTAs on channel
      Returns:
      number of peer MTAs on channel
      Throws:
      SomException - on error
    • numberReports

      public Integer numberReports() throws SomException
      Get current number of reports queued on channel
      Returns:
      number of reports on channel
      Throws:
      SomException - on error
    • oldestMessage

      public String oldestMessage() throws SomException
      Get age of oldest message queued on channel
      Returns:
      age of oldest message on channel, as UTC Time String
      Throws:
      SomException - on error
    • volumeMessages

      public Integer volumeMessages() throws SomException
      Get volume of messages queued on channel
      Returns:
      Volume of messages (bytes) queued on channel
      Throws:
      SomException - on error
    • addressesIn

      public Integer addressesIn() throws SomException
      Get the number of inbound addresses which this channel has deal with
      Returns:
      Number of inbound addresses handled
      Throws:
      SomException - on error
    • addressesOut

      public Integer addressesOut() throws SomException
      Get the number of outbound addresses which this channel has processed
      Returns:
      Number of outbound addresses handled
      Throws:
      SomException - on error
    • creationTime

      public String creationTime() throws SomException
      Get the time at which the channel was created
      Returns:
      Creation time as UTC Time String
      Throws:
      SomException - on error
    • errorCount

      public Integer errorCount() throws SomException
      Get a count of the number of error which the channel has encountered
      Returns:
      Count of errors handled
      Throws:
      SomException - on error
    • enabledInboundBool

      public boolean enabledInboundBool() throws SomException
      Test whether the channel is enabled for inbound connections.
      Returns:
      true if enabled inbound
      Throws:
      SomException - on error
    • enabledInbound

      public String enabledInbound() throws SomException
      Test whether the channel is enabled for inbound connections.
      Returns:
      string "True" if enabled inbound, else "fFalse"
      Throws:
      SomException - on error
    • failedConversions

      public Integer failedConversions() throws SomException
      Get count of failed conversions. Only relevant if channel is a shaper.
      Returns:
      Count of failed conversions
      Throws:
      SomException - on error
    • failedOutAssoc

      public Integer failedOutAssoc() throws SomException
      Get count of failed outbound connections
      Returns:
      number of failed outbound connections
      Throws:
      SomException - on error
    • hierarchy

      public Integer hierarchy() throws SomException
      Get the channel hierarchy value
      Returns:
      Channel hierarchy
      Throws:
      SomException - on error
    • inAssoc

      public Integer inAssoc() throws SomException
      Get number of current inbound associations
      Returns:
      Number of current inbound associations
      Throws:
      SomException - on error
    • index

      public Integer index() throws SomException
      Get the channel index number
      Returns:
      Channel index
      Throws:
      SomException - on error
    • lastInboundTime

      public String lastInboundTime() throws SomException
      Get the time of the last inbound association
      Returns:
      Time of last inbound association (UTC Time String)
      Throws:
      SomException - on error
    • lastOutboundTime

      public String lastOutboundTime() throws SomException
      Get the time of the last outbound association
      Returns:
      Time of last outbound association (UTC Time String)
      Throws:
      SomException - on error
    • loopsDetected

      public Integer loopsDetected() throws SomException
      Get a count of the number of loops detected.
      Returns:
      Count of loops detected
      Throws:
      SomException - on error
    • messagesIn

      public Integer messagesIn() throws SomException
      Get total number of messages that have been transfered in.
      Returns:
      Total number of messages that have bee transfered in.
      Throws:
      SomException - on error
    • messagesOut

      public Integer messagesOut() throws SomException
      Get total number of messages that have been transfered out.
      Returns:
      Total number of messages that have been transfered out.
      Throws:
      SomException - on error
    • oldestMessageId

      public String oldestMessageId() throws SomException
      Get the queueid of the oldest message on the channel
      Returns:
      The queueid of the oldest message on the channel
      Throws:
      SomException - on error
    • outboundAssociations

      public Integer outboundAssociations() throws SomException
      Get the current number of outbound associations
      Returns:
      Number of outbound associations
      Throws:
      SomException - on error
    • numberProcesses

      public Integer numberProcesses() throws SomException
      Get the number of channel processes currently running
      Returns:
      Number of channel processes running
      Throws:
      SomException - on error
    • protocol

      public String protocol() throws SomException
      Get channel protocol identifier (OID string)
      Returns:
      Channel protocol id as OID string
      Throws:
      SomException - on error
    • receivedVolume

      public Integer receivedVolume() throws SomException
      Get total volume of received messages (bytes)
      Returns:
      Total volume of received messages in bytes
      Throws:
      SomException - on error
    • refuseStatus

      public String refuseStatus() throws SomException
      Get last outbound connection refusal status as x.y.z string
      Returns:
      Last connection refusal status
      Throws:
      SomException - on error
    • refuseText

      public String refuseText() throws SomException
      Get last outbound connection refusal reason text
      Returns:
      Last connection refusal reason text
      Throws:
      SomException - on error
    • refuseTime

      public String refuseTime() throws SomException
      Get last outbound connection refusal time
      Returns:
      Last connection refusal time (UTC Time String)
      Throws:
      SomException - on error
    • rejectTime

      public String rejectTime() throws SomException
      Get last inbound connection reject time
      Returns:
      Last connection reject time (UTC Time String)
      Throws:
      SomException - on error
    • rejectedAssoc

      public Integer rejectedAssoc() throws SomException
      Get number of rejected inbound connections
      Returns:
      Total number of rejected inbound connections
      Throws:
      SomException - on error
    • rejectedMessage

      public Integer rejectedMessage() throws SomException
      Get number of rejected inbound messages
      Returns:
      Total number of rejected inbound messages
      Throws:
      SomException - on error
    • rejectStatus

      public Integer rejectStatus() throws SomException
      Get last inbound connection rejection status as x.y.z string
      Returns:
      Last inbound connection rejection status
      Throws:
      SomException - on error
    • rejectText

      public String rejectText() throws SomException
      Get last inbound connection rejection text
      Returns:
      Last inbound connection rejection text
      Throws:
      SomException - on error
    • storedRecipients

      public Integer storedRecipients() throws SomException
      Get the number of stored recipients
      Returns:
      Number of stored recipients
      Throws:
      SomException - on error
    • successfulConversions

      public Integer successfulConversions() throws SomException
      Get the number of successful conversions (for a shaper channel)
      Returns:
      Number of successful conversions
      Throws:
      SomException - on error
    • totalInAssoc

      public Integer totalInAssoc() throws SomException
      Get total number of inbound associations
      Returns:
      Total number of inbound associations
      Throws:
      SomException - on error
    • totalOutAssoc

      public Integer totalOutAssoc() throws SomException
      Get total number of outbound associations
      Returns:
      Total number of outbound associations
      Throws:
      SomException - on error
    • transmittedVolume

      public Integer transmittedVolume() throws SomException
      Get total volume of transmitted messages
      Returns:
      Total volume of transmitted messages (bytes)
      Throws:
      SomException - on error
    • minimisePriority

      public Integer minimisePriority() throws SomException
      Get current MINIMISE priority for channel
      Returns:
      Current MINIMISE priority
      Throws:
      SomException - on error
    • minimiseStart

      public String minimiseStart() throws SomException
      Get current MINIMISE start time for channel
      Returns:
      Current MINIMISE start time (UTC Time String)
      Throws:
      SomException - on error
    • minimiseStop

      public String minimiseStop() throws SomException
      Get current MINIMISE stop time for channel
      Returns:
      Current MINIMISE stop time (UTC Time String)
      Throws:
      SomException - on error
    • minimise

      public void minimise(int priority, Date start, Date stop, SomCommandListener listener) throws SomException
      Invoke a MINIMISE operation on this channel
      Parameters:
      priority - MINIMISE priority
      start - Start time which may be null
      stop - Stop time which may be null
      listener - Listener object which will be notified when complete which may be null
      Throws:
      SomException - on error
    • deleteMessages

      public void deleteMessages(SomCommandListener listener) throws SomException
      Delete all the messages on this channel
      Parameters:
      listener - Listener object which will be notified when complete which may be null
      Throws:
      SomException - on error
    • nondeliverMessages

      public void nondeliverMessages(String reason, SomCommandListener listener) throws SomException
      Non-deliver all the messages on this channel
      Parameters:
      reason - Reason string for non-delivery which may not be null
      listener - Listener object which will be notified when complete which may be null
      Throws:
      SomException - on error
    • timeoutMessages

      public void timeoutMessages(SomCommandListener listener) throws SomException
      Time out all the messages on this channel
      Parameters:
      listener - Listener object which will be notified when complete which may be null
      Throws:
      SomException - on error