mysql
Class ObserveSql

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by mysql.AbstractSql
                  extended by mysql.ObserveSql
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class ObserveSql
extends AbstractSql

A class that allows static access to a database containing observational data of a target. It mainly consists the fits header keys of individual observations. IT is normally a table called obs defined in the following way:

 Column   |            Type             | Modifiers
    -----------+-----------------------------+-----------
    date       | timestamp without time zone | not null
    dateobs    | timestamp without time zone | not null
    instrument | smallint                    |
    iversion   | smallint                    |
    exptime    | real                        |
    amplmode   | character(8)                |
    pressure   | real                        |
    dettemp    | real                        |
    cryotemp   | real                        |
    austatus   | smallint                    |
    auseeing   | real                        |
    domestat   | boolean                     |
    observer   | smallint                    |
    transfered | boolean                     |
    online     | boolean                     |
    filename   | character varying(255)      |
    path       | character varying(255)      |
    imagetyp   | smallint                    |
    object     | character varying(255)      |
    telfocus   | real                        |
    objname    | character varying(255)      |
    azimuth    | real                        |
    telalt     | real                        |
    ambtemp    | real                        |
    relhum     | real                        |
    maxwind    | real                        |
    telescop   | character(8)                |
    naquire    | smallint                    |
    guideloss  | real                        |
    tempm1     | real                        |
    tempm2     | real                        |
    avrgwind   | real                        |
    winddir    | real                        |
    atmpress   | real                        |
    dewpoint   | real                        |
    aumiss     | real                        |
    seseff     | real                        |
    snest      | real                        |
    aulight    | real                        |
    aulign     | real                        |
    objid      | character varying(255)      |
    azfirst    | real                        | 
    altfirst   | real                        | 
    aztotal    | real                        | 
    ztotal     | real                        | 
    ADU_av     | real                        | 
    ADU_var    | real                        | 
    ADU_CNM3   | real                        | 
    ADU_CNM4   | real                        | 
    ADU_CNM5   | real                        | 
    ADU_CNM6   | real                        | 
    FILTER     | character(8)                | 
    TELDEROT   | real                        | 
    EXPID      | integer                     | 
    TARGETID   | character varying(255)      | 
    Indexes:
     "obs_pkey" primary key, btree (dateobs)
 
The fields mean the following: The idea of this class is to allow static access from various sides to the history without the need of producing individual db clients. Only numerical values (plus dates) are retrieved.


Nested Class Summary
static class ObserveSql.Adu
          Connects to the database and returns the ADU statistic for all files of the stated telescope.
static class ObserveSql.Duplicates
          Removes double entries in the obs table, which slipped into it during psql upgrade in Feb.
static class ObserveSql.Extract
          A class to retrive columns from a database and output it into an ascii-file for e.g.
static class ObserveSql.FitsParse
          Only in debug mode, we read the fits file and print out what would be entered.
static class ObserveSql.Flat
          Connects to the database and tries to find flats with a stuck filterwheel.
static class ObserveSql.Retrieve
          Connects to the database and gets all values for the given unique object ID.
static class ObserveSql.Tomato
          Connects to the database and tries to find flats with a stuck filterwheel.
static class ObserveSql.Transfer
          To make sure that fits in the transfered directory has been correctly entered into the db.
static class ObserveSql.Types
          Enum version of image types.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String BIASTYPE
          The image type qualifier for scientific observations.
static String CALIBRATIONTYPE
          The image type qualifier for scientific observations.
static String DARKTYPE
          The image type qualifier for scientific observations.
private static String DEFADU1
          The key to the field name for the ADU moment of that order.
private static String DEFADU2
          The key to the field name for the ADU moment of that order.
private static String DEFADU3
          The key to the field name for the ADU moment of that order.
private static String DEFADU4
          The key to the field name for the ADU moment of that order.
private static String DEFADU5
          The key to the field name for the ADU moment of that order.
private static String DEFADU6
          The key to the field name for the ADU moment of that order.
private static String DEFDATEOBSFIELD
          The default target name field in the database
private static String DEFEXPID
          The key to the unique exposure identifier.
private static String DEFEXPTIMEFIELD
          The default target name field in the database
private static String DEFFILENAME
          The key to the filename field.
private static String DEFFILTER
          The key to color filter used.
private static String DEFIMAGETYP
          The key to the image type integer field.
private static String DEFIMAGETYPEFIELD
          The default target name field in the database
private static String DEFINSTRUMENT
          The key to the unique exposure identifier.
private static String DEFIVERSION
          The key to the unique exposure identifier.
private static String DEFOBSERVER
          The key to the observer integer field.
private static String DEFPATH
          The key to the path field.
private static String DEFSIMBADNAMEFIELD
          The default simbad name field in the database
private static String DEFTABLE
          The default table name.
private static String DEFTARGETNAMEFIELD
          The default target name field in the database
private static String DEFTARGETUNIQUE
          The key to the unique target identifier.
private static String DEFTELDEROT
          The key to color filter used.
private static String DEFTELESCOPEFIELD
          The default target name field in the database
private static String DEFTRANSFERRED
          The key to the trasnferred field.
private static String DEFUNIQUEFIELD
          The default target name field in the database
static String FLATFIELDTYPE
          The image type qualifier for scientific observations.
private static Map<String,Integer> IMAGETYPES
          Mapping of image type numbers to image type qualifiers.
static String INSTRUME
          The header key holding instrument and version number as a string.
private static Map<String,Integer> INSTYPES
          Mapping of instrument names to instrument type qualifiers.
static String KEY_ADU1
          The key to the field name for the ADU moment of that order.
static String KEY_ADU2
          The key to the field name for the ADU moment of that order.
static String KEY_ADU3
          The key to the field name for the ADU moment of that order.
static String KEY_ADU4
          The key to the field name for the ADU moment of that order.
static String KEY_ADU5
          The key to the field name for the ADU moment of that order.
static String KEY_ADU6
          The key to the field name for the ADU moment of that order.
static String KEY_DATEOBSFIELD
          The key to the target name in the database.
static String KEY_EXPID
          The key to the unique exposure identifier.
static String KEY_EXPTIMEFIELD
          The key to the target name in the database.
static String KEY_FILENAME
          The key to the filename field.
static String KEY_FILTER
          The key to the field name for the ADU moment of that order.
static String KEY_IMAGETYP
          The key to the image type integer field.
static String KEY_IMAGETYPEFIELD
          The key to the imagetype field.
static String KEY_INSTRUMENT
          The key to the instrument int.
static String KEY_IVERSION
          The key to the instrument version.
static String KEY_LOCALNFS
          A mapping of archive path to local accessible ones.
static String KEY_OBSERVER
          The key to the observer integer field.
static String KEY_PATH
          The key to the path field.
static String KEY_SIMBADNAMEFIELD
          The key to the Simbad object name in the database.
static String KEY_TARGETNAMEFIELD
          The key to the target name in the database.
static String KEY_TARGETUNIQUE
          The key to the unique target identifier.
static String KEY_TELDEROT
          The key to the field name for the ADU moment of that order.
static String KEY_TELESCOPEFIELD
          The key to the telescope name in the database.
static String KEY_TRANSFERRED
          The key to the transferred field.
static String KEY_UNIQUEFIELD
          The key to the unique observation ID in the database.
private static Map<String,String> KEYCOLUMN
          Mapping of HDU header keys to column names.
static String PREFIX_ADU
          The prefix for the ADU keys.
static String SCIENCETYPE
          The image type qualifier for scientific observations.
static String SKYTYPE
          The image type qualifier for sky observations.
static String UNKNOWNTYPE
          The image type qualifier for scientific observations.
 
Fields inherited from class mysql.AbstractSql
KEY_TABLE
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
ObserveSql(Map<String,String> prop)
          Sets the properties of the history database and adds my defaults.
 
Method Summary
 boolean enterFits(String unique, File fits)
          Grabs a fits file and enters all fields it can, if this is the first encounter of the exposure.
 boolean enterFits(String unique, File fits, boolean force)
          Grabs a fits file and enters all fields it can.
 float[] getAduArray(String unique, String adufield)
          Retrieves an sql-array with the specified field name as a primitive float[].
static float[] getAduArray(String table, String ufield, String uval, String adufield)
          Static version, specfying also table and field name.
static Date getDateFromUnique(String unique)
          Gets the dateobs-field for the specified unique.
static Date getDateFromUnique(String unique, String ufield, String dfield)
          Gets the dateobs-field for the specified unique.
private  int getExpId(File fits)
          Get exposure id from file name.
static File getFileFromUnique(String unique)
          Gets the file name from the object id.
static File getFileFromUnique(String unique, String ufield, String pfield, String ffield)
          Gets the file name from the object id.
 Date getLastScienceObservation(String tel, String filter)
          Returns the date the questioned filter was last observed on the specified telescope.
 File getLocalFileFromUnique(String unique)
          From the path and filename saved in the db, we have the possibility to divert to a local file name, if the nfs property is set.
 Object getMapping(String unique, String field)
          Returns the mapping of the requested column names to the stated unique in the obs table.
 Map<String,Object> getMappings(String unique, Collection<String> f)
          Returns the mapping of the requested column names to the stated unique in the obs table.
private  String getObjid(String unique, File fits)
          Returns the unique objid from the unique target id and a file name.
 Map<String,Map<String,Object>> getObservationForPick(String unique)
          Returns a mapping of columns names to parsed java objects for the required unique pick id
private  Map<String,Map<String,Object>> getObservationMappings(Date from, Date to, Integer type, String tel, String add)
          Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.
 Map<String,Map<String,Object>> getObservations(Date from, Date to)
          Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.
 Map<String,Map<String,Object>> getObservations(Date from, Date to, int type)
          Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.
 Map<String,Map<String,Object>> getObservations(Date from, Date to, int type, String t)
          Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.
 Map<String,Map<String,Object>> getObservations(Date from, Date to, int type, String t, String additional)
          Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.
 Map<String,Map<String,Object>> getObservations(Date from, Date to, String type)
          Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.
private  Map<String,Object> headerInfo(nom.tam.fits.Header h)
          We read all key/value pair in the header and then try to get values to the entries in KEYCOLUMN.
 boolean isFitsEntry(String unique, File fits)
          Test, if for a given file an entry already exists in the table.
 boolean removeObservationFromDatabase(String unique)
          Removes an entry from the observe db if the unique specifier is given.
private  Map<String,Map<String,Object>> resultToMapping(ResultSet rs)
          We take a result set and convert each row into a mapping of column names to Java objects.
 
Methods inherited from class mysql.AbstractSql
getPassword, getTable, getUserName, init, isEntry
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

INSTRUME

public static final String INSTRUME
The header key holding instrument and version number as a string.

See Also:
Constant Field Values

SKYTYPE

public static final String SKYTYPE
The image type qualifier for sky observations.

See Also:
Constant Field Values

SCIENCETYPE

public static final String SCIENCETYPE
The image type qualifier for scientific observations.

See Also:
Constant Field Values

FLATFIELDTYPE

public static final String FLATFIELDTYPE
The image type qualifier for scientific observations.

See Also:
Constant Field Values

CALIBRATIONTYPE

public static final String CALIBRATIONTYPE
The image type qualifier for scientific observations.

See Also:
Constant Field Values

BIASTYPE

public static final String BIASTYPE
The image type qualifier for scientific observations.

See Also:
Constant Field Values

DARKTYPE

public static final String DARKTYPE
The image type qualifier for scientific observations.

See Also:
Constant Field Values

UNKNOWNTYPE

public static final String UNKNOWNTYPE
The image type qualifier for scientific observations.

See Also:
Constant Field Values

KEY_UNIQUEFIELD

public static final String KEY_UNIQUEFIELD
The key to the unique observation ID in the database.

See Also:
Constant Field Values

KEY_TARGETNAMEFIELD

public static final String KEY_TARGETNAMEFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_TELESCOPEFIELD

public static final String KEY_TELESCOPEFIELD
The key to the telescope name in the database.

See Also:
Constant Field Values

KEY_DATEOBSFIELD

public static final String KEY_DATEOBSFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_EXPTIMEFIELD

public static final String KEY_EXPTIMEFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_IMAGETYPEFIELD

public static final String KEY_IMAGETYPEFIELD
The key to the imagetype field.

See Also:
Constant Field Values

KEY_SIMBADNAMEFIELD

public static final String KEY_SIMBADNAMEFIELD
The key to the Simbad object name in the database.

See Also:
Constant Field Values

KEY_TARGETUNIQUE

public static final String KEY_TARGETUNIQUE
The key to the unique target identifier.

See Also:
Constant Field Values

KEY_EXPID

public static final String KEY_EXPID
The key to the unique exposure identifier.

See Also:
Constant Field Values

KEY_INSTRUMENT

public static final String KEY_INSTRUMENT
The key to the instrument int.

See Also:
Constant Field Values

KEY_IVERSION

public static final String KEY_IVERSION
The key to the instrument version.

See Also:
Constant Field Values

KEY_FILENAME

public static final String KEY_FILENAME
The key to the filename field.

See Also:
Constant Field Values

KEY_PATH

public static final String KEY_PATH
The key to the path field.

See Also:
Constant Field Values

KEY_TRANSFERRED

public static final String KEY_TRANSFERRED
The key to the transferred field.

See Also:
Constant Field Values

KEY_OBSERVER

public static final String KEY_OBSERVER
The key to the observer integer field.

See Also:
Constant Field Values

KEY_IMAGETYP

public static final String KEY_IMAGETYP
The key to the image type integer field.

See Also:
Constant Field Values

KEY_ADU1

public static final String KEY_ADU1
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_ADU2

public static final String KEY_ADU2
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_ADU3

public static final String KEY_ADU3
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_ADU4

public static final String KEY_ADU4
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_ADU5

public static final String KEY_ADU5
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_ADU6

public static final String KEY_ADU6
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_FILTER

public static final String KEY_FILTER
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_TELDEROT

public static final String KEY_TELDEROT
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

KEY_LOCALNFS

public static final String KEY_LOCALNFS
A mapping of archive path to local accessible ones.

See Also:
Constant Field Values

PREFIX_ADU

public static final String PREFIX_ADU
The prefix for the ADU keys.

See Also:
Constant Field Values

KEYCOLUMN

private static final Map<String,String> KEYCOLUMN
Mapping of HDU header keys to column names.


IMAGETYPES

private static final Map<String,Integer> IMAGETYPES
Mapping of image type numbers to image type qualifiers.


INSTYPES

private static final Map<String,Integer> INSTYPES
Mapping of instrument names to instrument type qualifiers.


DEFTABLE

private static final String DEFTABLE
The default table name.

See Also:
Constant Field Values

DEFTELESCOPEFIELD

private static final String DEFTELESCOPEFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFTARGETNAMEFIELD

private static final String DEFTARGETNAMEFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFSIMBADNAMEFIELD

private static final String DEFSIMBADNAMEFIELD
The default simbad name field in the database

See Also:
Constant Field Values

DEFUNIQUEFIELD

private static final String DEFUNIQUEFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFDATEOBSFIELD

private static final String DEFDATEOBSFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFEXPTIMEFIELD

private static final String DEFEXPTIMEFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFIMAGETYPEFIELD

private static final String DEFIMAGETYPEFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFINSTRUMENT

private static final String DEFINSTRUMENT
The key to the unique exposure identifier.

See Also:
Constant Field Values

DEFIVERSION

private static final String DEFIVERSION
The key to the unique exposure identifier.

See Also:
Constant Field Values

DEFFILENAME

private static final String DEFFILENAME
The key to the filename field.

See Also:
Constant Field Values

DEFPATH

private static final String DEFPATH
The key to the path field.

See Also:
Constant Field Values

DEFTRANSFERRED

private static final String DEFTRANSFERRED
The key to the trasnferred field.

See Also:
Constant Field Values

DEFOBSERVER

private static final String DEFOBSERVER
The key to the observer integer field.

See Also:
Constant Field Values

DEFIMAGETYP

private static final String DEFIMAGETYP
The key to the image type integer field.

See Also:
Constant Field Values

DEFADU1

private static final String DEFADU1
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

DEFADU2

private static final String DEFADU2
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

DEFADU3

private static final String DEFADU3
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

DEFADU4

private static final String DEFADU4
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

DEFADU5

private static final String DEFADU5
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

DEFADU6

private static final String DEFADU6
The key to the field name for the ADU moment of that order.

See Also:
Constant Field Values

DEFTARGETUNIQUE

private static final String DEFTARGETUNIQUE
The key to the unique target identifier.

See Also:
Constant Field Values

DEFEXPID

private static final String DEFEXPID
The key to the unique exposure identifier.

See Also:
Constant Field Values

DEFFILTER

private static final String DEFFILTER
The key to color filter used.

See Also:
Constant Field Values

DEFTELDEROT

private static final String DEFTELDEROT
The key to color filter used.

See Also:
Constant Field Values
Constructor Detail

ObserveSql

public ObserveSql(Map<String,String> prop)
Sets the properties of the history database and adds my defaults.

Method Detail

removeObservationFromDatabase

public final boolean removeObservationFromDatabase(String unique)
Removes an entry from the observe db if the unique specifier is given. This will always delete a single entry, as the unique field is truely unique. If for whatever reason more than a single entry match the delete query, it is not executed.

Returns:
True If a single pick was removed from the database.

getObservationForPick

public Map<String,Map<String,Object>> getObservationForPick(String unique)
Returns a mapping of columns names to parsed java objects for the required unique pick id

Returns:
A mapping of unique observation ids to observation mapping.

getObservations

public Map<String,Map<String,Object>> getObservations(Date from,
                                                      Date to)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.

Returns:
A mapping of unique observation ids to observation mapping.

getObservations

public Map<String,Map<String,Object>> getObservations(Date from,
                                                      Date to,
                                                      String type)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.

Returns:
A mapping of unique observation ids to observation mapping.

getObservations

public Map<String,Map<String,Object>> getObservations(Date from,
                                                      Date to,
                                                      int type)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.

Returns:
A mapping of unique observation ids to observation mapping.

getObservations

public Map<String,Map<String,Object>> getObservations(Date from,
                                                      Date to,
                                                      int type,
                                                      String t)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.

Returns:
A mapping of unique observation ids to observation mapping.

getObservations

public Map<String,Map<String,Object>> getObservations(Date from,
                                                      Date to,
                                                      int type,
                                                      String t,
                                                      String additional)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.

Returns:
A mapping of unique observation ids to observation mapping.

getObservationMappings

private Map<String,Map<String,Object>> getObservationMappings(Date from,
                                                              Date to,
                                                              Integer type,
                                                              String tel,
                                                              String add)
Returns a mapping of unique ID's to observational parameters (as maps) for all observations between the stated dates.

Returns:
A mapping of unique observation ids to observation mapping.

getLastScienceObservation

public Date getLastScienceObservation(String tel,
                                      String filter)
Returns the date the questioned filter was last observed on the specified telescope. Executes a query similar to select dateobs from obs where telescop='STELLA1' and "FILTER" = 'rp' and imagetyp = 1 order by dateobs desc


getObjid

private String getObjid(String unique,
                        File fits)
Returns the unique objid from the unique target id and a file name.


getExpId

private int getExpId(File fits)
Get exposure id from file name.


getMapping

public Object getMapping(String unique,
                         String field)
Returns the mapping of the requested column names to the stated unique in the obs table.


getMappings

public Map<String,Object> getMappings(String unique,
                                      Collection<String> f)
Returns the mapping of the requested column names to the stated unique in the obs table.


getDateFromUnique

public static Date getDateFromUnique(String unique)
                              throws SQLException,
                                     ConnectException
Gets the dateobs-field for the specified unique.

Throws:
SQLException
ConnectException

getDateFromUnique

public static Date getDateFromUnique(String unique,
                                     String ufield,
                                     String dfield)
                              throws SQLException,
                                     ConnectException
Gets the dateobs-field for the specified unique.

Throws:
SQLException
ConnectException

getLocalFileFromUnique

public File getLocalFileFromUnique(String unique)
                            throws SQLException,
                                   ConnectException
From the path and filename saved in the db, we have the possibility to divert to a local file name, if the nfs property is set. There is no guarantee that the named file exists or is readable.

Throws:
SQLException
ConnectException

getFileFromUnique

public static File getFileFromUnique(String unique)
                              throws SQLException,
                                     ConnectException
Gets the file name from the object id.

Throws:
SQLException
ConnectException

getFileFromUnique

public static File getFileFromUnique(String unique,
                                     String ufield,
                                     String pfield,
                                     String ffield)
                              throws SQLException,
                                     ConnectException
Gets the file name from the object id.

Throws:
SQLException
ConnectException

getAduArray

public float[] getAduArray(String unique,
                           String adufield)
                    throws SQLException,
                           ConnectException
Retrieves an sql-array with the specified field name as a primitive float[]. Promoting from float[] to double[] can be done with ArrayTool.

Throws:
SQLException
ConnectException

getAduArray

public static float[] getAduArray(String table,
                                  String ufield,
                                  String uval,
                                  String adufield)
                           throws SQLException,
                                  ConnectException
Static version, specfying also table and field name.

Throws:
SQLException
ConnectException

isFitsEntry

public boolean isFitsEntry(String unique,
                           File fits)
                    throws SQLException,
                           ConnectException
Test, if for a given file an entry already exists in the table.

Throws:
SQLException
ConnectException

enterFits

public boolean enterFits(String unique,
                         File fits)
                  throws SQLException,
                         ConnectException
Grabs a fits file and enters all fields it can, if this is the first encounter of the exposure. This also includes the path and filename, but *not* the transfered flag.

Throws:
SQLException
ConnectException

enterFits

public boolean enterFits(String unique,
                         File fits,
                         boolean force)
                  throws SQLException,
                         ConnectException
Grabs a fits file and enters all fields it can. This also includes the path and filename, but *not* the transfered flag.

Parameters:
force - If true, we overwrite an old entry with same objid
Throws:
SQLException
ConnectException

headerInfo

private Map<String,Object> headerInfo(nom.tam.fits.Header h)
We read all key/value pair in the header and then try to get values to the entries in KEYCOLUMN. All non-null values are parsed to appropriate objects and put as values to the column names.


resultToMapping

private final Map<String,Map<String,Object>> resultToMapping(ResultSet rs)
                                                      throws SQLException
We take a result set and convert each row into a mapping of column names to Java objects. Each mapping is then added to the map returned with its unique observation identifier.

Throws:
SQLException