HiRISE

HiRISE.HiCat.CleanUp
Class EDR_CleanUp

java.lang.Object
  extended by HiRISE.HiCat.CleanUp.Product_CleanUp
      extended by HiRISE.HiCat.CleanUp.EDR_CleanUp
All Implemented Interfaces:
CleanUp

public class EDR_CleanUp
extends Product_CleanUp
implements CleanUp

This class implements the CleanUp interface for HiRISE EDR products.

Version:
$$
Author:
Rodney Heyd (edited by Caleb Hanger) UA/HiRISE
See Also:
CleanUp, Product_CleanUp

Field Summary
static String ARCHIVE_TABLE
           
static String ID
          Class Identifier
static String PRODUCT_TABLE
           
 
Fields inherited from class HiRISE.HiCat.CleanUp.Product_CleanUp
DEFAULT_CONFIGURATION_FILE, isCLI, Property_Changer, Verbose
 
Fields inherited from interface HiRISE.HiCat.CleanUp.CleanUp
ABSOLUTE_MAXIMUM_ORBIT_NUMBER, ANAGLYPH, DEFAULT_MAXIMUM_ORBIT_NUMBER, DEFAULT_MINIMUM_ORBIT_NUMBER, EDR, EDR_EXTRAS, IDLE_STATUS_MESSAGE, INDEX_TABLE_UPDATE_PROPERTY_NAME, MAXIMUM_UPDATES_BEFORE_COMMIT, OLD_VERSION_ID_ALIAS, PREPARE_STATUS_PROPERTY_NAME, PREPARE_STATUS_ROW_PROPERTY_NAME, RDR, RDR_EXTRAS, RELEASED_VERSION_ID_ALIAS, REMOVAL_STATUS_COUNT_PROPERTY_NAME, REMOVING_PRODUCT_PROPERTY_NAME, SEARCH_STATUS_COMPILING_DATA, SEARCH_STATUS_COMPLETE, SEARCH_STATUS_CONSTRUCT, SEARCH_STATUS_EXECUTE, SEARCH_STATUS_PROPERTY_NAME, SEARCH_STATUS_START, Status_Hash
 
Constructor Summary
EDR_CleanUp()
          Construct an instance of the EDR_CleanUp class.
EDR_CleanUp(Configuration configuration)
          Construct an instance of the EDR_CleanUp class using a configuration object
EDR_CleanUp(String configuration_file)
          Construct an instance of the EDR_CleanUp class using the given configuration file.
 
Method Summary
 void Clean_Up_Products(Vector<Product> products)
          Perform the CleanUp operation on a vector of products.
 Vector<String> Column_Names()
          A convenience function allowing other applications, particularly gui's, easy access to the list of columns retrieved from the database during the Product_CleanUp.Find_Products(String, int, int) method call.
 void Create_Archive_Table()
          A convenience method useful during the testing process, as the mysql's archive engine has a number of limitations that are easier to program into this method than to deal with manually.
 void Drop_Archive_Table()
          Drops the archive table for the product, and allows the archive table to be recreated using the Create_Archive_Table() method.
 Vector<Vector<String>> Find_Products(String observation_id, int start_orbit, int end_orbit)
          This method should retrieve a list of products from the database that can be removed from the file system because newer versions of these products have been released.
static void main(String[] args)
           
 Product Product_Data(String product_id, String version, String type)
          This method should create a Product instance by retrieving the product information from the database.
 
Methods inherited from class HiRISE.HiCat.CleanUp.Product_CleanUp
addPropertyChangeListener, File_Status_Tests, Get_Catalog, Get_Configuration, Get_Database, isCLI, isCLI, Print_Progress, Search_Status_Hash, Verbose, Verbose
 
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

ARCHIVE_TABLE

public static final String ARCHIVE_TABLE
See Also:
Constant Field Values

PRODUCT_TABLE

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

EDR_CleanUp

public EDR_CleanUp()
            throws Configuration_Exception,
                   Database_Exception
Construct an instance of the EDR_CleanUp class. The class will be initialized using the default configuration file of the super class.

Throws:
Configuration_Exception - if a problem with the configuration file is found
Database_Exception - if a problem occurs when setting up the database connection.
See Also:
Product_CleanUp, EDR_CleanUp(String)

EDR_CleanUp

public EDR_CleanUp(String configuration_file)
            throws Configuration_Exception,
                   Database_Exception
Construct an instance of the EDR_CleanUp class using the given configuration file.

Parameters:
configuration_file - - a string containing the name of a configuration file
Throws:
Configuration_Exception - if a problem with the configuration file is found
Database_Exception - if a problem occurs when setting up the database connection.

EDR_CleanUp

public EDR_CleanUp(Configuration configuration)
            throws Configuration_Exception,
                   Database_Exception
Construct an instance of the EDR_CleanUp class using a configuration object

Parameters:
configuration -
Throws:
Configuration_Exception - if a problem with the configuration file is found
Database_Exception - if a problem occurs when setting up the database connection.
Method Detail

Clean_Up_Products

public void Clean_Up_Products(Vector<Product> products)
                       throws Database_Exception,
                              IOException
Perform the CleanUp operation on a vector of products. For EDR Products, this procedure involves archiving each products' metadata record in the database in an archive table, removing that record from the production database table, and finally deleting the data and PDS label files from the filesystem. In addition, if the directory containing the product files is empty after the deletion then the product directory will be deleted as well.

Specified by:
Clean_Up_Products in interface CleanUp
Specified by:
Clean_Up_Products in class Product_CleanUp
Parameters:
products - - A Vector of Products to be removed
Throws:
Database_Exception - if a database error occurs during the clean up process.
IOException - if the data or label files for a given product can not be accessed or removed.

Column_Names

public Vector<String> Column_Names()
Description copied from class: Product_CleanUp
A convenience function allowing other applications, particularly gui's, easy access to the list of columns retrieved from the database during the Product_CleanUp.Find_Products(String, int, int) method call.

Specified by:
Column_Names in interface CleanUp
Specified by:
Column_Names in class Product_CleanUp
Returns:
a Vector containing the column names as elements or null if CleanUp.Find_Products(String, int, int) products has not yet been called.

Find_Products

public Vector<Vector<String>> Find_Products(String observation_id,
                                            int start_orbit,
                                            int end_orbit)
                                     throws Database_Exception
Description copied from class: Product_CleanUp
This method should retrieve a list of products from the database that can be removed from the file system because newer versions of these products have been released. The list should not contain any products that have not been released yet, or that are currently released.

Specified by:
Find_Products in interface CleanUp
Specified by:
Find_Products in class Product_CleanUp
Returns:
- A list of products that can be removed from the system, and database records archived.
Throws:
Database_Exception - if a database error occurs during the search

Product_Data

public Product Product_Data(String product_id,
                            String version,
                            String type)
                     throws Database_Exception
Description copied from class: Product_CleanUp
This method should create a Product instance by retrieving the product information from the database. At a minimum the label file, the data file, and the product type should be specified.

Specified by:
Product_Data in interface CleanUp
Specified by:
Product_Data in class Product_CleanUp
Parameters:
product_id - - the product_id to retrieve information for
version - - the version of the product
type - - the type of product
Returns:
A product instance containing product metadata.
Throws:
Database_Exception - - if an error occurs while retrieving product information from the database.

Create_Archive_Table

public void Create_Archive_Table()
                          throws Database_Exception
Description copied from interface: CleanUp
A convenience method useful during the testing process, as the mysql's archive engine has a number of limitations that are easier to program into this method than to deal with manually. This method shouldn't be used within the production environment. This method should not perform any any action when working with products for which no archive table is needed.

Specified by:
Create_Archive_Table in interface CleanUp
Throws:
Database_Exception - if an sql error or database access problem occurs.

Drop_Archive_Table

public void Drop_Archive_Table()
                        throws Database_Exception
Description copied from interface: CleanUp
Drops the archive table for the product, and allows the archive table to be recreated using the Create_Archive_Table() method. This method should not perform any action when working with products for which no archive table is needed.

Specified by:
Drop_Archive_Table in interface CleanUp
Throws:
Database_Exception - if the database operation can not be executed.

main

public static void main(String[] args)
Parameters:
args -

HiRISE

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