public abstract class Database_Loader
extends java.lang.Object
At the time of writing this class, the only use is for importing geospatial data for a WFS server. So, as a caution, the WFS server expects all values to be in a -180,180 range. More specifically the HiRISE hosted server requires these values to be 'ocentric latitude and east positive longitude.
See this
utilities class for more information
on converting from 'ographic to 'ocentric values.
Modifier and Type | Field and Description |
---|---|
protected int |
Current_Entry
The entry that the class has currently read up to.
|
protected Loaded_Database |
database
The data storage object for the database
|
static java.lang.String |
DEFAULT_CONFIG_FILENAME
The default configuration file name
|
static int |
DEFAULT_MAX_ENTRIES
The default value for the maxium number of entries
|
static int |
ERROR
Status indicating that an error has occurred
|
protected java.lang.String |
Error_Message
Error message when an error occurs
|
static int |
FINISHED
Status indicating the database has been fully read.
|
static java.lang.String |
ID
The class identification with revision and date
|
protected int |
Max_Entries
The maximum number of entries that can be stored from the database at one time.
|
static int |
OUT_OF_MEMORY
Status indicating the database has not been fully read
but that there are memory issues and the max entries should
be reduced.
|
protected int |
Status
The status of the class
|
static int |
UNFINISHED
Status indicating the database has not been fully read in yet.
|
Constructor and Description |
---|
Database_Loader() |
Modifier and Type | Method and Description |
---|---|
void |
Clear_Data()
This method clears the data from the Loaded_Database
|
int |
Get_Current_Entry()
This method gets the current entry.
|
java.util.Vector<java.util.Vector<java.lang.String>> |
Get_Data()
This method returns the data from the Loaded_Database of this loader
|
java.lang.String |
Get_Error_Message()
This method gets the stored Error Message from this class
|
java.util.Vector<java.lang.String> |
Get_Fields()
This method gets the list of fields from the database
|
int |
Get_Max_Entries()
This method gets the maximum number of entries to read at one time
|
int |
Get_Status()
This method gets the current status of the loader
|
void |
Initialize(PIRL.Configuration.Configuration config,
java.lang.String loaded_database_group)
This method initializes the loader
|
void |
Initialize(PIRL.Configuration.Configuration config,
java.lang.String loaded_database_group,
int max_entries)
This method initializes the loader
|
void |
Initialize(java.lang.String config_filename,
java.lang.String loaded_database_group)
This method initializes the loader
|
void |
Initialize(java.lang.String config_filename,
java.lang.String loaded_database_group,
int max_entries)
This method initializes the loader
|
abstract void |
Load_Database()
This is the method that is supposed to do the work of loading the database
|
abstract void |
Load_Fields()
This is the method that will be run to load the fields of the database.
|
java.util.Vector<java.util.Vector<java.lang.String>> |
Remove_Data()
This method returns and then removes the data in the Loaded_Database
|
void |
Set_Configuration(PIRL.Configuration.Configuration config)
This method sets the configuration to a new configuration
|
void |
Set_Configuration(java.lang.String filename)
This method sets the configuration to a new configuration
|
void |
Set_Current_Entry(int entry)
This method sets the current entry for the database
|
void |
Set_Max_Entries(int max)
This method sets the maximum number of entries to read at one time
|
boolean |
Validate()
This method gets the validation status of the database
|
public static final java.lang.String ID
protected Loaded_Database database
public static final java.lang.String DEFAULT_CONFIG_FILENAME
protected int Max_Entries
public static final int DEFAULT_MAX_ENTRIES
protected int Current_Entry
protected int Status
public static final int UNFINISHED
public static final int FINISHED
public static final int OUT_OF_MEMORY
public static final int ERROR
protected java.lang.String Error_Message
public void Initialize(java.lang.String config_filename, java.lang.String loaded_database_group, int max_entries) throws PIRL.Configuration.Configuration_Exception
This sets up the Configuration from a file, the database group for this class,
and the maximum number of entries to read in at a time. The status is set to
UNFINISHED
and the Current_Entry is set to 0 and the Error_Message is set to the
empty String.
config_filename
- The configuration file nameloaded_database_group
- The group in the database that contains this class's informationmax_entries
- The maximum number of entries to read at oncePIRL.Configuration.Configuration_Exception
- Thrown when the creation of the configuration fails.public void Initialize(PIRL.Configuration.Configuration config, java.lang.String loaded_database_group, int max_entries)
This sets up the Configuration from a Configuration object, the database group for this class,
and the maximum number of entries to read in at a time. The status is set to
UNFINISHED
and the Current_Entry is set to 0 and the Error_Message is set to the
empty String.
config
- The configuration objectloaded_database_group
- The group in the database that contains this class's informationmax_entries
- The maximum number of entries to read at oncepublic void Initialize(java.lang.String config_filename, java.lang.String loaded_database_group) throws PIRL.Configuration.Configuration_Exception
This sets up the configuration from a file, the database group for this class,
and sets the maximum number of entries to read in at a time to the default. The status is
set to UNFINISHED
and the Current_Entry is set to 0 and the Error_Message is set to the
empty String.
config_filename
- The configuration file nameloaded_database_group
- The group in the database that contains this class's informationPIRL.Configuration.Configuration_Exception
- Thrown when the creation of the configuration fails.public void Initialize(PIRL.Configuration.Configuration config, java.lang.String loaded_database_group)
This sets up the configuration from a Configuration object, the database group for this class,
and sets the maximum number of entries to read in at a time to the default. The status is
set to UNFINISHED
and the Current_Entry is set to 0 and the Error_Message is set to the
empty String.
config
- The configuration objectloaded_database_group
- The group in the database that contains this class's informationpublic void Set_Configuration(java.lang.String filename) throws PIRL.Configuration.Configuration_Exception
filename
- The filename of the new configuration.PIRL.Configuration.Configuration_Exception
- Thrown when the creation of the configuration fails.public void Set_Configuration(PIRL.Configuration.Configuration config)
config
- The new configuration objectpublic void Set_Current_Entry(int entry)
entry
- The entry number.public int Get_Current_Entry()
public void Set_Max_Entries(int max)
max
- the maximum number of entriespublic int Get_Max_Entries()
public int Get_Status()
public java.util.Vector<java.util.Vector<java.lang.String>> Get_Data()
public java.util.Vector<java.util.Vector<java.lang.String>> Remove_Data()
public void Clear_Data()
public java.util.Vector<java.lang.String> Get_Fields()
public boolean Validate()
public java.lang.String Get_Error_Message()
public abstract void Load_Fields()
This method will be run before the Load_Database()
method.
The fields from the source database should be loaded into the Loaded_Database
object with this method.
To remain generic and yet still handle errors, the Error
status may
be used to report problems with operation. The Error_Message
String may be used to store information about the error.
There is a method in the Loaded_Database
class that will attempt to read in fields from a PVL parameter file stored at a URL.
It may be useful when implementing this method.
public abstract void Load_Database()
A class extending this abstract class needs to only make sure that it loads its database into the Loaded_Database object of this class correctly. See the Loaded_Database class for more information.
After being loaded into the Loaded_Database object the other methods of this class will be run by whatever program is using it to gather information and verify data integrity as necessary.
This method should add no more than the maximum specified entries
to the
Loaded_Database object at a time. Once hitting that limit the status should
be set accordingly to UNFINISHED
. Only when the entire
database has been read in (however that may be defined but the extending class)
should the status be set to FINISHED
. The OUT_OF_MEMORY
status should be used to indicate that the maximum specified entries
may be set too high.
To remain generic and yet still handle errors, the Error
status
may be used to report problems with operation. The Error_Message
String may be used to store information about the error.
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona