java.lang.Object
esa.opensf.osfi.CLP
Provides procedures to parse the command line arguments, generating
a list of tokens grouped as:
- Configuration files
- Input files
- Output files
Version 1
Command line must follow the following format (expressed in Extended Backus-Naur form):
<command_line> ::= <executable_name> <whitespaces> <configuration_files> <whitespaces>
<input_files> <whitespaces> <output_files> <EOL>
<executable_name> ::= <file_name>
<whitespace> ::= (" ")
<whitespaces> ::= <whitespace>+
<file_name> ::= (<alphanumeric>)+
<configuration_files> ::= <list_of_files>
<input_files> ::= <list_of_files>
<output_files> ::= <list_of_files>
<list_of_files> ::= <file_name> ("," <file_name>)*
Version 2
In order to increase the flexibility of the OpenSF/Modules CLI, the following new CLI should be adopted:
<command_line> ::= <executable> <options>
<options> ::= (<global_configuration> | <local_configuration> | <input_file> | <output_file>)*
<executable>> ::= <file_name>
<global_configuration> ::= (--global|-g) <file_name>
<local_configuration> ::= (--local|-l) <file_name>
<input_file> ::= (--input|-i) <file_name>
<output_file> ::= (--output|-o) <file_name>
<file_name> ::= (<alphanumeric>)+
Notice: the above specification allows for multiple -global/-local options.
In case multiple options are defined, a complying implementation considers the value of the last option specified.
Both
File names must be valid OS-dependant file locations. Per the E2E-ICD, the configuration, input and output file names can be either a full-path name or a relative path name. Relative path names are interpreted by the module as relative to the current working directory. In particular, no reference to the possibleE2E_HOME variable is made.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckValidFile(String file) Deprecated.It validates a file according to CLI v1Deprecated.Modules that do not support a global configuration file are deprecatedWhen CLI v2 is used, the list always contain 2 elements: the global configuration file followed by the local one.parseFiles(String arg) Deprecated.The method is not part of the external API.
-
Constructor Details
-
CLP
Parse the command line arguments into the configuration, input and output files.- Parameters:
args- Arguments array as passed to themainfunction.- Throws:
IllegalArgumentException- if the arguments are invalid
-
-
Method Details
-
parseFiles
Deprecated.The method is not part of the external API. It only makes sense for CLI v1.- Parameters:
arg- String to be split.- Returns:
- the argument, split by "," and checked for path validity.
- Throws:
IllegalArgumentException- in case of invalid files.
-
checkValidFile
Deprecated.It validates a file according to CLI v1Checks the OS validity of a file name.- Parameters:
file- file name to validate- Throws:
IllegalArgumentException- in case of invalid file name.
-
getConfFile
Deprecated.Modules that do not support a global configuration file are deprecated- Returns:
- the name of the single (assumed to be local) configuration file. Configuration file can be "" is no configuration file is passed.
-
getConfFiles
When CLI v2 is used, the list always contain 2 elements: the global configuration file followed by the local one. One or both strings could benullif no file is provided.- Returns:
- configuration files provided as arguments (introduced with
-gand-l).
-
getInputFiles
- Returns:
- input files provided as arguments (introduced with
-i).
-
getOutputFiles
- Returns:
- output files provided as arguments (introduced with
-o).
-