Class 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
    • 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 collection
        returnWrapper - ReturnWrapper; to send back the result
        Throws:
        java.rmi.RemoteException - when communication fails
        SerializationException - on context error
        Sim0MQException - 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 command
        address - Object[] the address of the object on which the command must be applied
        returnWrapper - ReturnWrapper; envelope generator for replies
        Throws:
        java.rmi.RemoteException - on communication failure
        SerializationException - on illegal type in serialization
        Sim0MQException - on communication error
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object