Class SubscriptionHandler
- java.lang.Object
-
- org.opentrafficsim.sim0mq.publisher.SubscriptionHandler
-
public class SubscriptionHandler extends java.lang.Object
Data collection that can be listed and has subscription to change events.Copyright (c) 2020-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate: 2020-02-13 11:08:16 +0100 (Thu, 13 Feb 2020) $, @version $Revision: 6383 $, by $Author: pknoppers $,
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubscriptionHandler.Command
The commands that a SubscriptionHandler understands.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeCommand(SubscriptionHandler.Command command, java.lang.Object[] address, ReturnWrapper returnWrapper)
Execute one command.void
get(java.lang.Object[] address, ReturnWrapper returnWrapper)
Retrieve a data collection.java.lang.String
getId()
Retrieve the id of this SubscriptionHandler.TransceiverInterface
getListTransceiver()
Retrieve the list transceiver (only for testing).MetaData
listRequestMetaData()
Report what payload is required to retrieve a list of all elements, or data and what format a result would have.MetaData
listResultMetaData()
Report what the payload format of the result of the list transceiver.static SubscriptionHandler.Command
lookupCommand(java.lang.String commandString)
Convert a String representing a Command into that Command.java.util.EnumSet<SubscriptionHandler.Command>
subscriptionOptions()
Return the set of supported commands.java.lang.String
toString()
-
-
-
Method Detail
-
listRequestMetaData
public MetaData listRequestMetaData()
Report what payload is required to retrieve a list of all elements, or data and what format a result would have.- Returns:
- MetaData; description of the payload required to retrieve a list of all elements, or data and what format a result would have
-
listResultMetaData
public MetaData listResultMetaData()
Report what the payload format of the result of the list transceiver.- Returns:
- MetaData; the payload format of the result of the list transceiver
-
get
public void get(java.lang.Object[] address, ReturnWrapper returnWrapper) throws java.rmi.RemoteException, Sim0MQException, SerializationException
Retrieve a data collection.- Parameters:
address
- Object[]; address of the requested data collectionreturnWrapper
- ReturnWrapper; to send back the result- Throws:
java.rmi.RemoteException
- when communication failsSerializationException
- on context errorSim0MQException
- on DSOL error
-
getListTransceiver
public TransceiverInterface getListTransceiver()
Retrieve the list transceiver (only for testing).- Returns:
- TransceiverInterface; the list transceiver
-
subscriptionOptions
public final java.util.EnumSet<SubscriptionHandler.Command> subscriptionOptions()
Return the set of supported commands.- Returns:
- EnumSet<Command>; the set of supported commands.
-
getId
public final java.lang.String getId()
Retrieve the id of this SubscriptionHandler.- Returns:
- String; the id of this SubscriptionHandler
-
lookupCommand
public static SubscriptionHandler.Command lookupCommand(java.lang.String commandString)
Convert a String representing a Command into that Command.- Parameters:
commandString
- String; the string- Returns:
- Command; the corresponding Command, or null if the
commandString
is not a valid Command
-
executeCommand
public void executeCommand(SubscriptionHandler.Command command, java.lang.Object[] address, ReturnWrapper returnWrapper) throws java.rmi.RemoteException, Sim0MQException, SerializationException
Execute one command.- Parameters:
command
- Command; the commandaddress
- Object[] the address of the object on which the command must be appliedreturnWrapper
- ReturnWrapper; envelope generator for replies- Throws:
java.rmi.RemoteException
- on communication failureSerializationException
- on illegal type in serializationSim0MQException
- on communication error
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-