mysql
Class TargetSql

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

public class TargetSql
extends AbstractSql

A class that allows static access to a database containing astrophysical properties of stars. In the default setup, the table of this database is called 'target' and has the following structure:

 CREATE TABLE "target" (
    "objname"  varchar(255) NOT NULL,
    "simbad" varchar(255) UNIQUE,
    "objra"    real,
    "objdec"   real,
    "objpmra"  real,
    "objpmdec" real,
    "objequin" real,
    "typ"     integer,
    "sptype"  varchar(255),
    "sptyp1"  integer,
    "sptyp2"  integer,
    "vhelio"  real,
    "vsini"   real,
    "v"       real,
    "vminusr" real,
    "bminusv" real,
    "period"  real,
    "parallax" real,
    "objtype" varchar(255),
    "sb"      integer,
    "z"       real,
    "mass"    real,
    "logg"    real,
    "teff"    real,
    "orbit"   double precision[],        
    "option"  double precision[],
    "history" character varying(10000)
    
    Constraint "target_pkey" Primary Key ("objname")
    );
    
    GRANT ALL on "target" to "postgres";
    GRANT ALL on "target" to "stella";
    GRANT SELECT on "target" to "guest";
 
In this setup, the columns have the following meanings: The idea of this class is to allow static access from various sides to the target data to avoid duplicating objects.

Loading the database can be done by passing an target-xml file to Load, querying for an existing entry can be done with the #query method.


Nested Class Summary
static class TargetSql.Lookup
          Takes the star name on the command line and see if it is present in the database.
static class TargetSql.Panel
          We read all entries from the database and construct info panels for it.
static class TargetSql.Resolve
          Resolves the star on the command line.
static class TargetSql.StarSql
          A class that extends a StarDescription to host additional info relevant for stellar activity.
static class TargetSql.Xml
          Reads an xml file and gets the main star out of it.
static class TargetSql.XmlUpdate
          Reads an xml file and gets the main star out of it.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFBVFIELD
          The key to the B-V color in the database.
private static String DEFDEFIELD
          The key to the object ra in the database.
private static String DEFEQUINOXFIELD
          The key to the object type id in the database.
private static String DEFHISTORYFIELD
          The key to the metalicity real in the database.
private static String DEFLOGGFIELD
          The key to the metalicity real in the database.
private static String DEFMASSFIELD
          The key to the metalicity real in the database.
private static String DEFMETALFIELD
          The key to the metalicity real in the database.
private static String DEFOBJECTNAMEFIELD
          The key to the object name in the database.
private static String DEFOBJECTTYPEFIELD
          The key to the object type description in the database.
private static String DEFOPTIONFIELD
          The key to the metalicity real in the database.
private static String DEFORBITFIELD
          The key to the metalicity real in the database.
private static String DEFPARALLAXFIELD
          The key to the parallax in the database.
private static String DEFPERIODFIELD
          The key to the period in the database.
private static String DEFPMDEFIELD
          The key to the object ra in the database.
private static String DEFPMRAFIELD
          The key to the object ra in the database.
private static String DEFRAFIELD
          The key to the object ra in the database.
private static String DEFSBFIELD
          The key to the binarity integer in the database.
private static String DEFSIMBADFIELD
          The key to the simbad name in the database.
private static String DEFSPTYPE1FIELD
          The key to the spectral type integer in the database.
private static String DEFSPTYPE2FIELD
          The key to the luminosity integer in the database.
private static String DEFSPTYPEFIELD
          The key to the spectral type in the database.
private static String DEFTABLE
          The default table name.
private static String DEFTEFFFIELD
          The key to the metalicity real in the database.
private static String DEFTYPFIELD
          The key to the object type id in the database.
private static String DEFVHELIOFIELD
          The key to the heliocentric radial velocity in the database.
private static String DEFVMAGFIELD
          The key to the V magnitude in the database.
private static String DEFVRFIELD
          The key to the V-R color in the database.
private static String DEFVSINIFIELD
          The key to the rotational velocity in the database.
static String KEY_BVFIELD
          The key to the B-V color in the database.
static String KEY_DEFIELD
          The key to the object ra id in the database.
static String KEY_EQUINOXFIELD
          The key to the object type id in the database.
static String KEY_HISTORYFIELD
          The key to the metalicity real in the database.
static String KEY_LOGGFIELD
          The key to the metalicity real in the database.
static String KEY_MASSFIELD
          The key to the metalicity real in the database.
static String KEY_METALFIELD
          The key to the metalicity real in the database.
static String KEY_OBJECTNAMEFIELD
          The key to the object name in the database.
static String KEY_OBJECTTYPEFIELD
          The key to the object type description in the database.
static String KEY_OPTIONFIELD
          The key to the metalicity real in the database.
static String KEY_ORBITFIELD
          The key to the metalicity real in the database.
static String KEY_PARALLAXFIELD
          The key to the parallax in the database.
static String KEY_PERIODFIELD
          The key to the period in the database.
static String KEY_PMDEFIELD
          The key to the object ra id in the database.
static String KEY_PMRAFIELD
          The key to the object ra id in the database.
static String KEY_RAFIELD
          The key to the object ra id in the database.
static String KEY_SBFIELD
          The key to the binarity integer in the database.
static String KEY_SIMBADFIELD
          The key to the simbad name in the database.
static String KEY_SPTYPE1FIELD
          The key to the spectral type integer in the database.
static String KEY_SPTYPE2FIELD
          The key to the luminosity integer in the database.
static String KEY_SPTYPEFIELD
          The key to the spectral type in the database.
static String KEY_TEFFFIELD
          The key to the metalicity real in the database.
static String KEY_TYPFIELD
          The key to the object type id in the database.
static String KEY_VHELIOFIELD
          The key to the heliocentric radial velocity in the database.
static String KEY_VMAGFIELD
          The key to the V magnitude in the database.
static String KEY_VRFIELD
          The key to the V-R color in the database.
static String KEY_VSINIFIELD
          The key to the rotational velocity in the database.
static List<String> NOLOOKUP
          These are currently known types that are NOT for stellar lookup.
private static String[] TABLEIDS
          These are the corresponding table ids
private static double[] TABLERADIUS
          These are the search radii in arcmin.
private static String[] TABLES
          These are the vizier catalogs to query, plus radii and IDs.
private static String[] TFIELDS
          Teff, logT, theta field names of thoses catalogs.
 
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
TargetSql(Map<String,String> prop)
          Sets the properties of the history database and adds my defaults.
 
Method Summary
private  StarDescription fromNextRow(ResultSet single, String simbad, String common)
          Takes a result set, advancec it to the next row and tries to parse a star out of the returns.
private static int parseClass(String prim, String sec)
          Parses a primary spectral class like OBAFGKM and a secondary spectral class like 0123456789 into an integer by 10*(OBAFGKM)+sec.
private static int parseLuminosity(String lum)
          Parses a luminosity class.
 boolean push(StarDescription simbad)
          Takes a star and pushes it into the db.
static StarDescription resolve(String name)
          Takes a star name and tries to fill up database values from various simbad catalogs.
 StarDescription retrieveStar(String simbad)
          Takes a star name and retrieves the info in the target database with the given objname entry.
 StarDescription retrieveUnique(String simbad)
          Takes a star name and retrieves the info in the target database.
protected  boolean update(StarDescription update)
          Updates a star entry.
 
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

NOLOOKUP

public static final List<String> NOLOOKUP
These are currently known types that are NOT for stellar lookup.


KEY_OBJECTNAMEFIELD

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

See Also:
Constant Field Values

KEY_SIMBADFIELD

public static final String KEY_SIMBADFIELD
The key to the simbad name in the database.

See Also:
Constant Field Values

KEY_TYPFIELD

public static final String KEY_TYPFIELD
The key to the object type id in the database.

See Also:
Constant Field Values

KEY_EQUINOXFIELD

public static final String KEY_EQUINOXFIELD
The key to the object type id in the database.

See Also:
Constant Field Values

KEY_RAFIELD

public static final String KEY_RAFIELD
The key to the object ra id in the database.

See Also:
Constant Field Values

KEY_DEFIELD

public static final String KEY_DEFIELD
The key to the object ra id in the database.

See Also:
Constant Field Values

KEY_PMRAFIELD

public static final String KEY_PMRAFIELD
The key to the object ra id in the database.

See Also:
Constant Field Values

KEY_PMDEFIELD

public static final String KEY_PMDEFIELD
The key to the object ra id in the database.

See Also:
Constant Field Values

KEY_SPTYPEFIELD

public static final String KEY_SPTYPEFIELD
The key to the spectral type in the database.

See Also:
Constant Field Values

KEY_SPTYPE1FIELD

public static final String KEY_SPTYPE1FIELD
The key to the spectral type integer in the database.

See Also:
Constant Field Values

KEY_SPTYPE2FIELD

public static final String KEY_SPTYPE2FIELD
The key to the luminosity integer in the database.

See Also:
Constant Field Values

KEY_VHELIOFIELD

public static final String KEY_VHELIOFIELD
The key to the heliocentric radial velocity in the database.

See Also:
Constant Field Values

KEY_VSINIFIELD

public static final String KEY_VSINIFIELD
The key to the rotational velocity in the database.

See Also:
Constant Field Values

KEY_VMAGFIELD

public static final String KEY_VMAGFIELD
The key to the V magnitude in the database.

See Also:
Constant Field Values

KEY_BVFIELD

public static final String KEY_BVFIELD
The key to the B-V color in the database.

See Also:
Constant Field Values

KEY_VRFIELD

public static final String KEY_VRFIELD
The key to the V-R color in the database.

See Also:
Constant Field Values

KEY_PERIODFIELD

public static final String KEY_PERIODFIELD
The key to the period in the database.

See Also:
Constant Field Values

KEY_PARALLAXFIELD

public static final String KEY_PARALLAXFIELD
The key to the parallax in the database.

See Also:
Constant Field Values

KEY_OBJECTTYPEFIELD

public static final String KEY_OBJECTTYPEFIELD
The key to the object type description in the database.

See Also:
Constant Field Values

KEY_SBFIELD

public static final String KEY_SBFIELD
The key to the binarity integer in the database.

See Also:
Constant Field Values

KEY_METALFIELD

public static final String KEY_METALFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

KEY_MASSFIELD

public static final String KEY_MASSFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

KEY_LOGGFIELD

public static final String KEY_LOGGFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

KEY_TEFFFIELD

public static final String KEY_TEFFFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

KEY_ORBITFIELD

public static final String KEY_ORBITFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

KEY_OPTIONFIELD

public static final String KEY_OPTIONFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

KEY_HISTORYFIELD

public static final String KEY_HISTORYFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFTABLE

private static final String DEFTABLE
The default table name.

See Also:
Constant Field Values

DEFOBJECTNAMEFIELD

private static final String DEFOBJECTNAMEFIELD
The key to the object name in the database.

See Also:
Constant Field Values

DEFSIMBADFIELD

private static final String DEFSIMBADFIELD
The key to the simbad name in the database.

See Also:
Constant Field Values

DEFTYPFIELD

private static final String DEFTYPFIELD
The key to the object type id in the database.

See Also:
Constant Field Values

DEFEQUINOXFIELD

private static final String DEFEQUINOXFIELD
The key to the object type id in the database.

See Also:
Constant Field Values

DEFRAFIELD

private static final String DEFRAFIELD
The key to the object ra in the database.

See Also:
Constant Field Values

DEFDEFIELD

private static final String DEFDEFIELD
The key to the object ra in the database.

See Also:
Constant Field Values

DEFPMRAFIELD

private static final String DEFPMRAFIELD
The key to the object ra in the database.

See Also:
Constant Field Values

DEFPMDEFIELD

private static final String DEFPMDEFIELD
The key to the object ra in the database.

See Also:
Constant Field Values

DEFSPTYPEFIELD

private static final String DEFSPTYPEFIELD
The key to the spectral type in the database.

See Also:
Constant Field Values

DEFSPTYPE1FIELD

private static final String DEFSPTYPE1FIELD
The key to the spectral type integer in the database.

See Also:
Constant Field Values

DEFSPTYPE2FIELD

private static final String DEFSPTYPE2FIELD
The key to the luminosity integer in the database.

See Also:
Constant Field Values

DEFVHELIOFIELD

private static final String DEFVHELIOFIELD
The key to the heliocentric radial velocity in the database.

See Also:
Constant Field Values

DEFVSINIFIELD

private static final String DEFVSINIFIELD
The key to the rotational velocity in the database.

See Also:
Constant Field Values

DEFVMAGFIELD

private static final String DEFVMAGFIELD
The key to the V magnitude in the database.

See Also:
Constant Field Values

DEFBVFIELD

private static final String DEFBVFIELD
The key to the B-V color in the database.

See Also:
Constant Field Values

DEFVRFIELD

private static final String DEFVRFIELD
The key to the V-R color in the database.

See Also:
Constant Field Values

DEFPERIODFIELD

private static final String DEFPERIODFIELD
The key to the period in the database.

See Also:
Constant Field Values

DEFPARALLAXFIELD

private static final String DEFPARALLAXFIELD
The key to the parallax in the database.

See Also:
Constant Field Values

DEFOBJECTTYPEFIELD

private static final String DEFOBJECTTYPEFIELD
The key to the object type description in the database.

See Also:
Constant Field Values

DEFSBFIELD

private static final String DEFSBFIELD
The key to the binarity integer in the database.

See Also:
Constant Field Values

DEFMETALFIELD

private static final String DEFMETALFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFMASSFIELD

private static final String DEFMASSFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFLOGGFIELD

private static final String DEFLOGGFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFTEFFFIELD

private static final String DEFTEFFFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFORBITFIELD

private static final String DEFORBITFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFOPTIONFIELD

private static final String DEFOPTIONFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

DEFHISTORYFIELD

private static final String DEFHISTORYFIELD
The key to the metalicity real in the database.

See Also:
Constant Field Values

TABLES

private static final String[] TABLES
These are the vizier catalogs to query, plus radii and IDs.


TABLEIDS

private static final String[] TABLEIDS
These are the corresponding table ids


TFIELDS

private static final String[] TFIELDS
Teff, logT, theta field names of thoses catalogs.


TABLERADIUS

private static final double[] TABLERADIUS
These are the search radii in arcmin.

Constructor Detail

TargetSql

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

Method Detail

retrieveUnique

public StarDescription retrieveUnique(String simbad)
Takes a star name and retrieves the info in the target database. This is done in the following way:

Parameters:
simbad - A simbad-resolvable name.

retrieveStar

public StarDescription retrieveStar(String simbad)
Takes a star name and retrieves the info in the target database with the given objname entry.


fromNextRow

private StarDescription fromNextRow(ResultSet single,
                                    String simbad,
                                    String common)
                             throws SQLException
Takes a result set, advancec it to the next row and tries to parse a star out of the returns.

Parameters:
simbad - A name for simbad-resolvable name, not-null
common - A name for simbad-preferred name.
Throws:
SQLException

update

protected boolean update(StarDescription update)
Updates a star entry. First deletes db-entries with the unique simbad name, then pushes the target star.


push

public boolean push(StarDescription simbad)
Takes a star and pushes it into the db.


resolve

public static StarDescription resolve(String name)
Takes a star name and tries to fill up database values from various simbad catalogs.


parseClass

private static final int parseClass(String prim,
                                    String sec)
Parses a primary spectral class like OBAFGKM and a secondary spectral class like 0123456789 into an integer by 10*(OBAFGKM)+sec.


parseLuminosity

private static final int parseLuminosity(String lum)
Parses a luminosity class. Limitied roman number parser.