com.isti.jevalresp
Class Run

java.lang.Object
  extended by com.isti.jevalresp.Run
Direct Known Subclasses:
CmdLnPlotter, RunDirect, RunExt

public class Run
extends java.lang.Object

Class Run is the entry point and managing module for 'JEvalResp'.


Field Summary
protected  double b62XValue
           
protected  CfgPropItem b62XValueProp
          Sample value for polynomial blockette (62).
protected  java.util.Calendar beginCalObj
           
protected  java.lang.String[] chaNamesArray
           
protected  boolean debugFlag
           
protected  CfgPropItem debugFlagProp
          Flag set true to send debug messages to 'stderr'.
protected  java.util.Calendar endCalObj
           
protected  CfgPropItem endDayProp
          Julian day value for end of time range to be matched.
protected  CfgPropItem endTimeProp
          Time-of-day value for end of time range to be matched.
protected  CfgPropItem endYearProp
          Year value for end of time range to be matched.
protected  java.lang.String errorMessage
           
protected  int exitStatusValue
           
protected  CfgPropItem fileNameProp
          RESP file name to be used.
protected  java.lang.String fileNameString
           
protected  double[] frequenciesArray
           
static java.lang.String HDR_CMT_STR
          String containing leading comment chars for output file headers.
protected  boolean headerFlag
           
protected  CfgPropItem headerFlagProp
          Flag set true to enable header info in output file(s).
static double INTERP_TENSION_DEFVAL
          Default value for List-blockette interpolation.
protected  CfgPropItem interpInputFlagProp
          Flag set true to interpolate List blockette input.
protected  CfgPropItem interpListFlagProp
          Flag set true to interpolate List blockette output.
protected  CfgPropItem interpTensionProp
          Tension value for List-blockette interpolation.
protected  boolean listInterpInFlag
           
protected  boolean listInterpOutFlag
           
protected  double listInterpTension
           
protected  CfgPropItem locationIdProp
          Requested location ID string.
protected  boolean logSpacingFlag
           
protected  double maxFreqValue
           
protected  double minFreqValue
           
protected  boolean minimumFrequencyFlag
           
protected  boolean multiOutFlag
           
protected  CfgPropItem multiOutFlagProp
          Flag set true to enable multiple response outputs with the same 'net.sta.loc.cha' code.
protected  boolean multiSvrFlag
           
protected  CfgPropItem multiSvrFlagProp
          True to fetch from all specified web-services servers.
protected  java.lang.String[] netNamesArray
           
protected  CfgPropItem networkIdProp
          Requested network ID string.
protected  int numberFreqs
           
protected  java.io.File outputDirectory
           
protected  CfgPropItem outputDirectoryProp
          Output directory value.
protected  int outUnitsConvIdx
           
protected  CfgPropItem outUnitsConvProp
          Output units conversion, one of: vel, acc, dis, def.
protected  CfgProperties paramProps
          Properties object for parameter processing.
static java.lang.String PROGRAM_NAME
          Displayed name of program.
protected  CfgPropItem propsFileProp
          Properties file for FISSURES or web-services server.
protected  java.lang.String propsFileString
           
static int RESP_AP_TYPEIDX
          Index value (0) for "ap" response type (separate amp/phase files).
static int RESP_AP2_TYPEIDX
          Index value (2) for "ap2" response type (single amp/phase file).
static int RESP_CS_TYPEIDX
          Index value (1) for "cs" response type (complex-spectra file).
static int RESP_FAP_TYPEIDX
          Index value (3) for "fap" response type (single, unwrapped file).
static java.lang.String[] RESP_TYPE_LONGSTRS
          Longer versions of strings for 'responseType' (-r) parameter.
static java.lang.String[] RESP_TYPE_STRS
          Strings for 'responseType' (-r) parameter.
protected  CfgPropItem responseTypeProp
          Type of response output, AP (amp/phase) or CS (complex-spectra).
protected  int respTypeIndex
           
static java.lang.String REVISION_STR
          Displayed program revision string (name + version #).
protected  boolean showInputFlag
           
protected  CfgPropItem showInputFlagProp
          Flag set true to show RESP input text (sent to stdout).
protected  java.lang.String[] siteNamesArray
           
protected  CfgPropItem stageNumbersProp
          Start and stop stage numbers to be processed (this parameter contains two integer values).
protected  java.lang.String[] staNamesArray
           
protected  int startStageNum
           
protected  boolean stdioFlag
           
protected  CfgPropItem stdioFlagProp
          Flag set true to use 'stdio' for input and output (pipe).
protected  int stopStageNum
           
protected static java.text.DateFormat timeFmtObj
           
protected  CfgPropItem timeOfDayProp
          Requested time of day of response to search for (HH:MM:SS).
protected  boolean totalSensitFlag
           
protected  CfgPropItem totalSensitFlagProp
          Flag set true to use stage 0 sensitivity instead of computed.
static java.lang.String[] TYPE_SPACE_LONGSTRS
          Longer versions of strings for 'typeOfSpacing' (-s) parameter.
static java.lang.String[] TYPE_SPACE_STRS
          Strings for 'typeOfSpacing' (-s) parameter.
protected  CfgPropItem typeOfSpacingProp
          Type of frequency spacing, LOG or LIN.
static int UNIT_CONV_DEFIDX
          Default index value for 'outUnitsConv' (-u) parameter.
static java.lang.String[] UNIT_CONV_LONGSTRS
          Longer versions of strings for the 'outUnitsConv' (-u) parameter.
static java.lang.String[] UNIT_CONV_STRS
          Strings for the 'outUnitsConv' (-u) parameter.
protected  boolean unwrapPhaseFlag
           
protected  CfgPropItem unwrapPhaseFlagProp
          Flag set true to unwrap phase output values.
protected  boolean useDelayFlag
           
protected  CfgPropItem useDelayFlagProp
          Flag set true to use estimated delay in phase calculation.
protected static java.lang.String VER1_STR
           
protected static java.lang.String VER2_STR
           
protected  boolean verboseFlag
           
protected  CfgPropItem verboseFlagProp
          Flag set true to send verbose messages to 'stderr'.
static java.lang.String VERSION_NUM_STR
          Displayed program version # (+"(file)" if files-only version).
 
Constructor Summary
Run()
          Constructs a 'Run' object that may be used to process parameters and generate output.
Run(java.lang.String[] args)
          Constructs a 'Run' object that processes parameters, performs requested operations and generates output.
 
Method Summary
static boolean addTimeToCalendar(java.util.Calendar calObj, java.lang.String timeStr)
          Enters the interpreted value of the given 'time' string into the given Calendar object.
protected  boolean checkWebServicesServer()
          Checks if the 'propsFileString' variable or the file it references specifies the URL of a web-services server.
 void clearErrorMessage()
          Clears the error message string.
protected  void enterStartStopStageNums(java.lang.Integer startIntObj, java.lang.Integer stopIntObj)
          Enters the given start/stop stage numbers.
protected  boolean generateNetResponses(RespCallback respCallBackObj)
          Generates responses via CORBA connection to a FISSURES server.
protected  boolean generateResponses(RespCallback respCallBackObj)
          Generates responses from input files.
protected  boolean generateWebResponses(RespCallback respCallBackObj)
          Generates responses via a web-services server.
 java.io.PrintStream getConsoleOut()
          Get the console output.
 boolean getErrorFlag()
           
 java.lang.String getErrorMessage()
           
 int getExitStatusValue()
           
static java.lang.String[] listToStringArray(java.lang.String str)
          Converts the given comma-separated String of items to an array of Strings with each element containing one item.
static void main(java.lang.String[] args)
          Program entry point; creates a 'Run' object, performs operations and exits with a status code (non-zero means error).
static java.lang.String optionsArrToString(java.lang.String[] strArr)
          Converts the given array of options strings to a displayable string.
protected  java.util.Vector preprocessParameters(java.lang.String[] args)
          Loads and preprocesses the command-line parameters.
 boolean processAndOutput(java.lang.String[] args)
          Processes parameters, performs requested operations and generates the output.
protected  boolean processNonSwitchParams(java.util.Vector paramsVec)
          Processes the non-switch parameters that were given on the command line.
protected  boolean processSwitchParams()
          Processes the switch parameters defined by the properties object.
protected  void setErr(int statusVal, java.lang.String errMsgStr)
          Sets the exit status code and message for an error exit from the program.
protected  void setErrorMessage(java.lang.String str)
          Enters error message (if none previously entered).
protected static java.lang.String unitInfoStr(edu.iris.Fissures.Unit unitObj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROGRAM_NAME

public static final java.lang.String PROGRAM_NAME
Displayed name of program.

See Also:
Constant Field Values

VERSION_NUM_STR

public static final java.lang.String VERSION_NUM_STR
Displayed program version # (+"(file)" if files-only version).


REVISION_STR

public static final java.lang.String REVISION_STR
Displayed program revision string (name + version #).


UNIT_CONV_STRS

public static final java.lang.String[] UNIT_CONV_STRS
Strings for the 'outUnitsConv' (-u) parameter.


UNIT_CONV_DEFIDX

public static final int UNIT_CONV_DEFIDX
Default index value for 'outUnitsConv' (-u) parameter.

See Also:
Constant Field Values

UNIT_CONV_LONGSTRS

public static final java.lang.String[] UNIT_CONV_LONGSTRS
Longer versions of strings for the 'outUnitsConv' (-u) parameter.


TYPE_SPACE_STRS

public static final java.lang.String[] TYPE_SPACE_STRS
Strings for 'typeOfSpacing' (-s) parameter.


TYPE_SPACE_LONGSTRS

public static final java.lang.String[] TYPE_SPACE_LONGSTRS
Longer versions of strings for 'typeOfSpacing' (-s) parameter.


RESP_TYPE_STRS

public static final java.lang.String[] RESP_TYPE_STRS
Strings for 'responseType' (-r) parameter.


RESP_TYPE_LONGSTRS

public static final java.lang.String[] RESP_TYPE_LONGSTRS
Longer versions of strings for 'responseType' (-r) parameter.


RESP_AP_TYPEIDX

public static final int RESP_AP_TYPEIDX
Index value (0) for "ap" response type (separate amp/phase files).

See Also:
Constant Field Values

RESP_CS_TYPEIDX

public static final int RESP_CS_TYPEIDX
Index value (1) for "cs" response type (complex-spectra file).

See Also:
Constant Field Values

RESP_AP2_TYPEIDX

public static final int RESP_AP2_TYPEIDX
Index value (2) for "ap2" response type (single amp/phase file).

See Also:
Constant Field Values

RESP_FAP_TYPEIDX

public static final int RESP_FAP_TYPEIDX
Index value (3) for "fap" response type (single, unwrapped file).

See Also:
Constant Field Values

INTERP_TENSION_DEFVAL

public static final double INTERP_TENSION_DEFVAL
Default value for List-blockette interpolation.

See Also:
Constant Field Values

HDR_CMT_STR

public static final java.lang.String HDR_CMT_STR
String containing leading comment chars for output file headers.

See Also:
Constant Field Values

VER1_STR

protected static final java.lang.String VER1_STR
See Also:
Constant Field Values

VER2_STR

protected static final java.lang.String VER2_STR
See Also:
Constant Field Values

timeFmtObj

protected static final java.text.DateFormat timeFmtObj

staNamesArray

protected java.lang.String[] staNamesArray

chaNamesArray

protected java.lang.String[] chaNamesArray

netNamesArray

protected java.lang.String[] netNamesArray

siteNamesArray

protected java.lang.String[] siteNamesArray

beginCalObj

protected java.util.Calendar beginCalObj

endCalObj

protected java.util.Calendar endCalObj

minimumFrequencyFlag

protected boolean minimumFrequencyFlag

minFreqValue

protected double minFreqValue

maxFreqValue

protected double maxFreqValue

numberFreqs

protected int numberFreqs

stdioFlag

protected boolean stdioFlag

outUnitsConvIdx

protected int outUnitsConvIdx

frequenciesArray

protected double[] frequenciesArray

multiOutFlag

protected boolean multiOutFlag

multiSvrFlag

protected boolean multiSvrFlag

headerFlag

protected boolean headerFlag

verboseFlag

protected boolean verboseFlag

debugFlag

protected boolean debugFlag

startStageNum

protected int startStageNum

stopStageNum

protected int stopStageNum

logSpacingFlag

protected boolean logSpacingFlag

useDelayFlag

protected boolean useDelayFlag

showInputFlag

protected boolean showInputFlag

listInterpOutFlag

protected boolean listInterpOutFlag

listInterpInFlag

protected boolean listInterpInFlag

listInterpTension

protected double listInterpTension

unwrapPhaseFlag

protected boolean unwrapPhaseFlag

totalSensitFlag

protected boolean totalSensitFlag

b62XValue

protected double b62XValue

respTypeIndex

protected int respTypeIndex

fileNameString

protected java.lang.String fileNameString

propsFileString

protected java.lang.String propsFileString

outputDirectory

protected java.io.File outputDirectory

exitStatusValue

protected int exitStatusValue

errorMessage

protected java.lang.String errorMessage

paramProps

protected final CfgProperties paramProps
Properties object for parameter processing.


fileNameProp

protected final CfgPropItem fileNameProp
RESP file name to be used.


propsFileProp

protected final CfgPropItem propsFileProp
Properties file for FISSURES or web-services server.


outUnitsConvProp

protected final CfgPropItem outUnitsConvProp
Output units conversion, one of: vel, acc, dis, def.


timeOfDayProp

protected final CfgPropItem timeOfDayProp
Requested time of day of response to search for (HH:MM:SS).


typeOfSpacingProp

protected final CfgPropItem typeOfSpacingProp
Type of frequency spacing, LOG or LIN.


networkIdProp

protected final CfgPropItem networkIdProp
Requested network ID string.


locationIdProp

protected final CfgPropItem locationIdProp
Requested location ID string.


responseTypeProp

protected final CfgPropItem responseTypeProp
Type of response output, AP (amp/phase) or CS (complex-spectra).


stageNumbersProp

protected final CfgPropItem stageNumbersProp
Start and stop stage numbers to be processed (this parameter contains two integer values).


stdioFlagProp

protected final CfgPropItem stdioFlagProp
Flag set true to use 'stdio' for input and output (pipe).


multiOutFlagProp

protected final CfgPropItem multiOutFlagProp
Flag set true to enable multiple response outputs with the same 'net.sta.loc.cha' code.


multiSvrFlagProp

protected final CfgPropItem multiSvrFlagProp
True to fetch from all specified web-services servers.


endYearProp

protected final CfgPropItem endYearProp
Year value for end of time range to be matched.


endDayProp

protected final CfgPropItem endDayProp
Julian day value for end of time range to be matched.


endTimeProp

protected final CfgPropItem endTimeProp
Time-of-day value for end of time range to be matched.


headerFlagProp

protected final CfgPropItem headerFlagProp
Flag set true to enable header info in output file(s).


verboseFlagProp

protected final CfgPropItem verboseFlagProp
Flag set true to send verbose messages to 'stderr'.


outputDirectoryProp

protected final CfgPropItem outputDirectoryProp
Output directory value.


useDelayFlagProp

protected final CfgPropItem useDelayFlagProp
Flag set true to use estimated delay in phase calculation.


showInputFlagProp

protected final CfgPropItem showInputFlagProp
Flag set true to show RESP input text (sent to stdout).


interpListFlagProp

protected final CfgPropItem interpListFlagProp
Flag set true to interpolate List blockette output.


interpInputFlagProp

protected final CfgPropItem interpInputFlagProp
Flag set true to interpolate List blockette input.


interpTensionProp

protected final CfgPropItem interpTensionProp
Tension value for List-blockette interpolation.


unwrapPhaseFlagProp

protected final CfgPropItem unwrapPhaseFlagProp
Flag set true to unwrap phase output values.


totalSensitFlagProp

protected final CfgPropItem totalSensitFlagProp
Flag set true to use stage 0 sensitivity instead of computed.


b62XValueProp

protected final CfgPropItem b62XValueProp
Sample value for polynomial blockette (62).


debugFlagProp

protected final CfgPropItem debugFlagProp
Flag set true to send debug messages to 'stderr'.

Constructor Detail

Run

public Run(java.lang.String[] args)
Constructs a 'Run' object that processes parameters, performs requested operations and generates output.

Parameters:
args - an array of command-line parameters.

Run

public Run()
Constructs a 'Run' object that may be used to process parameters and generate output.

Method Detail

getConsoleOut

public java.io.PrintStream getConsoleOut()
Get the console output.

Returns:
the console output printstream.

processAndOutput

public boolean processAndOutput(java.lang.String[] args)
Processes parameters, performs requested operations and generates the output.

Parameters:
args - an array of command-line parameters.
Returns:
true if successful, false if a parameter error was detected (in which case the 'getErrorMessage()' and 'getExitStatusValue()' methods may be used to fetch information about the error.)

checkWebServicesServer

protected boolean checkWebServicesServer()
Checks if the 'propsFileString' variable or the file it references specifies the URL of a web-services server. If the file specified a web-services server then the URL string is entered into the 'propsFileString' instance variable.

Returns:
True if the 'propsFileString' variable or the file it references specifies the URL of a web-services server; false if not.

preprocessParameters

protected java.util.Vector preprocessParameters(java.lang.String[] args)
Loads and preprocesses the command-line parameters.

Parameters:
args - an array of command-line parameters.
Returns:
a Vector of Strings, 1 for each non-switch parameter found; or null if the program should be exited.

processNonSwitchParams

protected boolean processNonSwitchParams(java.util.Vector paramsVec)
Processes the non-switch parameters that were given on the command line.

Parameters:
paramsVec - a Vector of Strings, 1 for each non-switch parameter.
Returns:
true if successful, false if a parameter error was detected (in which case the 'getErrorMessage()' and 'getExitStatusValue()' methods may be used to fetch information about the error.)

processSwitchParams

protected boolean processSwitchParams()
Processes the switch parameters defined by the properties object.

Returns:
true if successful, false if a parameter error was detected (in which case the 'getErrorMessage()' and 'getExitStatusValue()' methods may be used to fetch information about the error.)

generateResponses

protected boolean generateResponses(RespCallback respCallBackObj)
Generates responses from input files.

Parameters:
respCallBackObj - a 'RespCallback' object whose 'responseInfo()' method will be called to report on each response found.
Returns:
true if successful, false if an error was detected (in which case the 'getErrorMessage()' and 'getExitStatusValue()' methods may be used to fetch information about the error.)

generateNetResponses

protected boolean generateNetResponses(RespCallback respCallBackObj)
Generates responses via CORBA connection to a FISSURES server.

Parameters:
respCallBackObj - a 'RespCallback' object whose 'responseInfo()' method will be called to report on each response found.
Returns:
true if successful, false if an error was detected (in which case the 'getErrorMessage()' and 'getExitStatusValue()' methods may be used to fetch information about the error.)

generateWebResponses

protected boolean generateWebResponses(RespCallback respCallBackObj)
Generates responses via a web-services server.

Parameters:
respCallBackObj - a 'RespCallback' object whose 'responseInfo()' method will be called to report on each response found.
Returns:
true if successful, false if an error was detected (in which case the 'getErrorMessage()' and 'getExitStatusValue()' methods may be used to fetch information about the error.)

enterStartStopStageNums

protected void enterStartStopStageNums(java.lang.Integer startIntObj,
                                       java.lang.Integer stopIntObj)
Enters the given start/stop stage numbers. If only the start-stage value is given then both start/stop numbers are set to that value.

Parameters:
startIntObj - Integer object holding the start-stage value, or null or -1 for none.
stopIntObj - Integer object holding the stop-stage value, or null or -1 for none.

setErrorMessage

protected void setErrorMessage(java.lang.String str)
Enters error message (if none previously entered).

Parameters:
str - error message string

getErrorFlag

public boolean getErrorFlag()
Returns:
true if an error was detected. The error message may be fetched via the 'getErrorMessage()' method.

getErrorMessage

public java.lang.String getErrorMessage()
Returns:
message string for last error (or 'No error' if none).

clearErrorMessage

public void clearErrorMessage()
Clears the error message string.


setErr

protected void setErr(int statusVal,
                      java.lang.String errMsgStr)
Sets the exit status code and message for an error exit from the program.

Parameters:
statusVal - exit status value to be returned by program.
errMsgStr - if specified then the error message to be sent to 'stderr'.

getExitStatusValue

public int getExitStatusValue()
Returns:
the exit status value for the program.

listToStringArray

public static java.lang.String[] listToStringArray(java.lang.String str)
Converts the given comma-separated String of items to an array of Strings with each element containing one item.

Parameters:
str - string
Returns:
An array of strings, or null if an error occurred.

optionsArrToString

public static java.lang.String optionsArrToString(java.lang.String[] strArr)
Converts the given array of options strings to a displayable string.

Parameters:
strArr - array of strings
Returns:
display string

addTimeToCalendar

public static boolean addTimeToCalendar(java.util.Calendar calObj,
                                        java.lang.String timeStr)
Enters the interpreted value of the given 'time' string into the given Calendar object. Any current hours/minutes/seconds values in the Calendar object are overwritten.

Parameters:
timeStr - a time string value in "HH:MM:SS", "HH:MM" or "HH" format.
calObj - a Calendar object to be modified.
Returns:
true if successful, false if error in 'timeStr' format or any null parameters.

unitInfoStr

protected static java.lang.String unitInfoStr(edu.iris.Fissures.Unit unitObj)
Parameters:
unitObj - unit object
Returns:
a string of information about the given unit. The information includes the unit's name and, if applicable, the 'UNIT_CONV_STRS[]' string for the unit.

main

public static void main(java.lang.String[] args)
Program entry point; creates a 'Run' object, performs operations and exits with a status code (non-zero means error).

Parameters:
args - program arguments