Class AbstractSignalTransporter

java.lang.Object
net.sf.basedb.core.signal.AbstractSignalTransporter
All Implemented Interfaces:
SignalTransporter
Direct Known Subclasses:
ExtensionSignalTransporter, LocalSignalTransporter, SocketSignalTransporter

public abstract class AbstractSignalTransporter
extends Object
implements SignalTransporter
Abstract base class that is useful when implementing signal transporters.
Version:
2.6
Author:
nicklas
Last modified
$Date: 2014-04-09 14:21:20 +0200 (on, 09 apr 2014) $
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
      Log signals processing.
    • globalSignalId

      private String globalSignalId
    • signalHandlerURI

      private URI signalHandlerURI
    • signals

      private Collection<Signal> signals
  • Constructor Details

    • AbstractSignalTransporter

      protected AbstractSignalTransporter()
  • Method Details

    • init

      public void init​(String params)
      Initialise the transporter. We expect the parameter to be the one returned from AbstractSignalReceiver.getGlobalSignalId(SignalHandler). If the receiver subclass overrided that method, the corresponding transporter subclass should override this method.
      Specified by:
      init in interface SignalTransporter
      Parameters:
      params - The initialisation string
      See Also:
      for a description of the format expected
    • getSupportedSignals

      public Collection<Signal> getSupportedSignals()
      Description copied from interface: SignalTransporter
      Get a collection containing the signals supported, by the signal handler. A null return value means that the transporter just doesn't know about which signals are supported and which are not.
      Specified by:
      getSupportedSignals in interface SignalTransporter
      Returns:
      A collections with the signals, or null
    • generateSignalMessage

      protected String generateSignalMessage​(Signal signal)
      Generate a signal message string for the given signal. The string will have the following format: signal://handlerId@receiverId/?signal
      See Also:
      AbstractSignalReceiver.processSignalMessage(String)
    • getGlobalSignalId

      protected String getGlobalSignalId()
      Get the raw ID string that was passed to the init(String) method.
    • getSignalURI

      protected URI getSignalURI()
      Get the URI representation of the global signal ID.
      Returns:
      An URI
      Throws:
      SignalException - If the signal ID is not a valid URI.
    • getReceiverId

      protected String getReceiverId()
      Get the receiverId part of the signal URI.
      Returns:
      The ID of the receiver
    • getHandlerId

      protected String getHandlerId()
      Get the local handler ID part of the signal URI.
      Returns:
      The local ID of the signal handler