net.agmodel.metDriver
Class FAWNMetDB

java.lang.Object
  extended bynet.agmodel.metDriver.FAWNMetDB
All Implemented Interfaces:
DBAccessMechanism, MetAccessMechanism

public class FAWNMetDB
extends Object
implements MetAccessMechanism

Provides access to the FAWN SQL Server database, Institute of Food and Agricultural Sciences (IFAS), University of Florida

Author:
Howard Beck

Constructor Summary
FAWNMetDB(MetSourceForDrivers metSource, Properties properties)
           
 
Method Summary
 void checkForDatabaseUpdates()
          connect to database and check the metadata
 boolean connectForData(String user, String password)
          Called before data is retrieved from the AccessMechanism
 boolean connectForMetaData(String user, String password)
          Called before metadata is retrieved from the AccessMechanism
 void disconnectFromData()
          Called after data is retrieved from the AccessMechanism using connectForData.
 void disconnectFromMetaData()
          Called after meta data is retrieved from the AccessMechanism using connectForMetaData.
 TimeZone getDatabaseTimeZone()
           
 String prepareRequestQuery(MetRequest request, String stationID, StationDataSetImpl result)
           
 void queryForStation(MetRequest request, String stationID, StationDataSetImpl result)
          Retrieve the relevant data from a single station.
 void updateRegionList()
          Update the list of regions (if any) held by the MetSource
 void updateStationList(String fromStation)
          Update the list of stations held by the MetSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FAWNMetDB

public FAWNMetDB(MetSourceForDrivers metSource,
                 Properties properties)
Method Detail

getDatabaseTimeZone

public TimeZone getDatabaseTimeZone()
Specified by:
getDatabaseTimeZone in interface MetAccessMechanism

prepareRequestQuery

public String prepareRequestQuery(MetRequest request,
                                  String stationID,
                                  StationDataSetImpl result)
                           throws ConnectionException
Throws:
ConnectionException

queryForStation

public void queryForStation(MetRequest request,
                            String stationID,
                            StationDataSetImpl result)
                     throws ConnectionException
Description copied from interface: MetAccessMechanism
Retrieve the relevant data from a single station.

Specified by:
queryForStation in interface MetAccessMechanism
Parameters:
request - describes what data is required
stationID - identifies which station from the met data source to query
result - the skeletal query result (created by MetSourceImpl) for the driver fill in with data hostID is the native identifier for the station on the host database system.
If the request is a StationMetRequest, then the hostID will also be embedded in the request but should be ignored by this method. If there is no data at all for the station, this method should return the skeletal query result untouched. If there is no data for a particular element, then no corresponding sequence should be inserted into the StationDataSetImpl.
Throws:
ConnectionException

updateStationList

public void updateStationList(String fromStation)
                       throws GeneralException
Description copied from interface: MetAccessMechanism
Update the list of stations held by the MetSource

Specified by:
updateStationList in interface MetAccessMechanism
Parameters:
fromStation - start the update from this station (the driver may ignore this value and update all stations) The fromStation parameter is intended to help with large databases where, particularly during driver development, the updating process may fail midway through. It avoids the need to start again from the beginning. Drivers are welcome to entirely ignore this parameter. A null parameter value indicates that updating should start from the beginning.
Throws:
GeneralException

updateRegionList

public void updateRegionList()
                      throws GeneralException
Description copied from interface: MetAccessMechanism
Update the list of regions (if any) held by the MetSource

Specified by:
updateRegionList in interface MetAccessMechanism
Throws:
GeneralException

connectForMetaData

public boolean connectForMetaData(String user,
                                  String password)
Description copied from interface: DBAccessMechanism
Called before metadata is retrieved from the AccessMechanism

Specified by:
connectForMetaData in interface DBAccessMechanism
Parameters:
user - a valid username for the database if it requires it, or null otherwise.
password - the corresponding password (not encrypted) if required, or null otherwise.
Returns:
true if the connection was established, false otherwise

disconnectFromMetaData

public void disconnectFromMetaData()
Description copied from interface: DBAccessMechanism
Called after meta data is retrieved from the AccessMechanism using connectForMetaData.

Specified by:
disconnectFromMetaData in interface DBAccessMechanism

connectForData

public boolean connectForData(String user,
                              String password)
Description copied from interface: DBAccessMechanism
Called before data is retrieved from the AccessMechanism

Specified by:
connectForData in interface DBAccessMechanism
Parameters:
user - a valid username for the database if it requires it, or null otherwise.
password - the corresponding password (not encrypted) if required, or null otherwise.
Returns:
true if the connection was established, false otherwise

disconnectFromData

public void disconnectFromData()
Description copied from interface: DBAccessMechanism
Called after data is retrieved from the AccessMechanism using connectForData.

Specified by:
disconnectFromData in interface DBAccessMechanism

checkForDatabaseUpdates

public void checkForDatabaseUpdates()
Description copied from interface: DBAccessMechanism
connect to database and check the metadata

Specified by:
checkForDatabaseUpdates in interface DBAccessMechanism


Copyright (C) NARC 2001 All Rights Reserved.