jpl.eda.archive.server
Class ProductTable

java.lang.Object
  extended byjpl.eda.archive.server.ProductTable

public class ProductTable
extends java.lang.Object

This class creates the product metadata and reference tables based on Archive Service policy.

Version:
$Revision: 1.4 $
Author:
OODT

Constructor Summary
ProductTable(java.util.Properties props, boolean isOverwrite)
          Constructor given properties and an overwrite flag.
ProductTable(java.util.Properties props, boolean isOverwrite, java.lang.String datasetName)
          Constructor given properties, an overwrite flag and a dataset name.
 
Method Summary
 boolean checkProductTables(Dataset dataset)
          Check to see if the product tables for the given dataset exist.
 void createForAllDatasets(boolean isOverwrite)
          Initialize creation of the product tables for all of the datasets.
 void createForTheDataset(boolean isOverwrite, java.lang.String datasetName)
          Initialize creation of the product tables for the given dataset.
 void createMetadataTable(Dataset dataset)
          Create the product metadata table for the given dataset.
 void createReferenceTable(Dataset dataset)
          Create the product reference table for the given dataset.
 void determineDbms()
          Determine the DBMS for the database connection.
 void dropMetadataTable(Dataset dataset)
          Drop the product metadata table.
 void dropReferenceTable(Dataset dataset)
          Drop the product reference table.
static void main(java.lang.String[] argv)
          Execute the product table application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductTable

public ProductTable(java.util.Properties props,
                    boolean isOverwrite)
             throws ProductTableException
Constructor given properties and an overwrite flag. This constructor will open a database connection and attempt to create the product metadata and reference tables for each dataset found.

Parameters:
props - The system properties.
isOverwrite - The flag to determine whether existing tables will be overwritten.
Throws:
ProductTableException - If the product tables cannot be created.

ProductTable

public ProductTable(java.util.Properties props,
                    boolean isOverwrite,
                    java.lang.String datasetName)
             throws ProductTableException
Constructor given properties, an overwrite flag and a dataset name. This constructor will open a database connection and attempt to create the product metadata and reference tables for the given dataset.

Parameters:
props - The system properties.
isOverwrite - The flag to determine whether existing tables will be overwritten.
datasetName - The name of the dataset for which the product tables will be created.
Throws:
ProductTableException - If the product tables cannot be created.
Method Detail

determineDbms

public void determineDbms()
                   throws ProductTableException
Determine the DBMS for the database connection. This information will be used for COTS specific coding. Maybe someday this kludge for determining whether we are using an Oracle, Sybase, or PostgreSQL database will be replaced with something slick.

Throws:
ProductTableException - If the DBMS cannot be determined.

createForAllDatasets

public void createForAllDatasets(boolean isOverwrite)
                          throws ProductTableException
Initialize creation of the product tables for all of the datasets.

Parameters:
isOverwrite - The flag to determine whether existing tables will be overwritten.
Throws:
ProductTableException - If the product tables cannot be created.

createForTheDataset

public void createForTheDataset(boolean isOverwrite,
                                java.lang.String datasetName)
                         throws ProductTableException
Initialize creation of the product tables for the given dataset. This method will retrieve the dataset information for the given dataset, check to see if the product tables already exist and then create the product tables for that dataset.

Parameters:
isOverwrite - The flag to determine whether existing tables will be overwritten.
datasetName - The name of the dataset for which the product tables will be created.
Throws:
ProductTableException - If the product tables cannot be created.

checkProductTables

public boolean checkProductTables(Dataset dataset)
                           throws ProductTableException
Check to see if the product tables for the given dataset exist.

Parameters:
dataset - The dataset information.
Throws:
ProductTableException - If the information cannot be retrieved the database.

createMetadataTable

public void createMetadataTable(Dataset dataset)
                         throws ProductTableException
Create the product metadata table for the given dataset.

Parameters:
dataset - The dataset information.
Throws:
ProductTableException - If the product metadata table cannot be created.

dropMetadataTable

public void dropMetadataTable(Dataset dataset)
Drop the product metadata table.


createReferenceTable

public void createReferenceTable(Dataset dataset)
                          throws ProductTableException
Create the product reference table for the given dataset.

Parameters:
dataset - The dataset information.
Throws:
ProductTableException - If the product reference table cannot be created.

dropReferenceTable

public void dropReferenceTable(Dataset dataset)
Drop the product reference table.


main

public static void main(java.lang.String[] argv)

Execute the product table application.

The command line arguments are: datasetName overwriteFlag

The program exits with status 0 on success, 1 on failure.

Parameters:
argv - Command-line arguments.


Copyright © 1999-2005 NASA Jet Propulsion Laboratory, California Institute of Technology. All Rights Reserved.