public class Pipeline_Configuration extends Object
A Pipeline_Configuration database table has the following fields:
Pipeline_Configuration provides the ability to read and write all the columns except the ID. Typical usage of the API involves constructing a Pipeline_Configuration object with a database connection, catalog, pipeline, and whether strict-mode should be enforced. For example:
Configuration configuration = new Configuration (); Database database = new Database (configuration); database.Connect (); String catalog = "HiRISE", pipeline = "HiColorNorm"; boolean strict = true; Pipeline_Configuration pipeline_configuration = new Pipeline_Configuration (database.Connection (), catalog, pipeline, strict);
Where:
The pipeline_configuration can then be used to read and write table records. For example:
Conf conf = pipeline_configuration.read ("Make_Unfiltered_Cube"); System.out.println ("Make_Unfiltered_Cube = " + conf.value); System.out.println ("Description: " + conf.description);
The Pipeline_Configuration.Conf
class is used to contain the field values of a table
record.
A Pipeline_Configuration.write updates a table record if a named pipeline parameter is present in a table record. A new record is inserted in the table otherwise. Table record updates will only set field values for which data has supplied. For example:
pipeline_configuration.write ("Make_Unfiltered_Cube", "TRUE"); pipeline_configuration.write ("Make_Unfiltered_Cube", "TRUE", "TRUE|FALSE"); pipeline_configuration.write ("Make_Unfiltered_Cube", "TRUE", Validator.BOOLEAN); pipeline_configuration.write ("Make_Unfiltered_Cube", "TRUE", "TRUE|FALSE", "A description.");
Each write will modify the same record (except, perhaps, the first which might insert a new record) that has the "HiColorNorm" value in the PIPELINE field and the "Make_Unfiltered_Cube" value in the PARAMETER field of a record of the default "Pipeline_Configuration" table in the "HiRISE" catalog.
The command-line usage can be obtained by using the -help option:
Here is an example of using Pipeline_Configuration for querying a pipeline's parameter for a value, getting all parameter information, and writing parameter information for a pipeline.
Pipeline_Configuration \ -configuration ~/HiRISE/Configuration/EDRgen/EDRgen.conf \ -pipeline HiColorNorm \ -parameter Make_Unfiltered_Cube
Returns:
TRUE
Pipeline_Configuration \ -configuration ~/HiRISE/Configuration/EDRgen/EDRgen.conf \ -pipeline HiColorNorm \ -parameter Make_Unfiltered_Cube \ -info
Returns:
PIPELINE = HiColorNorm PARAMETER = Make_Unfiltered_Cube VALUE = TRUE VALIDATION_STRING = TRUE|FALSE DESCRIPTION = A boolean value to indicate if the HiColorNorm pipeline should create the unfiltered color cube that has not passed through the noise or furrow filtering corrections LAST_UPDATE = 2011-05-17 13:51:59.0
The result of this execution will be an exit code of 0 and no output
Pipeline_Configuration \ -configuration ~/HiRISE/Configuration/EDRgen/EDRgen.conf \ -pipeline HiColorNorm \ -parameter Make_Unfiltered_Cube \ -write \ -value FALSE \ -validation "TRUE|FALSE|true|false"
Note that for write operations the -write option must be specified.
The result will be no output; the application will produce an exit status value of zero if there were no errors.
Modifier and Type | Class and Description |
---|---|
static class |
Pipeline_Configuration.Conf
The fields of a record in the Pipeline_Configuration database table.
|
static class |
Pipeline_Configuration.ExitCode
Application exit status values.
|
static class |
Pipeline_Configuration.Validator
A Validatorcontains a list of commonly used validators for
typical values.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DATABASE_TABLE_NAME
The default table name.
|
static String |
ID
Class identification name with source code version and date.
|
Constructor and Description |
---|
Pipeline_Configuration(Database database,
String catalog,
String table,
String pipeline)
Constructs a Pipeline_Configuration with non-strict semantics.
|
Pipeline_Configuration(Database database,
String catalog,
String table,
String pipeline,
boolean strict)
Constructs a Pipeline_Configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
buildConfigurationTable(String catalog,
String table)
Build a configuration table given a database catalog and table name.
|
void |
close()
Close the database connection.
|
static void |
main(String[] args)
Application main.
|
Pipeline_Configuration.Conf |
read(String parameter)
Read the most up-to-date row for a parameter.
|
void |
write(Pipeline_Configuration.Conf conf)
Write a configuration (Conf) for a parameter into a table record.
|
void |
write(String parameter,
String value)
Write a simple parameter-value pair into a table record.
|
void |
write(String parameter,
String value,
String validation)
Write a parameter-value pair with validation string into a table record.
|
void |
write(String parameter,
String value,
String validation,
String description)
Write a parameter-value pair with validation string and description
into a table record.
|
public static final String ID
public static final String DEFAULT_DATABASE_TABLE_NAME
public Pipeline_Configuration(Database database, String catalog, String table, String pipeline)
database
- The Database object providing access to the
database contents.catalog
- The name of catalog in the database where the database
tables are located.table
- The name of the table to use for pipeline
configuration queries.pipeline
- The name of the pipeline to query for parameters.public Pipeline_Configuration(Database database, String catalog, String table, String pipeline, boolean strict)
database
- The Database object providing access to the
database contents.catalog
- The name of catalog in the database where the database
tables are located.table
- The name of the table to use for pipeline
configuration queries.pipeline
- The name of the pipeline to query for parameters.strict
- A flag that indicates whether to treat validation failures
as global errors.public Pipeline_Configuration.Conf read(String parameter)
parameter
- The name of a parameter in the table for which
to read the record.Pipeline_Configuration.Conf
containing all the field values of the record.public void write(String parameter, String value)
parameter
- The parameter name.value
- The value String for the parameter.public void write(String parameter, String value, String validation)
parameter
- The parameter name.value
- The value String for the parameter.validation
- The validation String for the value.public void write(String parameter, String value, String validation, String description)
parameter
- The parameter name.value
- The value String for the parameter.validation
- The validation String for the value.description
- The description String for the parameter.public void write(Pipeline_Configuration.Conf conf)
write
methods are
preferable; they use this method.conf
- A Pipeline_Configuration.Conf
object which contains the field
values of the record to be inserted into the tablepublic void close()
public void buildConfigurationTable(String catalog, String table) throws Database_Exception
catalog
- The name of the database catalog to contain the table.table
- The name of the database table for containing
configuration parameters.Database_Exception
- if the database table could not be created.public static void main(String[] args)
args
- The program command-line arguments.