public class PtExecuteApplication extends MoMLApplication
The exact facilities that are available are determined by an optional command line argument that names a directory in ptolemy/configs that contains a configuration.xml file. For example, if we call vergil -ptiny, then we will use ptolemy/configs/ptiny/configuration.xml and ptolemy/configs/ptiny/intro.htm. The default configuration is ptolemy/configs/runConfiguration.xml, which is loaded before any other command-line arguments are processed.
This application also takes an optional command line argument pair
-conf configurationFile.xml
that names a configuration
to be read. For example,
$PTII/bin/ptexecute -conf ptolemy/configs/full/configuration.xml ../../domains/sdf/demo/Butterfly/Butterfly.xmland
$PTII/bin/ptexecute -full ../../domains/sdf/demo/Butterfly/Butterfly.xmlare equivalent
If no configuration is specified on the command line, then the MoML file ptolemy/configs/runConfiguration.xml is loaded before other command line arguments are processed.
If one of the command-line arguments is -exit, then System.exit() is called when all the models are finished running. System.exit() returns 0 if all the models finished without throwing an exception, otherwise it returns an integer that represents the number of models that threw an exception. The main() method calls System.exit() as well and returns an integer that represents the number of models that threw an exception.
If there are no command-line arguments at all, then this class does nothing.
This class will bring up the GUI and usually requires access
to a display. The MoMLSimpleApplication
class will run models in a non-graphical context.
ModelFrame
,
RunTableau
ConfigurationApplication.ConfigurationFilenameFilter, ConfigurationApplication.IgnoreErrorHandler
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String[] |
_localCommandFlags
The command-line options that are either present or not.
|
protected static java.lang.String[][] |
_localCommandOptions
The command-line options that take arguments.
|
_basePath, _commandFlagsWithDescriptions, _commandOptions, _commandTemplate, _configuration, _exit, _parser, _printPDF, _run, _run20x, _statistics, _test
Constructor and Description |
---|
PtExecuteApplication(java.lang.String[] args)
Parse the specified command-line arguments, creating models
and running them.
|
Modifier and Type | Method and Description |
---|---|
protected Configuration |
_createDefaultConfiguration()
Return a default Configuration, which in this case is given by
the MoML file ptolemy/configs/runConfiguration.xml.
|
protected Configuration |
_createEmptyConfiguration()
Throw an exception.
|
protected void |
_parseArgs(java.lang.String[] args)
Parse the command-line arguments.
|
protected java.lang.String |
_usage()
Return a string summarizing the command-line arguments.
|
void |
executionError(Manager manager,
java.lang.Throwable throwable)
Display a stack trace because one of the models has an error.
|
static void |
main(java.lang.String[] args)
Create a new instance of this application, passing it the
command-line arguments.
|
_initializeApplication
_configurationUsage, _configurationUsage, _openModel, _openModel, _parseArg, _printPDF, _readConfiguration, closeModelWithoutSavingOrExiting, configurationDirectories, configurationDirectoryFullOrFirst, executionFinished, getActiveCount, managerStateChanged, models, openModel, openModelOrEntity, readConfiguration, runModels, setActiveCount, specToURL, throwArgsException, waitForFinish
protected static java.lang.String[] _localCommandFlags
protected static java.lang.String[][] _localCommandOptions
public PtExecuteApplication(java.lang.String[] args) throws java.lang.Exception
args
- The command-line arguments.java.lang.Exception
- If command line arguments have problems.public void executionError(Manager manager, java.lang.Throwable throwable)
executionError
in interface ExecutionListener
executionError
in class ConfigurationApplication
manager
- The manager calling this method.throwable
- The Throwable to be displayed.public static void main(java.lang.String[] args)
args
- The command-line arguments.protected Configuration _createDefaultConfiguration() throws java.lang.Exception
_createDefaultConfiguration
in class ConfigurationApplication
java.lang.Exception
- If the configuration cannot be opened.protected Configuration _createEmptyConfiguration() throws java.lang.Exception
_createEmptyConfiguration
in class ConfigurationApplication
java.lang.Exception
- Always thrown.protected void _parseArgs(java.lang.String[] args) throws java.lang.Exception
_parseArgs
in class ConfigurationApplication
args
- The command-line arguments to be parsed.java.lang.Exception
- If an argument is not understood or triggers
an error.protected java.lang.String _usage()
_usage
in class ConfigurationApplication