HiRISE

HiRISE.HiCat.Utilities
Class Description_Check

java.lang.Object
  extended by HiRISE.HiCat.Utilities.Description_Check

public class Description_Check
extends Object

A utility class for checking the STL_DESCRIPTION and RATIONALE_DESC fields within the HiCat database and the appropriate fields within the PDS labels of HiRISE products.

Configuration and Usage

Since the main method is expected to be be called within the context of a cron job, a configuration file is needed to specify database connection parameters as well as logging locations and where notification emails should be sent.

The configuration file should be a PVL file containing database connection parameters, a Log_Dir parameter specifying the location to create log files, and a notify parameter containing a list of email addresses that should be notified when mismatched descriptions are found.

Product label checking via http has been implemented to work around single threaded nfs problems. Label checking via http is now the default label checking method, to check label using the local file system use the runLabelChecksLocally(boolean) method.

Checking labels via http assumes a url path that matches the HiRISE file system layout such that http:/host/HiRISE/Data//... are valid urls on the webserver.

System Properties and Debugging

Several system properties may be enabled to output different sorts of debugging information during program execution. The system property names are defined by the various DEBUG* static variables defined below.

Version:
1.59
Author:
Rodney Heyd UA/PIRL

Field Summary
static String[] Bad_Characters_List
          This is the list of regexp character names that should not appear within the Rationale_Desc fields of HiRISE Images.
static String DEBUG_DISABLE_LABEL_PARSING
          System properties related to debugging.
static String DEBUG_HTTP_PROPERTY
          System properties related to debugging.
static String DEBUG_LABEL_PROPERTY
          System properties related to debugging.
static String DEBUG_QUERIES_PROPERTY
          System properties related to debugging.
static String DEBUG_QUEUES_PROPERTY
          System properties related to debugging.
static String DEFAULT_BASE_URL
          The base URL to use for http label queries
static String DEFAULT_CONFIGURATION_FILENAME
           
static String DEFAULT_FROM_ADDRESS
           
static int DEFAULT_RETRY_COUNT
          The default number of times to attempt to read a product label if the first attempt fails due to an IO error of some kind.
static String ID
           
 
Constructor Summary
Description_Check(Configuration configuration)
          Instantiate a Description_Check object to perform checks on the product descriptions of HiRISE products.
 
Method Summary
 Vector<Vector<String>> Check_EDR_Rationale_Desc(String observation_id)
          Checks the RATIONALE_DESC field in the EDR_Products table against the STL_DESCRIPTION field in the Suggested_Observations table.
 Vector<Vector<String>> Check_Product_Label_Desc(String observation_id)
           
 Vector<Vector<String>> Check_RDR_Rationale_Desc(String observation_id)
          Checks the RATIONALE_DESC field in the RDR_Products table against the STL_DESCRIPTION field in the Suggested_Observations table.
 Vector<Vector<String>> Check_STL_Descriptions(boolean all_descriptions, boolean cal_descriptions, String observation_id)
          Checks the Suggested_Observations.STL_DESCRIPTION field for bad characters.
 void checkEDRProductsLabels(boolean label_check)
          This setting controls whether or not the EDR Product labels will be checked.
 int Checker_Threads()
          Get the current number of threads that will be created to check the RATIONALE_DESC parameter in the product label files.
 void Checker_Threads(int thread_number)
          Sets the number of threads to use when checking product labels.
 void checkRDRProductLabels(boolean label_check)
          This setting controls whether or not the RDR Product labels are to be checked.
static void main(String[] arguments)
          Check the descriptions of HiRISE Products.
 int productErrorCount()
           
 void runLabelChecksLocally(boolean local)
          Should the label check operation be performed on local files? If set to true, then the label check operations will be performed using locally mounted file systems.
static void Usage(int status)
          Prints command line usage syntax
 boolean Verbose()
          Get the current verbose status
 void Verbose(boolean verbose)
          Turn verbose status to true or false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILENAME

public static final String DEFAULT_CONFIGURATION_FILENAME
See Also:
Constant Field Values

DEFAULT_BASE_URL

public static final String DEFAULT_BASE_URL
The base URL to use for http label queries

See Also:
Constant Field Values

DEFAULT_FROM_ADDRESS

public static final String DEFAULT_FROM_ADDRESS
See Also:
Constant Field Values

DEBUG_HTTP_PROPERTY

public static final String DEBUG_HTTP_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_QUERIES_PROPERTY

public static final String DEBUG_QUERIES_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_LABEL_PROPERTY

public static final String DEBUG_LABEL_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_QUEUES_PROPERTY

public static final String DEBUG_QUEUES_PROPERTY
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEBUG_DISABLE_LABEL_PARSING

public static final String DEBUG_DISABLE_LABEL_PARSING
System properties related to debugging. Setting any of these system properties to true will cause additional debugging information to be output during the program execution that relates to operations named by the property. In addition, full stack traces will be output to stdout for any exceptions that are thrown during the execution of the program while if any of these properties are set prior to the initialization of the class.

See Also:
Constant Field Values

DEFAULT_RETRY_COUNT

public static final int DEFAULT_RETRY_COUNT
The default number of times to attempt to read a product label if the first attempt fails due to an IO error of some kind.

See Also:
Constant Field Values

Bad_Characters_List

public static final String[] Bad_Characters_List
This is the list of regexp character names that should not appear within the Rationale_Desc fields of HiRISE Images. The names are defined in the regular expression documentation on the mysql website.

Constructor Detail

Description_Check

public Description_Check(Configuration configuration)
                  throws Database_Exception,
                         Configuration_Exception
Instantiate a Description_Check object to perform checks on the product descriptions of HiRISE products.

Parameters:
configuration - A Configuration containing database connection parameters
Throws:
Database_Exception - - if a database connection connot be established
Configuration_Exception - - if the configuration does not contain the required connection parameters
Method Detail

Check_STL_Descriptions

public Vector<Vector<String>> Check_STL_Descriptions(boolean all_descriptions,
                                                     boolean cal_descriptions,
                                                     String observation_id)
                                              throws Database_Exception
Checks the Suggested_Observations.STL_DESCRIPTION field for bad characters.

Parameters:
all_descriptions - if true, then all suggestions will be checked. If false, then only suggestions associated with acquired observations will be checked.
cal_descriptions - if true, the suggestions with a TARGET_NAME of CAL will be checked.
observation_id - if this a non-null value, then this will restrict the checked suggestions to RETIRING_OBSERVATION_IDs that match this value. If the value is null, then this restriction will not be applied.
Returns:
A vector of vectors containing the ID, OBSERVATION_ID, and STL_DESCRIPTION of suggestions which half STL_DESCRIPTIONS contianing one or more illegal characters.
Throws:
Database_Exception - - if the database query could not be executed.

Check_EDR_Rationale_Desc

public Vector<Vector<String>> Check_EDR_Rationale_Desc(String observation_id)
                                                throws Database_Exception
Checks the RATIONALE_DESC field in the EDR_Products table against the STL_DESCRIPTION field in the Suggested_Observations table.

Parameters:
observation_id - If the observation_id is a non-null value, only EDRs with observation ids matching this value will be checked. If null, then no observation id restriction will be applied.
Returns:
A Vector of Vectors containing the Suggestion ID, the Product_ID, the STL_DESCRIPTION from the Suggested_Observations table, and the RATIONALE_DESC from the EDR_Products table where the STL_DESCRIPTION does not match the RATIONALE_DESC.
Throws:
Database_Exception

Check_RDR_Rationale_Desc

public Vector<Vector<String>> Check_RDR_Rationale_Desc(String observation_id)
                                                throws Database_Exception
Checks the RATIONALE_DESC field in the RDR_Products table against the STL_DESCRIPTION field in the Suggested_Observations table.

Parameters:
observation_id - If the observation_id is a non-null value, only EDRs with observation ids matching this value will be checked. If null, then no observation id restriction will be applied.
Returns:
A Vector of Vectors containing the Suggestion ID, the Product_ID, the STL_DESCRIPTION from the Suggested_Observations table, and the RATIONALE_DESC from the RDR_Products table where the STL_DESCRIPTION does not match the RATIONALE_DESC.
Throws:
Database_Exception

Check_Product_Label_Desc

public Vector<Vector<String>> Check_Product_Label_Desc(String observation_id)
                                                throws Database_Exception
Throws:
Database_Exception

Verbose

public void Verbose(boolean verbose)
Turn verbose status to true or false. This only applies to the product label checking function. If set to true, then each label file will be listed on standard out as the file is checked. (Default: false).

Parameters:
verbose - - a boolean value, if true then extra status information is printed to standard out.

Verbose

public boolean Verbose()
Get the current verbose status

Returns:
- true of verbose status reporting is turned on, false otherwise.

Checker_Threads

public void Checker_Threads(int thread_number)
Sets the number of threads to use when checking product labels. The default is 28 threads. If the number of threads are to be changed, then this method should be called prior to calling the Check_Product_Label_Desc(String) method.

Parameters:
thread_number - - the number of parallel threads to use to speed up label checking

Checker_Threads

public int Checker_Threads()
Get the current number of threads that will be created to check the RATIONALE_DESC parameter in the product label files.

Returns:
an integer containing the number of threads to create.

checkEDRProductsLabels

public void checkEDRProductsLabels(boolean label_check)
This setting controls whether or not the EDR Product labels will be checked. By default, this setting is true.

Parameters:
label_check -

checkRDRProductLabels

public void checkRDRProductLabels(boolean label_check)
This setting controls whether or not the RDR Product labels are to be checked. By default this setting is true.

Parameters:
label_check -

runLabelChecksLocally

public void runLabelChecksLocally(boolean local)
Should the label check operation be performed on local files? If set to true, then the label check operations will be performed using locally mounted file systems. If set to false, then the labels will be downloaded via http.

Parameters:
local - - boolean, if true, then label checks will be performed locally.

productErrorCount

public int productErrorCount()

main

public static void main(String[] arguments)
Check the descriptions of HiRISE Products.

The command line syntax is described by the Usage method.

Each filename specified will be unretired, some suggestions may need to be cloned rather than simply unretired.

Exit Status Values

0 - Success
1 - Configuration Error
2 - Database Error
3 - Command Line Syntax Error

Parameters:
arguments - an array of command line arguments

Usage

public static final void Usage(int status)
Prints command line usage syntax

Usage: Description_Check <Options>
  Options: -
    [-Configuration <filename>]
    [-EDR_Descriptions_Check]
    [-File_Checks_Run_Locally]
    [-Help]
    [-Iclude_Cal_Descriptions]
    [-Log_to_file]
    [-Mail_report]
    [-NE]  negate EDR Product checks
    [-NR]  negate RDR Product checks
    [-Product_Descriptions_Check]
    [-RDR_Descriptions_Check]
    [-STL_Descriptions_Check]
    [-Threads <number of threads>]
    [-Verbose]

Parameters:
status - - the exit status to return

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona