Class PtExecuteApplication
- java.lang.Object
-
- ptolemy.actor.gui.ConfigurationApplication
-
- ptolemy.actor.gui.MoMLApplication
-
- ptolemy.actor.gui.PtExecuteApplication
-
- All Implemented Interfaces:
ExecutionListener
public class PtExecuteApplication extends MoMLApplication
This application executes Ptolemy II models specified on the command line.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.xml
and$PTII/bin/ptexecute -full ../../domains/sdf/demo/Butterfly/Butterfly.xml
are equivalentIf 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.- Since:
- Ptolemy II 1.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Steve Neuendorffer Christopher Hylands
- See Also:
ModelFrame
,RunTableau
- Pt.AcceptedRating:
- Red (eal)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.actor.gui.ConfigurationApplication
ConfigurationApplication.IgnoreErrorHandler
-
-
Field Summary
Fields Modifier and Type Field 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.-
Fields inherited from class ptolemy.actor.gui.ConfigurationApplication
_basePath, _commandFlagsWithDescriptions, _commandOptions, _commandTemplate, _configuration, _exit, _parser, _printPDF, _run, _run20x, _statistics, _test
-
-
Constructor Summary
Constructors Constructor Description PtExecuteApplication(java.lang.String[] args)
Parse the specified command-line arguments, creating models and running them.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class ptolemy.actor.gui.MoMLApplication
_initializeApplication
-
Methods inherited from class ptolemy.actor.gui.ConfigurationApplication
_configurationUsage, _configurationUsage, _openModel, _openModel, _parseArg, _printPDF, _readConfiguration, closeModelWithoutSavingOrExiting, configurationDirectories, configurationDirectoryFullOrFirst, executionFinished, getActiveCount, managerStateChanged, models, openModel, openModelOrEntity, readConfiguration, runModels, setActiveCount, specToURL, throwArgsException, waitForFinish
-
-
-
-
Constructor Detail
-
PtExecuteApplication
public PtExecuteApplication(java.lang.String[] args) throws java.lang.Exception
Parse the specified command-line arguments, creating models and running them.- Parameters:
args
- The command-line arguments.- Throws:
java.lang.Exception
- If command line arguments have problems.
-
-
Method Detail
-
executionError
public void executionError(Manager manager, java.lang.Throwable throwable)
Display a stack trace because one of the models has an error. A dialog box with the stack trace is created, the stack trace is printed to stderr and the eventual exiting of the process is delayed so the stack trace can be read.- Specified by:
executionError
in interfaceExecutionListener
- Overrides:
executionError
in classConfigurationApplication
- Parameters:
manager
- The manager calling this method.throwable
- The Throwable to be displayed.
-
main
public static void main(java.lang.String[] args)
Create a new instance of this application, passing it the command-line arguments.- Parameters:
args
- The command-line arguments.
-
_createDefaultConfiguration
protected Configuration _createDefaultConfiguration() throws java.lang.Exception
Return a default Configuration, which in this case is given by the MoML file ptolemy/configs/runConfiguration.xml. The default configuration supports executing, but not editing, Ptolemy models. If there is an _applicationInitializer parameter, then construct it. The _applicationInitializer parameter contains a string that names a class to be initialized.- Overrides:
_createDefaultConfiguration
in classConfigurationApplication
- Returns:
- A default configuration.
- Throws:
java.lang.Exception
- If the configuration cannot be opened.
-
_createEmptyConfiguration
protected Configuration _createEmptyConfiguration() throws java.lang.Exception
Throw an exception.- Overrides:
_createEmptyConfiguration
in classConfigurationApplication
- Returns:
- Does not return.
- Throws:
java.lang.Exception
- Always thrown.
-
_parseArgs
protected void _parseArgs(java.lang.String[] args) throws java.lang.Exception
Parse the command-line arguments. This overrides the base class only to set the usage information.- Overrides:
_parseArgs
in classConfigurationApplication
- Parameters:
args
- The command-line arguments to be parsed.- Throws:
java.lang.Exception
- If an argument is not understood or triggers an error.
-
_usage
protected java.lang.String _usage()
Return a string summarizing the command-line arguments.- Overrides:
_usage
in classConfigurationApplication
- Returns:
- A usage string.
-
-