|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
mysql.AbstractSql
mysql.HistorySql
public class HistorySql
A class that allows static access to a database containing observational
history of a target. It allows restoring history of a target on SCS restart
as well as information retrieval for JStella. In the
default setup, the table of this database is called 'done' and has the
following structure:
CREATE TABLE "done" (
"objid" varchar(255),
"object" varchar(255) UNIQUE,
"start" timestamp without time zone NOT NULL,
"duration" integer,
"success" boolean,
"merrit" real,
Constraint "done_pkey" Primary Key ("start")
);
GRANT ALL on "done" to "postgres";
GRANT ALL on "done" to "stella";
GRANT SELECT on "done" to "guest";
In this setup, the columns have the following meanings:
| Nested Class Summary | |
|---|---|
static class |
HistorySql.GridFix
Fixes wrong enries entered between 2008-10-17 15:28:30 and 2008-12-18 08:55:47, when the done table was writtn to early due to GRID timeline visibilities. |
static class |
HistorySql.PilarPointing
We add total pointing model offsets from Pilar save files to the history db. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static String |
DEFDATEFIELD
The default target name field in the database |
private static String |
DEFDURATIONFIELD
The default target name field in the database |
private static String |
DEFFIRSTALTFIELD
The key to the first azimuth offset in the database. |
private static String |
DEFFIRSTAZFIELD
The key to the first azimuth offset in the database. |
private static String |
DEFMERITFIELD
The default target name field in the database |
private static String |
DEFSUCCESSFIELD
The default target 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 |
DEFTELESCOPEFIELD
The default target name field in the database |
private static String |
DEFTOTALAZFIELD
The key to the first azimuth offset in the database. |
private static String |
DEFTOTALZFIELD
The key to the first azimuth offset in the database. |
private static String |
DEFUNIQUEFIELD
The default target name field in the database |
static String |
KEY_DATEFIELD
The key to the target name in the database. |
static String |
KEY_DURATIONFIELD
The key to the target name in the database. |
static String |
KEY_FIRSTALTFIELD
The key to the first azimuth offset in the database. |
static String |
KEY_FIRSTAZFIELD
The key to the first azimuth offset in the database. |
static String |
KEY_MERITFIELD
The key to the target name in the database. |
static String |
KEY_SUCCESSFIELD
The key to the target name in the database. |
static String |
KEY_TARGETNAMEFIELD
The key to the target name in the database. |
static String |
KEY_TELESCOPEFIELD
The key to the target name in the database. |
static String |
KEY_TOTALAZFIELD
The key to the first azimuth offset in the database. |
static String |
KEY_TOTALZFIELD
The key to the first azimuth offset in the database. |
static String |
KEY_UNIQUEFIELD
The key to the target name in the database. |
| 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 | |
|---|---|
HistorySql(Map<String,String> prop)
Constructs a new history database. |
|
| Method Summary | |
|---|---|
boolean |
addFirstOffsets(String unique,
Vector2D degoff)
After a successful acquire, the first offset encountered is writtn to the database. |
boolean |
addHistoryPickToDatabase(String targetname,
boolean success,
Date start,
long duration,
String unique,
double merit,
String idtelescope)
Adds a history entry to the database. |
boolean |
addHistoryPickToDatabase(TargetDefinition target,
boolean success,
Date start,
long duration,
String unique,
double merit,
String idtelescope)
Adds a history entry to the database. |
boolean |
addTotalOffsets(String unique,
Vector2D degoff)
After a successful acquire, the total offset encountered is writtn to the database. |
HistoryAware.Pick |
getFirstFailure(String tel,
String name)
Returns the first succesful pick. |
HistoryAware.Pick |
getFirstSuccess(String tel,
String name)
Returns the first succesful pick. |
List<HistoryAware.Pick> |
getHistoryFromDatabase(String telescope,
String name,
int maxlen)
Scans a database for the history. |
Map<String,List<HistoryAware.Pick>> |
getHistoryPicks(String idtel,
Date from,
Date to)
Returns a list of HistoryAware.Picks of all targets that have
been picked between the given dates. |
HistoryAware.Pick |
getLastFailure(String tel,
String name)
Returns the first succesful pick. |
HistoryAware.Pick |
getLastSuccess(String tel,
String name)
Returns the first succesful pick. |
static HistoryAware.Pick |
getPickFromUnique(String uniq)
Returns a single history pick from the db by specifying the unique TARGET id of the pick. |
static HistoryAware.Pick |
getPickFromUnique(String uniq,
String datekey,
String durkey,
String merkey,
String suckey,
String uniqkey,
String targetkey)
Returns a single history pick from the db by specifying the unique target id of the pick plus all field names. |
private HistoryAware.Pick |
getSinglePick(String tel,
String name,
boolean succ,
char order)
|
boolean |
removeHistoryPickFromDatabase(String unique)
Removes a entry from the history db if the unique specifier is given. |
private static HistoryAware.Pick |
retrievePick(ResultSet history,
String datekey,
String durationkey,
String meritkey,
String successkey,
String uniquekey,
String targetkey)
Converts the current row in the result set into a history pick. |
boolean |
updateHistoryPick(String unique,
boolean to)
Updates the success flag of the pick with the given unique identifier. |
| 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 |
|---|
public static final String KEY_TARGETNAMEFIELD
public static final String KEY_UNIQUEFIELD
public static final String KEY_DATEFIELD
public static final String KEY_DURATIONFIELD
public static final String KEY_SUCCESSFIELD
public static final String KEY_MERITFIELD
public static final String KEY_TELESCOPEFIELD
public static final String KEY_FIRSTAZFIELD
public static final String KEY_FIRSTALTFIELD
public static final String KEY_TOTALAZFIELD
public static final String KEY_TOTALZFIELD
private static final String DEFTABLE
private static final String DEFTARGETNAMEFIELD
private static final String DEFUNIQUEFIELD
private static final String DEFDATEFIELD
private static final String DEFDURATIONFIELD
private static final String DEFSUCCESSFIELD
private static final String DEFMERITFIELD
private static final String DEFTELESCOPEFIELD
private static final String DEFFIRSTAZFIELD
private static final String DEFFIRSTALTFIELD
private static final String DEFTOTALAZFIELD
private static final String DEFTOTALZFIELD
| Constructor Detail |
|---|
public HistorySql(Map<String,String> prop)
| Method Detail |
|---|
public static HistoryAware.Pick getPickFromUnique(String uniq)
throws SQLException,
ConnectException
uniq - The unique target id, i.e. without exposure ID.
SQLException
ConnectException
public static HistoryAware.Pick getPickFromUnique(String uniq,
String datekey,
String durkey,
String merkey,
String suckey,
String uniqkey,
String targetkey)
throws SQLException,
ConnectException
uniq - The unique target id, i.e. without exposure ID.datekey - The name of the date column.durkey - The name of the duration column.merkey - The name of the merit column.suckey - The name of the successful column.uniqkey - The name of the column holding the unique target ID.
SQLException
ConnectExceptionpublic final boolean removeHistoryPickFromDatabase(String unique)
public final boolean addHistoryPickToDatabase(TargetDefinition target,
boolean success,
Date start,
long duration,
String unique,
double merit,
String idtelescope)
public final boolean addHistoryPickToDatabase(String targetname,
boolean success,
Date start,
long duration,
String unique,
double merit,
String idtelescope)
public final boolean updateHistoryPick(String unique,
boolean to)
public Map<String,List<HistoryAware.Pick>> getHistoryPicks(String idtel,
Date from,
Date to)
HistoryAware.Picks of all targets that have
been picked between the given dates.
public final HistoryAware.Pick getFirstSuccess(String tel,
String name)
public final HistoryAware.Pick getFirstFailure(String tel,
String name)
public final HistoryAware.Pick getLastSuccess(String tel,
String name)
public final HistoryAware.Pick getLastFailure(String tel,
String name)
private final HistoryAware.Pick getSinglePick(String tel,
String name,
boolean succ,
char order)
public final List<HistoryAware.Pick> getHistoryFromDatabase(String telescope,
String name,
int maxlen)
public boolean addFirstOffsets(String unique,
Vector2D degoff)
public boolean addTotalOffsets(String unique,
Vector2D degoff)
private static HistoryAware.Pick retrievePick(ResultSet history,
String datekey,
String durationkey,
String meritkey,
String successkey,
String uniquekey,
String targetkey)
throws SQLException
SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||