Package org.opentrafficsim.imb.connector
Interface Connector
- All Known Implementing Classes:
IMBConnector
public interface Connector
IMB listener and publisher.
Copyright (c) 2013-2019 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 classConnector.IMBEventTypeEnum for IMB event types. -
Method Summary
Modifier and Type Method Description StringgetFederation()Return the federation name of the connection, e.g.StringgetHost()Return the host of the connection, e.g.intgetModelId()Return the model id (owner id) of the connection, e.g.StringgetModelName()Return the model name (owner name) of the connection, e.g.intgetPort()Return the port of the connection, e.g.booleanpostIMBMessage(String IMBEventName, Connector.IMBEventType imbEventType, Object[] args)Compose a message containing the specified objects and send it to recipients.voidregister(String fullIMBEventName, Transceiver transceiver)Register the transceiver as the interested party when an IMB message identified by the imbEventName is received.
-
Method Details
-
postIMBMessage
boolean postIMBMessage(String IMBEventName, Connector.IMBEventType imbEventType, Object[] args) throws IMBExceptionCompose a message containing the specified objects and send it to recipients.- Parameters:
IMBEventName- String; publicationimbEventType- IMBEventType; one of NEW, CHANGE, or DELETEargs- 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
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_Starttransceiver- Transceiver; the transceiver to handle the incoming event- Throws:
IMBException- in case the transceiver is switched to a new one for an event
-
getHost
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
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
String getFederation()Return the federation name of the connection, e.g. OTS_RT- Returns:
- String; the federation name of the connection
-