Building Controls Virtual Test Bed
BCVTB.Launcher Class Reference
Collaboration diagram for BCVTB.Launcher:

Classes

enum  osName
 Enumeration for the operating system.
 

Public Member Functions

 Launcher () throws FileNotFoundException, Exception
 Constructor. More...
 

Static Public Member Functions

static void main (String[] args)
 Main method. More...
 

Protected Member Functions

void setupCommandList (String[] args, ArrayList< String > comLis)
 Sets up the argument list if the first flag is -command More...
 
void setupPtolemyArguments (String[] args, ArrayList< String > ptArgs, ArrayList< String > JVMFlags)
 Sets up the argument list if the first flag is not -command More...
 
String getProperty (final String key)
 Gets a system property. More...
 
String getUserPropertyFileName () throws Exception
 Get the user property file name. More...
 
void detectSystemVariables () throws Exception
 Detect system variables. More...
 
String getBCVTBRoot () throws FileNotFoundException
 Gets the root directory of the BCVTB. More...
 
void setSystemVariable (final String name, final String value)
 Sets the variable to the system properties. More...
 
void resolveEnvironmentVariable ()
 Resolves all references to environment variables in the properties. More...
 
void initializeEnvironmentVariables () throws FileNotFoundException, Exception
 Initializes the settings of environment variables. More...
 
int startProcess ()
 Starts the process. More...
 
void updateSystemFile () throws FileNotFoundException, IOException, Exception
 Update the ptFile if it is from an old version. More...
 

Static Protected Member Functions

static int startBCVTB (String[] args)
 Starts the BCVTB. More...
 

Protected Attributes

Properties userProp
 User properties. More...
 
String ptFile
 Ptolemy file, or null if not specified. More...
 
boolean run
 Flag, true if user set -run flag. More...
 
boolean update
 Flag, true if user set -update flag. More...
 
Map< String, String > prop
 The properties of the process builder. More...
 
String originalPath
 The path variable. More...
 
ProcessBuilder pb
 The process builder to start Ptolemy. More...
 
osName os
 The operating system. More...
 

Static Protected Attributes

static boolean console = false
 Flag, true if user set -console flag. More...
 
static final String PS = System.getProperty("file.separator")
 File separator. More...
 
static final String LS = System.getProperty("line.separator")
 Line separator. More...
 

Private Member Functions

void _replaceEnvironmentVariables ()
 Resolves all references to existing environment variables in the user properties. More...
 
void _resolveReferences ()
 Resolves all references within the user properties. More...
 

Static Private Member Functions

static void _dumpProperties (Map< String, String > p)
 
static String _replaceAll (final String s, final String pattern, final String value)
 
static String _replaceAllSystemVariables (final String s, final String pattern, final String value)
 

Detailed Description

Definition at line 18 of file Launcher.java.

Constructor & Destructor Documentation

Member Function Documentation

static void BCVTB.Launcher._dumpProperties ( Map< String, String >  p)
inlinestaticprivate

Definition at line 368 of file Launcher.java.

Referenced by BCVTB.Launcher.setupPtolemyArguments().

static String BCVTB.Launcher._replaceAll ( final String  s,
final String  pattern,
final String  value 
)
inlinestaticprivate
static String BCVTB.Launcher._replaceAllSystemVariables ( final String  s,
final String  pattern,
final String  value 
)
inlinestaticprivate
void BCVTB.Launcher._replaceEnvironmentVariables ( )
inlineprivate

Resolves all references to existing environment variables in the user properties.

Definition at line 463 of file Launcher.java.

References BCVTB.Launcher._replaceAllSystemVariables().

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().

void BCVTB.Launcher._resolveReferences ( )
inlineprivate

Resolves all references within the user properties.

Definition at line 484 of file Launcher.java.

References BCVTB.Launcher._replaceAllSystemVariables().

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().

void BCVTB.Launcher.detectSystemVariables ( ) throws Exception
inlineprotected

Detect system variables.

Exceptions
ExceptionIf the operating system is not supported.

Definition at line 301 of file Launcher.java.

References BCVTB.Launcher.os.

Referenced by BCVTB.Launcher.Launcher().

String BCVTB.Launcher.getBCVTBRoot ( ) throws FileNotFoundException
inlineprotected

Gets the root directory of the BCVTB.

Exceptions
FileNotFoundExceptionif the root directory cannot be determined

Definition at line 327 of file Launcher.java.

References BCVTB.Launcher._replaceAll(), BCVTB.Launcher.LS, BCVTB.Launcher.os, and start().

Referenced by BCVTB.Launcher.getUserPropertyFileName(), and BCVTB.Launcher.initializeEnvironmentVariables().

String BCVTB.Launcher.getProperty ( final String  key)
inlineprotected

Gets a system property.

Parameters
keyKey of the property
Returns
value of the property, or null if there is no such property

Definition at line 144 of file Launcher.java.

String BCVTB.Launcher.getUserPropertyFileName ( ) throws Exception
inlineprotected

Get the user property file name.

Returns
The name of the user property file.
Exceptions
ExceptionIf the operating system is not supported.

Definition at line 153 of file Launcher.java.

References BCVTB.Launcher.getBCVTBRoot(), BCVTB.Launcher.LS, and BCVTB.Launcher.os.

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().

void BCVTB.Launcher.initializeEnvironmentVariables ( ) throws FileNotFoundException, Exception
inlineprotected

Initializes the settings of environment variables.

Exceptions
FileNotFoundExceptionif the root directory cannot be determined
Exceptionif the operating system is not supported

Definition at line 508 of file Launcher.java.

References BCVTB.Launcher._replaceAll(), BCVTB.Launcher._replaceEnvironmentVariables(), BCVTB.Launcher._resolveReferences(), BCVTB.Launcher.getBCVTBRoot(), BCVTB.Launcher.getUserPropertyFileName(), BCVTB.Launcher.LS, BCVTB.Launcher.PS, BCVTB.Launcher.resolveEnvironmentVariable(), BCVTB.Launcher.setSystemVariable(), and BCVTB.Launcher.userProp.

Referenced by BCVTB.Launcher.Launcher().

static void BCVTB.Launcher.main ( String[]  args)
inlinestatic

Main method.

Definition at line 621 of file Launcher.java.

References BCVTB.Launcher.Launcher(), BCVTB.Launcher.LS, retVal, and BCVTB.Launcher.startBCVTB().

void BCVTB.Launcher.resolveEnvironmentVariable ( )
inlineprotected

Resolves all references to environment variables in the properties.

Definition at line 442 of file Launcher.java.

References BCVTB.Launcher._replaceAllSystemVariables().

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().

void BCVTB.Launcher.setSystemVariable ( final String  name,
final String  value 
)
inlineprotected

Sets the variable to the system properties.

If such a variable already exists, it will be overwritten

Parameters
namename of the variable
valuevalue of the variable

Definition at line 398 of file Launcher.java.

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().

void BCVTB.Launcher.setupCommandList ( String[]  args,
ArrayList< String >  comLis 
)
inlineprotected

Sets up the argument list if the first flag is -command

Parameters
argsthe command line arguments
comLisan array list where the arguments will be stored
Exceptions
UnsupportedOperationExceptionif non-valid arguments are passed

Definition at line 44 of file Launcher.java.

References i.

void BCVTB.Launcher.setupPtolemyArguments ( String[]  args,
ArrayList< String >  ptArgs,
ArrayList< String >  JVMFlags 
)
inlineprotected

Sets up the argument list if the first flag is not -command

Parameters
argsthe command line arguments
ptArgsan array list where the arguments will be stored
JVMFlagsan array list where the JVM flags will be stored, if any are specified
Exceptions
UnsupportedOperationExceptionif non-valid arguments are passed

Definition at line 81 of file Launcher.java.

References BCVTB.Launcher._dumpProperties(), BCVTB.Launcher.console, i, BCVTB.Launcher.prop, BCVTB.Launcher.ptFile, BCVTB.Launcher.run, and BCVTB.Launcher.update.

static int BCVTB.Launcher.startBCVTB ( String[]  args)
inlinestaticprotected

Starts the BCVTB.

Parameters
argslist of command line arguments
Returns
zero if execution is successful, or non-zero otherwise

Definition at line 670 of file Launcher.java.

References BCVTB.Launcher.Launcher(), and retVal.

Referenced by BCVTB.Launcher.main().

int BCVTB.Launcher.startProcess ( )
inlineprotected

Starts the process.

Returns
the exit value of the process. By convention, 0 indicates normal termination

Definition at line 569 of file Launcher.java.

References retVal, and start().

void BCVTB.Launcher.updateSystemFile ( ) throws FileNotFoundException, IOException, Exception
inlineprotected

Update the ptFile if it is from an old version.

Exceptions
FileNotFoundExceptionif the file is not found
IOExceptionif the file cannot be read
Exceptionif an Exception occurs in VersionUpdater.main(String[])

Definition at line 693 of file Launcher.java.

References BCVTB.Launcher.ptFile.

Member Data Documentation

boolean BCVTB.Launcher.console = false
staticprotected

Flag, true if user set -console flag.

Definition at line 726 of file Launcher.java.

Referenced by BCVTB.Launcher.Launcher(), and BCVTB.Launcher.setupPtolemyArguments().

final String BCVTB.Launcher.LS = System.getProperty("line.separator")
staticprotected
String BCVTB.Launcher.originalPath
protected

The path variable.

Definition at line 732 of file Launcher.java.

osName BCVTB.Launcher.os
protected
ProcessBuilder BCVTB.Launcher.pb
protected

The process builder to start Ptolemy.

Definition at line 735 of file Launcher.java.

Referenced by BCVTB.Launcher.Launcher().

Map<String,String> BCVTB.Launcher.prop
protected

The properties of the process builder.

Definition at line 729 of file Launcher.java.

Referenced by BCVTB.Launcher.Launcher(), and BCVTB.Launcher.setupPtolemyArguments().

final String BCVTB.Launcher.PS = System.getProperty("file.separator")
staticprotected

File separator.

Definition at line 738 of file Launcher.java.

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().

String BCVTB.Launcher.ptFile
protected

Ptolemy file, or null if not specified.

Definition at line 720 of file Launcher.java.

Referenced by BCVTB.Launcher.Launcher(), BCVTB.Launcher.setupPtolemyArguments(), and BCVTB.Launcher.updateSystemFile().

boolean BCVTB.Launcher.run
protected

Flag, true if user set -run flag.

Definition at line 722 of file Launcher.java.

Referenced by BCVTB.Launcher.Launcher(), and BCVTB.Launcher.setupPtolemyArguments().

boolean BCVTB.Launcher.update
protected

Flag, true if user set -update flag.

Definition at line 724 of file Launcher.java.

Referenced by BCVTB.Launcher.Launcher(), and BCVTB.Launcher.setupPtolemyArguments().

Properties BCVTB.Launcher.userProp
protected

User properties.

Definition at line 718 of file Launcher.java.

Referenced by BCVTB.Launcher.initializeEnvironmentVariables().


The documentation for this class was generated from the following file: