HiRISE

HiRISE.HiCat.Utilities
Class THEMIS_IR_Database_Loader

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

public class THEMIS_IR_Database_Loader
extends Database_Loader

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

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

A label url can be specified for this class. This is used to load

Version:
1.1
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 URL for the label file.
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
THEMIS_IR_Database_Loader()
          Creates the loader with the default URL, the default entry bytes, and the default label.
THEMIS_IR_Database_Loader(String url)
          Creates the loader with the specified URL, the default entry bytes, and the default label.
THEMIS_IR_Database_Loader(String url, String label)
          Creates the loader with the specified URL, the default entry bytes, and the specified label.
THEMIS_IR_Database_Loader(String url, String label, String bytes)
          Creates the loader with the specified URL, the specified label, and the specified entry bytes.
THEMIS_IR_Database_Loader(URL url)
          Creates the loader with the specified URL, the default entry bytes, and the default label.
 
Method Summary
 URL Get_URL()
          Gets the current URL object.
 void Load_Database()
          Loads the MOC 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 URL for the label file.

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

THEMIS_IR_Database_Loader

public THEMIS_IR_Database_Loader()
                          throws MalformedURLException
Creates the loader with the default URL, the default entry bytes, and the default label.

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

THEMIS_IR_Database_Loader

public THEMIS_IR_Database_Loader(String url)
                          throws MalformedURLException
Creates the loader with the specified URL, the default entry bytes, and the default label.

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

THEMIS_IR_Database_Loader

public THEMIS_IR_Database_Loader(URL url)
Creates the loader with the specified URL, the default entry bytes, and the default label.

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

THEMIS_IR_Database_Loader

public THEMIS_IR_Database_Loader(String url,
                                 String label)
                          throws MalformedURLException
Creates the loader with the specified URL, the default entry bytes, and the specified label.

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

THEMIS_IR_Database_Loader

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

Parameters:
url - The specifed URL as a String
label - The specified URL for the label.
bytes - The specified number of bytes in an entry as a String
Throws:
MalformedURLException - thrown when the URL creation fails.
NumberFormatException - thrown when the bytes is not a properly formated long.
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 "OBSERVATION_ID". The fields are first cleared from the database so that they cannot be added twice.

Specified by:
Load_Fields in class Database_Loader

Load_Database

public void Load_Database()
Loads the MOC 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 in the database when 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 "START_TIME" and "STOP_TIME" fields are converted using the PDS_To_MYSQL_Datetime method.

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