public class StartFederateMessage extends Sim0MQMessage
Copyright (c) 2016-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See Sim0MQ License.
Modifier and Type | Class and Description |
---|---|
static class |
StartFederateMessage.Builder
Builder for the StartFederate Message.
|
VERSION
Constructor and Description |
---|
StartFederateMessage(Object simulationRunId,
Object senderId,
Object receiverId,
long messageId,
String instanceId,
String softwareCode,
String argsBefore,
String modelPath,
String argsAfter,
String workingDirectory,
String redirectStdin,
String redirectStdout,
String redirectStderr,
boolean deleteWorkingDirectory,
boolean deleteStdout,
boolean deleteStderr) |
Modifier and Type | Method and Description |
---|---|
byte[] |
createByteArray()
Create a byte array of the fields.
|
static StartFederateMessage |
createMessage(Object[] fields,
Object intendedReceiverId)
Build a message from an Object[] that was received.
|
Object[] |
createObjectArray()
Create a Sim0MQ object array of the fields.
|
String |
getArgsAfter() |
String |
getArgsBefore() |
String |
getInstanceId() |
static String |
getMessageType() |
String |
getModelPath() |
String |
getRedirectStderr() |
String |
getRedirectStdin() |
String |
getRedirectStdout() |
String |
getSoftwareCode() |
String |
getWorkingDirectory() |
boolean |
isDeleteStderr() |
boolean |
isDeleteStdout() |
boolean |
isDeleteWorkingDirectory() |
check, getMessageId, getMessageStatus, getMessageTypeId, getReceiverId, getSenderId, getSimulationRunId
public StartFederateMessage(Object simulationRunId, Object senderId, Object receiverId, long messageId, String instanceId, String softwareCode, String argsBefore, String modelPath, String argsAfter, String workingDirectory, String redirectStdin, String redirectStdout, String redirectStderr, boolean deleteWorkingDirectory, boolean deleteStdout, boolean deleteStderr) throws Sim0MQException, NullPointerException
simulationRunId
- the Simulation run ids can be provided in different types. Examples are two 64-bit longs
indicating a UUID, or a String with a UUID number, a String with meaningful identification, or a short or an
int with a simulation run number.senderId
- The sender id can be used to send back a message to the sender at some later time.receiverId
- The receiver id can be used to check whether the message is meant for us, or should be discarded (or an
error can be sent if we receive a message not meant for us).messageId
- The unique message number is meant to confirm with a callback that the message has been received
correctly. The number is unique for the sender, so not globally within the federation.instanceId
- Id to identify the callback to know which model instance has been started, e.g. "IDVV.14". The model
instance will use this as its sender id.softwareCode
- Code for the software to run, will be looked up in a table on the local computer to determine the
path to start the software on that computer. Example: "java". If the softwarePath is defined, softwareCode can
be an empty String (0 characters).argsBefore
- Arguments that the software needs, before the model file path and name; e.g. "–Xmx2G -jar" in case of a
Java model. This String can be empty (0 characters).modelPath
- The actual path on the target computer where the model resides, including the model that needs to be
run. This String cannot be empty.argsAfter
- Arguments that the software or the model needs, after the model file path and name; e.g. arguments for
the model itself to run like a data file or a data location . This String can be empty (0 characters), but
usually we would want to send the port number(s) or a location where the model can find it as well as the name
under which the model was registered.workingDirectory
- Full path on the target computer that will be used as the working directory. Some files may be
temporarily stored there. If the working directory does not exist yet, it will be created.redirectStdin
- Place to get user input from in case a model asks for it (it shouldn't, by the way).redirectStdout
- Place to send the output to that the model normally displays on the console. If this is not
redirected, the memory buffer for the stdout might get full, and the model might stop as a result. On Linux
systems, this often redirected to /dev/null. On Windows systems, this can e.g., be redirected to a file
"out.txt" in the current working directory. For now, it has to be a path name (including /dev/null as being
acceptable). If no full path is given, the filename is relative to the working directory.redirectStderr
- Place to send the error messages to that the model normally displays on the console. If this is not
redirected, the memory buffer for the stderr might get full, and the model might stop as a result. On Linux
systems, this often redirected to /dev/null. On Windows systems, this can e.g., be redirected to a file
"err.txt" in the current working directory. For now, it has to be a path name (including /dev/null as being
acceptable). If no full path is given, the filename is relative to the working directory.deleteWorkingDirectory
- Whether to delete the working directory after the run of the model or not.deleteStdout
- Whether to delete the redirected stdout after running or not (in case it is stored in a different
place than the working directory)deleteStderr
- Whether to delete the redirected stderr after running or not (in case it is stored in a different
place than the working directory)Sim0MQException
- on unknown data typeNullPointerException
- when one of the parameters is nullpublic final String getInstanceId()
public final String getSoftwareCode()
public final String getArgsBefore()
public final String getModelPath()
public final String getArgsAfter()
public final String getWorkingDirectory()
public final String getRedirectStdin()
public final String getRedirectStdout()
public final String getRedirectStderr()
public final boolean isDeleteWorkingDirectory()
public final boolean isDeleteStdout()
public final boolean isDeleteStderr()
public static final String getMessageType()
public Object[] createObjectArray()
createObjectArray
in class Sim0MQMessage
public byte[] createByteArray() throws Sim0MQException, org.djutils.serialization.SerializationException
createByteArray
in class Sim0MQMessage
Sim0MQException
- on unknown data type as part of the contentorg.djutils.serialization.SerializationException
- when the byte array cannot be created, e.g. because the number of bytes does not matchpublic static StartFederateMessage createMessage(Object[] fields, Object intendedReceiverId) throws Sim0MQException
fields
- Object[]; the fields in the messageintendedReceiverId
- id of the intended receiverSim0MQException
- when number of fields is not correctCopyright © 2016–2019 Delft University of Technology. All rights reserved.