public class CertiRtig extends NamedObj
Execute the HLA/CERTI RTIG in a subprocess.
This object is based on the Exec actor implementation. It invokes the HLA/CERTI RTIG as a subprocess in a specified directory with a specified environment. A default platform-dependent shell command is preprended so the RTIG is executed within the shell. If another RTIG process is running the current subprocess is destroyed.
This object is used by the HlaManager
and need to be performed before
the initialization of a HLA/CERTI Federate. That's why we execute this mechanism
in the HlaManager
preinitialize() method.
The specified directory is the current directory of the Ptolemy
simulation and needs to contain the Federate Object Management file (.fed).
This directory is provided by the specification of the .fed file path during
the configuration of the HlaManager
attribute.
For a correct execution, the CERTI_HOME environment variable has to be
set. It could be set in the shell (by running one of the scripts provided by
CERTI) where Vergil is executed, or as a parameter of the Ptolemy model or as
a parameter of the HlaManager
:
CERTI_HOME="/absolute/path/to/certi/"
Otherwise, the current implementation is not able to find the CERTI environment, the RTIG binary and to perform its execution.
Current limitation:NamedObj.ContainedObjectsIterator
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
CertiRtig(HlaManager hm,
java.lang.Boolean addDebugListener)
Construct an actor with the given
HlaManager reference and
debug mode status. |
Modifier and Type | Method and Description |
---|---|
void |
exec()
Execute a command, set _process to point to the subprocess
and set up _errorGobbler and _outputGobbler to read data.
|
void |
initialize(java.lang.String directory)
Initialize command, arguments and environment variables to
invoke the subprocess.
|
boolean |
isAlreadyLaunched()
Indicate if the RTIG process is already running somewhere else.
|
boolean |
isRunning()
Indicate if the current subprocess is running.
|
void |
terminateProcess()
Terminate the process and close any associated streams.
|
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateExistence, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getContainer, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
public CertiRtig(HlaManager hm, java.lang.Boolean addDebugListener)
HlaManager
reference and
debug mode status.hm
- A reference to the associated HlaManager
.addDebugListener
- The debug mode status.public void exec() throws IllegalActionException
IllegalActionException
- If the execution of the Runtime.exec()
failed or if the RTIG subprocess it not running.public void initialize(java.lang.String directory) throws IllegalActionException
directory
- The current path where the simulation is executed.IllegalActionException
- If the directory to launch the
RTIG process doesn't exit.public boolean isAlreadyLaunched()
public boolean isRunning()
public void terminateProcess() throws IllegalActionException
IllegalActionException
- If the closing stdin of the subprocess
threw an IOException.