View Javadoc
1   package org.sim0mq.message.federatestarter;
2   
3   import org.sim0mq.Sim0MQException;
4   import org.sim0mq.message.Sim0MQMessage;
5   
6   /**
7    * RequestStatus, FS.1. This message is sent by the Federate Starter to the Model until a "started" response is received from
8    * the Model. Since the message type id clarifies the function of this message and no information exchange is necessary, the
9    * payload field can be empty (number of fields = 0).
10   * <p>
11   * Copyright (c) 2016-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://sim0mq.org/docs/current/license.html">Sim0MQ License</a>.
13   * </p>
14   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15   */
16  public class FS1RequestStatusMessage extends Sim0MQMessage
17  {
18      /** */
19      private static final long serialVersionUID = 20170422L;
20  
21      /** the unique message id. */
22      private static final String MESSAGETYPE = "FS.1";
23  
24      /**
25       * @param federationId the federation id can be coded using different types. Examples are two 64-bit longs indicating a
26       *            UUID, or a String with a UUID number, a String with meaningful identification, or a short or an int with a
27       *            simulation run number.
28       * @param senderId The sender id can be used to send back a message to the sender at some later time.
29       * @param receiverId The receiver id can be used to check whether the message is meant for us, or should be discarded (or an
30       *            error can be sent if we receive a message not meant for us).
31       * @param messageId The unique message number is meant to confirm with a callback that the message has been received
32       *            correctly. The number is unique for the sender, so not globally within the federation.
33       * @throws Sim0MQException on unknown data type
34       * @throws NullPointerException when one of the parameters is null
35       */
36      public FS1RequestStatusMessage(final Object federationId, final Object senderId, final Object receiverId,
37              final Object messageId) throws Sim0MQException, NullPointerException
38      {
39          super(true, federationId, senderId, receiverId, MESSAGETYPE, messageId, null);
40      }
41  
42      /**
43       * @param objectArray Object[]; the fields that constitute the message
44       * @throws Sim0MQException on unknown data type
45       * @throws NullPointerException when one of the parameters is null
46       */
47      public FS1RequestStatusMessage(final Object[] objectArray) throws Sim0MQException, NullPointerException
48      {
49          super(objectArray, 0, MESSAGETYPE);
50      }
51  
52      /**
53       * Builder for the StartFederate Message. Can string setters together, and call build() at the end to build the actual
54       * message.
55       * <p>
56       * Copyright (c) 2016-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
57       * <br>
58       * BSD-style license. See <a href="http://sim0mq.org/docs/current/license.html">Sim0MQ License</a>.
59       * </p>
60       * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
61       */
62      public static class Builder extends Sim0MQMessage.Builder<FS1RequestStatusMessage.Builder>
63      {
64          /**
65           * Empty constructor.
66           */
67          public Builder()
68          {
69              // nothing to do.
70          }
71  
72          /** {@inheritDoc} */
73          @Override
74          public FS1RequestStatusMessage build() throws Sim0MQException, NullPointerException
75          {
76              return new FS1RequestStatusMessage(this.federationId, this.senderId, this.receiverId, this.messageId);
77          }
78  
79      }
80  }