HiRISE

HiRISE.DTM
Class Archive_DTM

java.lang.Object
  extended by HiRISE.DTM.Archive_DTM

public class Archive_DTM
extends Object

An application for archiving DTM products into a standard area and ingesting product metadata into a database.

The configuration file needs to contain references to several resources that aid in the ingestion of product metadata into the database. The configuration file should look something like this:

 @INCLUDE  = "/HiRISE/Configuration/HiROC.conf"
 Server  = HiCat

 Group  = DTM

 ORTHO_MAP                      = "PVL_to_DB.ORTHO"
 DTM_MAP                                = "PVL_to_DB.DTM"
 EXTRA_MAP                      = "Added_Params.map"

 DTM_ROOT_DIR                   = "/HiRISE/Data/DTM"
 DTM_EXTRAS_ROOT_DIR            = "/HiRISE/Data/Extras/DTM"

 EndGroup
 End
 

The ORTHO_MAP, DTM_MAP, and EXTRA_MAP parameters refer to PVL_to_DB map files which are used to map product metadata from various products and files that are created during the DTM production procedure into the database.

The DTM_ROOT_DIR and DTM_EXTRAS_ROOT_DIR parameters specify the archive locations on the filesystem for the different DTM product types. Note: This directories are not the location of the staging area where products might be stored prior to archiving.

TODO:

Version:
1.26
Author:
Rodney Heyd UA/HiRISE

Field Summary
static String DEBUG_ARCHIVE_PROPERTY
           
static String DEBUG_EXTRA_SOURCE_PROPERTY
           
static String DEBUG_EXTRAS_PROPERTY
           
static String DEBUG_LABEL_SOURCE_PROPERTY
           
static String DEBUG_MAIN_PROPERTY
           
static String DEBUG_MAP_PROPERTY
           
static String DEBUG_PRODUCT_TYPE_PROPERTY
           
static String DEFAULT_CONFIGURATION_FILENAME
           
static int EXIT_COMMAND_LINE_SYNTAX_ERROR
           
static int EXIT_CONFIGURATION_ERROR
           
static int EXIT_DATABASE_ERROR
           
static int EXIT_IO_ERROR
           
static int EXIT_MAP_SYNTAX_ERROR
           
static int EXIT_MISSING_FILE_ERROR
           
static int EXIT_PARSE_ERROR
           
static int EXIT_PVL_ERROR
           
static int EXIT_SUCCESS
           
static int EXIT_UNRESOLVED_REFERENCE_ERROR
           
static String ID
          Class identifier
 
Constructor Summary
Archive_DTM(String configurationFile)
          Instantiate the archiver
 
Method Summary
 void archiveExtrasProducts(String data_dir)
          Archive the extras products found in the given data directory and ingest the file metadata into a database.
 void archiveProducts(String data_dir)
          Archive the standard PDS products found in the given data directory and ingest the product metadata into a database.
 String getBaseDir()
          Get the base directory, ie the working directory for the application.
static String getDTMProductType(String product_id)
          A convenience method to aid in determining the type of standard product based on the information encoded in the product ID.
 Vector<File> getExtrasFiles(String basedir)
          Get a list of extras files found in the given directory.
 boolean getNoop()
          Get the noop flag setting.
 String getOrbitDirectory(Parameter product_id, Parameter source_products)
           
 boolean getOverWriteFiles()
           
 String getProductDir(Parameter product_id, Parameter source_products)
          Get the product directory the input product should be stored in
 Vector<File> getProductFiles(String basedir)
          Get the list of product files to be found in the given base directory.
 int getSequenceNumber(Parameter product_id)
           
 boolean getVerbose()
          Get the current verbose setting.
static void main(String[] arguments)
          Archive HiRISE DTM PDS products and associated extras.
 void setBaseDir(String basedir)
          Set the base directory location.
 void setNoop(boolean noop)
          Set the noop flag, if noop is true, then no operations will be performed.
 void setOverWriteFiles(boolean overwrite)
           
 void setVerbose(boolean verbose)
          Output additional status information while archiving.
static void Usage()
          Prints the command line usage syntax.
 
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
Class identifier

See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILENAME

public static final String DEFAULT_CONFIGURATION_FILENAME
See Also:
Constant Field Values

EXIT_SUCCESS

public static final int EXIT_SUCCESS
See Also:
Constant Field Values

EXIT_CONFIGURATION_ERROR

public static final int EXIT_CONFIGURATION_ERROR
See Also:
Constant Field Values

EXIT_DATABASE_ERROR

public static final int EXIT_DATABASE_ERROR
See Also:
Constant Field Values

EXIT_PVL_ERROR

public static final int EXIT_PVL_ERROR
See Also:
Constant Field Values

EXIT_IO_ERROR

public static final int EXIT_IO_ERROR
See Also:
Constant Field Values

EXIT_PARSE_ERROR

public static final int EXIT_PARSE_ERROR
See Also:
Constant Field Values

EXIT_MAP_SYNTAX_ERROR

public static final int EXIT_MAP_SYNTAX_ERROR
See Also:
Constant Field Values

EXIT_UNRESOLVED_REFERENCE_ERROR

public static final int EXIT_UNRESOLVED_REFERENCE_ERROR
See Also:
Constant Field Values

EXIT_COMMAND_LINE_SYNTAX_ERROR

public static final int EXIT_COMMAND_LINE_SYNTAX_ERROR
See Also:
Constant Field Values

EXIT_MISSING_FILE_ERROR

public static final int EXIT_MISSING_FILE_ERROR
See Also:
Constant Field Values

DEBUG_MAP_PROPERTY

public static final String DEBUG_MAP_PROPERTY
See Also:
Constant Field Values

DEBUG_EXTRA_SOURCE_PROPERTY

public static final String DEBUG_EXTRA_SOURCE_PROPERTY
See Also:
Constant Field Values

DEBUG_LABEL_SOURCE_PROPERTY

public static final String DEBUG_LABEL_SOURCE_PROPERTY
See Also:
Constant Field Values

DEBUG_EXTRAS_PROPERTY

public static final String DEBUG_EXTRAS_PROPERTY
See Also:
Constant Field Values

DEBUG_PRODUCT_TYPE_PROPERTY

public static final String DEBUG_PRODUCT_TYPE_PROPERTY
See Also:
Constant Field Values

DEBUG_ARCHIVE_PROPERTY

public static final String DEBUG_ARCHIVE_PROPERTY
See Also:
Constant Field Values

DEBUG_MAIN_PROPERTY

public static final String DEBUG_MAIN_PROPERTY
See Also:
Constant Field Values
Constructor Detail

Archive_DTM

public Archive_DTM(String configurationFile)
            throws Configuration_Exception,
                   Database_Exception,
                   PVL_Exception
Instantiate the archiver

Parameters:
configurationFile - The configuration file name
Throws:
Configuration_Exception - If the configuration file is malformed or does not exist
Database_Exception - if a database connection cannot be established
PVL_Exception - if any of the map files listed in the configuration file are missing or unreadable.
Method Detail

setBaseDir

public void setBaseDir(String basedir)
Set the base directory location. This is the directory that contains the products to be archived, ie the product staging area.


getBaseDir

public String getBaseDir()
Get the base directory, ie the working directory for the application. This is the directory that contains the products to be archived, ie the product staging area.

Returns:
a string naming the current base directory

getProductDir

public String getProductDir(Parameter product_id,
                            Parameter source_products)
                     throws Invalid_Argument_Exception,
                            PVL_Exception
Get the product directory the input product should be stored in

Parameters:
product_id -
source_products -
Returns:
a String containing the product directory name
Throws:
Invalid_Argument_Exception
PVL_Exception

getOrbitDirectory

public String getOrbitDirectory(Parameter product_id,
                                Parameter source_products)
                         throws PVL_Exception,
                                NumberFormatException,
                                Out_of_Range_Exception,
                                Invalid_Argument_Exception
Throws:
PVL_Exception
NumberFormatException
Out_of_Range_Exception
Invalid_Argument_Exception

getSequenceNumber

public int getSequenceNumber(Parameter product_id)
                      throws Invalid_Argument_Exception,
                             PVL_Exception
Throws:
Invalid_Argument_Exception
PVL_Exception

getProductFiles

public Vector<File> getProductFiles(String basedir)
                             throws IOException,
                                    PVL_Exception,
                                    Database_Exception
Get the list of product files to be found in the given base directory. This list only contains standard product files (eg, *.IMG, *.LBL, or *.JP2 files), files with other extensions will be excluded.

Parameters:
basedir - - the directory containing the product files.
Returns:
a Vector of Files with the list of standard PDS products
Throws:
IOException - if any of the products in the file list can't be accessed.
PVL_Exception - if the pvl file containing extra metadata cannot be read.
Database_Exception

getExtrasFiles

public Vector<File> getExtrasFiles(String basedir)
                            throws IOException
Get a list of extras files found in the given directory.

Parameters:
basedir - - the directory containing the list of extras files to be archived.
Returns:
- A Vector of Files listing the extras found in the base directory.
Throws:
IOException - if any of the files cannot be accessed.

getDTMProductType

public static String getDTMProductType(String product_id)
A convenience method to aid in determining the type of standard product based on the information encoded in the product ID.

Parameters:
product_id - - product id to use to determine the product type.
Returns:
a String having one of the values, DTM, LEFT_ORTHOIMAGE, RIGHT_ORTHOIMAGE, or unknown if the product type cannot be determined.

archiveProducts

public void archiveProducts(String data_dir)
                     throws IOException,
                            PVL_Exception,
                            Configuration_Exception,
                            ParseException,
                            Database_Exception,
                            Invalid_Map_Syntax,
                            Unresolved_Reference,
                            InterruptedException,
                            Invalid_Argument_Exception,
                            NumberFormatException,
                            Out_of_Range_Exception
Archive the standard PDS products found in the given data directory and ingest the product metadata into a database.

Parameters:
data_dir - - a staging directory containing PDS products to be archived.
Throws:
IOException
PVL_Exception
Configuration_Exception
ParseException
Database_Exception
Invalid_Map_Syntax
Unresolved_Reference
InterruptedException
Invalid_Argument_Exception
Out_of_Range_Exception
NumberFormatException

archiveExtrasProducts

public void archiveExtrasProducts(String data_dir)
                           throws IOException,
                                  Database_Exception,
                                  InterruptedException
Archive the extras products found in the given data directory and ingest the file metadata into a database.

Parameters:
data_dir - - the directory containing the extras files.
Throws:
IOException
Database_Exception
InterruptedException

setOverWriteFiles

public void setOverWriteFiles(boolean overwrite)

getOverWriteFiles

public boolean getOverWriteFiles()

setNoop

public void setNoop(boolean noop)
Set the noop flag, if noop is true, then no operations will be performed.

Parameters:
noop - - the noop flag, set to true to test the operations without archiving or ingesting any metadata.

getNoop

public boolean getNoop()
Get the noop flag setting.

Returns:
the value of the noop flag.

setVerbose

public void setVerbose(boolean verbose)
Output additional status information while archiving.

Parameters:
verbose -

getVerbose

public boolean getVerbose()
Get the current verbose setting.

Returns:
the boolean verbose value

main

public static void main(String[] arguments)
Archive HiRISE DTM PDS products and associated extras.

Command line syntax is described in the Usage() method.

Exit status values:

0 - Success 1 - Configuration Error 2 - Database Error 3 - PVL Syntax Error 4 - Input/Output Error 5 - Parsing Error (pvl parsing error) 6 - Map Error (pvl to db map error) 7 - Unresolved Reference Error 8 - Command line Syntax Error 9 - Missing File Error

Parameters:
arguments - - command line arguments
See Also:
Usage()

Usage

public static void Usage()
Prints the command line usage syntax.

Usage: HiTList <Options>
  Options -
    [-Configuration <filename>]
      (default: /HiRISE/Configuration/DTM/DTM.conf)
    [-Data_dir <directory>]
    [-Extras_dir <directory>]
    [-Help]
    [-Overwrite_Extras]
    [-Verbose]


HiRISE

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