HiRISE

HiRISE.HiCat.Utilities
Class CTX_Database_Loader

java.lang.Object
  extended by HiRISE.HiCat.Utilities.Database_Loader
      extended by HiRISE.HiCat.Utilities.CTX_Database_Loader

public class CTX_Database_Loader
extends Database_Loader

This class specifies the logic behind loading a CTX database from a PDS data volume.

The information for the main operation of this class can be found under the Load_Database() and Load_Fields() methods.

Version:
1.2
Author:
Sean Whitsitt - UA/PIRL
See Also:
PIRL.Configuration, Loaded_Database

Field Summary
static long DEFAULT_ENTRY_BYTES
          The default number of bytes in an entry
static String DEFAULT_LABEL
          The Default Label URL if one is not otherwise specified
static String DEFAULT_URL
          The Default URL if one is not otherwise specified
static String ID
          The Class identification with revision number
 
Fields inherited from class HiRISE.HiCat.Utilities.Database_Loader
Current_Entry, database, DEFAULT_CONFIG_FILENAME, DEFAULT_MAX_ENTRIES, ERROR, Error_Message, FINISHED, Max_Entries, OUT_OF_MEMORY, Status, UNFINISHED
 
Constructor Summary
CTX_Database_Loader()
          Creates the loader with the default URL, the default number of bytes in an entry, and the default label URL..
CTX_Database_Loader(String url)
          Creates the loader with the specified URL, the default number of bytes in an entry, and the default label URL.
CTX_Database_Loader(String url, String label)
          Creates the loader with the specified URL, the specified Label and the default number of bytes in an entry.
CTX_Database_Loader(String url, String label, String bytes)
          Creates the loader with the specified URL, the specified label, and the specified bytes per entry.
CTX_Database_Loader(URL url)
          Creates the loader with the specified URL, the default number of bytes in an entry, and the default label URL..
 
Method Summary
 URL Get_URL()
          Gets the current URL object.
 void Load_Database()
          Loads the CTX database from the PDS data volume at the currently specified URL.
 void Load_Fields()
          This method adds fields to the database.
static String PDS_To_MYSQL_Datetime(String pds)
          This method will convert a pds datetime to a mysql datetime
 void Set_URL(String url)
          Sets the URL to a new URL.
 void Set_URL(URL url)
          Sets the URL to a new URL.
 
Methods inherited from class HiRISE.HiCat.Utilities.Database_Loader
Clear_Data, Get_Current_Entry, Get_Data, Get_Error_Message, Get_Fields, Get_Max_Entries, Get_Status, Initialize, Initialize, Initialize, Initialize, Remove_Data, Set_Configuration, Set_Configuration, Set_Current_Entry, Set_Max_Entries, Validate
 
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
The Class identification with revision number

See Also:
Constant Field Values

DEFAULT_URL

public static final String DEFAULT_URL
The Default URL if one is not otherwise specified

See Also:
Constant Field Values

DEFAULT_LABEL

public static final String DEFAULT_LABEL
The Default Label URL if one is not otherwise specified

See Also:
Constant Field Values

DEFAULT_ENTRY_BYTES

public static final long DEFAULT_ENTRY_BYTES
The default number of bytes in an entry

See Also:
Constant Field Values
Constructor Detail

CTX_Database_Loader

public CTX_Database_Loader()
                    throws MalformedURLException
Creates the loader with the default URL, the default number of bytes in an entry, and the default label URL..

Throws:
MalformedURLException - Thrown if the creation of the URL fails.

CTX_Database_Loader

public CTX_Database_Loader(String url)
                    throws MalformedURLException
Creates the loader with the specified URL, the default number of bytes in an entry, and the default label URL.

Parameters:
url - The specified URL as a String.
Throws:
MalformedURLException - Thrown if the creation of the URL fails.

CTX_Database_Loader

public CTX_Database_Loader(URL url)
Creates the loader with the specified URL, the default number of bytes in an entry, and the default label URL..

Parameters:
url - The specified URL as a URL object and the default number of bytes in an entry.

CTX_Database_Loader

public CTX_Database_Loader(String url,
                           String label)
                    throws MalformedURLException
Creates the loader with the specified URL, the specified Label and the default number of bytes in an entry.

Parameters:
url - The specified URL as a String
label - The specified label URL as a String
Throws:
MalformedURLException - Thrown if the creation of the URL fails.

CTX_Database_Loader

public CTX_Database_Loader(String url,
                           String label,
                           String bytes)
                    throws MalformedURLException,
                           NumberFormatException
Creates the loader with the specified URL, the specified label, and the specified bytes per entry.

Parameters:
url - The specified URL as a String.
label - The specified label URL as a String
bytes - The specified bytes per entry as a String
Throws:
MalformedURLException - Thrown if the creation of the URL fails.
NumberFormatException - Thrown if the conversion of the bytes fails.
Method Detail

Set_URL

public void Set_URL(String url)
             throws MalformedURLException
Sets the URL to a new URL.

Parameters:
url - The new URL as a String.
Throws:
MalformedURLException - Thrown if the creation of the URL fails.

Set_URL

public void Set_URL(URL url)
Sets the URL to a new URL.

Parameters:
url - The new URL as a URL object.

Get_URL

public URL Get_URL()
Gets the current URL object.

Returns:
The current URL object.

PDS_To_MYSQL_Datetime

public static String PDS_To_MYSQL_Datetime(String pds)
This method will convert a pds datetime to a mysql datetime

The format seen in the PDS imaging data volumes is "yyyy-mm-ddThh:mm:ss.sss" which this method converts to the format "yyyy-mm-dd hh:mm:ss"

Parameters:
pds - The PDS datetime String
Returns:
The mysql datetime String

Load_Fields

public void Load_Fields()
This method adds fields to the database.

This method adds fields to the database then sets the Unique Key to "PRODUCT_ID". The fields are first cleared from the database so that they cannot be added twice.

Note: The field "LINES" from the PDS data volume has been changed to "IMAGE_LINES" and the fields "ORIGINAL_PRODUCT_ID" and "INSTRUMENT_ID" are not included in the data placed into the database. These alterations should be stored in the configuration file that gets passed to this class in its initialization. See the abstract loader class for more information.

Specified by:
Load_Fields in class Database_Loader

Load_Database

public void Load_Database()
Loads the CTX database from the PDS data volume at the currently specified URL.

This method adds entries line by line to the database. The GIS information for the CENTER and FOOTPRINT fields are created from the longitude/latitude data stored in the PDS data volume. The method should only fail if an IOException is caught or if there are no fields at the time it is run. Then it sets the loader's status to ERROR and puts the message from the exception into the error message.

Note: The "IMAGE_TIME" field is converted using the PDS_To_MYSQL_Datetime method. It is important to note that this action does not occur because of information in the configuration file.

Specified by:
Load_Database in class Database_Loader

HiRISE

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