Class Transmission

java.lang.Object
org.astrogrid.samp.gui.Transmission

public class Transmission extends Object
Describes the properties of a message which has been sent from one client to another. Methods which might change the state of instances of this class should be invoked only from the AWT event dispatch thread.
Since:
20 Nov 2008
Author:
Mark Taylor
  • Constructor Details

    • Transmission

      public Transmission(Client sender, Client receiver, Message msg, String msgTag, String msgId)
      Constructor.
      Parameters:
      sender - sender
      receiver - receiver
      msg - message
      msgTag - message tag
      msgId - message ID
  • Method Details

    • getSender

      public Client getSender()
      Returns the client which sent this transmission.
      Returns:
      sender
    • getReceiver

      public Client getReceiver()
      Returns the client to which this transmission was sent.
      Returns:
      receiver
    • getMessage

      public Message getMessage()
      Returns the message which was sent.
      Returns:
      message
    • getMessageTag

      public String getMessageTag()
      Returns the message tag corresponding to this transmission. Will be null for notify-type sends.
      Returns:
      msg tag
    • getMessageId

      public String getMessageId()
      Returns the message ID associated with this message. This is the identifier passed to the receiver which it uses to match messages with responses; it will be null iff the transmission used the notify delivery pattern (no response expected).
      Returns:
      msgId; possibly null
    • setResponse

      public void setResponse(Response response)
      Sets the response for this transmission.
      Parameters:
      response - response
    • getResponse

      public Response getResponse()
      Returns the response for this transmission. Will be null if no response has (yet) arrived.
      Returns:
      response
    • setError

      public void setError(Throwable error)
      Associates an error with this transmission. This is probably an indication that the send failed or some other non-SAMP event intervened to prevent normal resolution.
      Parameters:
      error - throwable causing the failure
    • getError

      public Throwable getError()
      Returns a Throwable which prevented normal resolution of this transmission.
      Returns:
      error
    • setSenderUnregistered

      public void setSenderUnregistered()
      Indicates that the sender of this transmission has unregistered.
    • setReceiverUnregistered

      public void setReceiverUnregistered()
      Indicates that the receiver of this transmission has unregistered.
    • getDoneTime

      public long getDoneTime()
      Returns the epoch at which this transmission was completed. If it is still pending (isDone()==false), the returned value will be (way) in the future.
      Returns:
      value of System.currentTimeMillis() at which isDone() first returned true
    • isDone

      public boolean isDone()
      Indicates whether further changes to the state of this object are expected, that is if a response/failure is yet to be received.
      Returns:
      true iff no further changes are expected
    • getStatus

      public Transmission.Status getStatus()
      Returns an object which describes the current status of this transmission in terms which can be presented to the GUI.
    • addChangeListener

      public void addChangeListener(ChangeListener listener)
      Adds a listener which will be notified if the state of this transmission changes (if a response or failure is signalled). The ChangeEvents sent to these listeners will have a source which is this Transmission.
      Parameters:
      listener - listener to add
    • removeChangeListener

      public void removeChangeListener(ChangeListener listener)
      Removes a listener previously added by addChangeListener(javax.swing.event.ChangeListener).
      Parameters:
      listener - listener to remove