Interface Connector

  • All Known Implementing Classes:
    IMBConnector

    public interface Connector
    IMB listener and publisher.

    Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version Aug 19, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Connector.IMBEventType
      Enum for IMB event types.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getFederation()
      Return the federation name of the connection, e.g.
      java.lang.String getHost()
      Return the host of the connection, e.g.
      int getModelId()
      Return the model id (owner id) of the connection, e.g.
      java.lang.String getModelName()
      Return the model name (owner name) of the connection, e.g.
      int getPort()
      Return the port of the connection, e.g.
      boolean postIMBMessage​(java.lang.String IMBEventName, Connector.IMBEventType imbEventType, java.lang.Object[] args)
      Compose a message containing the specified objects and send it to recipients.
      void register​(java.lang.String fullIMBEventName, Transceiver transceiver)
      Register the transceiver as the interested party when an IMB message identified by the imbEventName is received.
    • Method Detail

      • postIMBMessage

        boolean postIMBMessage​(java.lang.String IMBEventName,
                               Connector.IMBEventType imbEventType,
                               java.lang.Object[] args)
                        throws IMBException
        Compose a message containing the specified objects and send it to recipients.
        Parameters:
        IMBEventName - String; publication
        imbEventType - IMBEventType; one of NEW, CHANGE, or DELETE
        args - Object[]; the objects to send
        Returns:
        boolean; true on success, false on failure
        Throws:
        IMBException - when the event name is not a registered publication
      • register

        void register​(java.lang.String fullIMBEventName,
                      Transceiver transceiver)
               throws IMBException
        Register the transceiver as the interested party when an IMB message identified by the imbEventName is received. When an IMB message with that imbEventName is received, the postOTSMessage method on the transceiver is called.
        Parameters:
        fullIMBEventName - String; the IMB Event name including the federation prefix, e.g. OTS_RT.SIM_Start
        transceiver - Transceiver; the transceiver to handle the incoming event
        Throws:
        IMBException - in case the transceiver is switched to a new one for an event
      • getHost

        java.lang.String getHost()
        Return the host of the connection, e.g. localhost, or 192,168.1.11
        Returns:
        String; the host of the connection
      • getPort

        int getPort()
        Return the port of the connection, e.g. 4000
        Returns:
        int; the port of the connection
      • getModelName

        java.lang.String getModelName()
        Return the model name (owner name) of the connection, e.g. OTS
        Returns:
        String; the model name (owner name) of the connection
      • getModelId

        int getModelId()
        Return the model id (owner id) of the connection, e.g. 1
        Returns:
        String; the model id (owner id) of the connection
      • getFederation

        java.lang.String getFederation()
        Return the federation name of the connection, e.g. OTS_RT
        Returns:
        String; the federation name of the connection