|
||||||||||
| 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
stella.sql.TargetDatabase
public class TargetDatabase
A database provider roams through a sql database to load STELLA targets. The
table used is a TaskSql, a TargetSql contains information of
astronomical targets, i.e. stars.
| Nested Class Summary | |
|---|---|
static class |
TargetDatabase.Listing
Test class for changing from target list to target database. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private Map<String,ParsedTarget> |
active
My parsed collection of active targets, available after init. |
private Map<String,ParsedTarget> |
all
Names to targets for all targets, available after init. |
private static boolean |
DEFCONSISTENCY
On default, we do not check for consistency. |
private static boolean |
DEFREMOVEDAUGHTERS
On default, we remove all resolved daughters from the selectable list. |
private static boolean |
DEFREMOVESUCCESSOR
On default, we remove successors from the selectable list. |
private Map<String,ParsedTarget> |
finished
My parsed collection of finished targets, available after init. |
private HistorySql |
histsql
The history table for reconstructing the obs. |
static String |
KEY_CONSISTENCY
If true check for database consitency. |
static String |
KEY_HISTORYDB
If present, the properties of the history database. |
static String |
KEY_PROPOSALDB
If present, the properties of the proposal database. |
static String |
KEY_REMOVEDAUGHTERS
If true, remove resolved daughters. |
static String |
KEY_REMOVEFILE
The key to the ascii-file of unwanted targets. |
static String |
KEY_REMOVELIST
The key to the comma-list of unwanted targets. |
static String |
KEY_REMOVESUCCESSOR
If true, remove resolved daughters. |
static String |
KEY_STELLA
The telescope we work on. |
static String |
KEY_TARGETDB
If present, the properties of the target database. |
static String |
KEY_TASKDB
If present, the properties of the task database. |
private ProposalSql |
propsql
The task sql we drain the targets from. |
private TargetSql |
starsql
The target sql we drain the ra/de of stars from. |
private TaskSql |
tasksql
The task sql we drain the targets from. |
| 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 stella.TargetProviding |
|---|
SERIAL, XML |
| 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 | |
|---|---|
TargetDatabase(Map<String,String> sprop)
Constructs a new target database provider. |
|
| Method Summary | |
|---|---|
boolean |
addTarget(ParsedTarget dom)
Adds a new target to this provider. |
void |
clear()
Empties the targets hash map. |
Collection<ParsedTarget> |
getActiveTargets()
Returns all active targets. |
Collection<ParsedTarget> |
getAllTargets()
Returns all targets known to this provider. |
Collection<ParsedTarget> |
getCompletedTargets()
Parsed Targets provide a complete flag. |
ParsedTarget |
getFromActive(String name)
Returns a set of all target names. |
ParsedTarget |
getFromAll(String name)
Returns a set of all target names. |
HistorySql |
getHistorySql()
Access to the history database. |
void |
init()
The init section. |
Map<String,StarDescription> |
mapToStars()
If only a linking of target names to main stars is needed, try this method, it is much faster. |
Map<String,String> |
mapToUsers()
If only access to target names vs. |
private boolean |
removeFrom(Map<String,ParsedTarget> map,
ParsedTarget dom)
Removes the specified target from the table. |
boolean |
removeTarget(ParsedTarget dom)
Removes the target-defining DOM from the scheduler, classified by its name. |
boolean |
restore()
Restores all targets. |
private boolean |
restoreTargets()
Restores all targets. |
private static void |
trimHistory(List<? extends HistoryAware.Pick> history,
long notlater)
Trimming the histroy means removing any pick that is later than the stated day. |
| Methods inherited from class mysql.AbstractSql |
|---|
getPassword, getTable, getUserName, 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_REMOVELIST
public static final String KEY_REMOVEFILE
public static final String KEY_REMOVEDAUGHTERS
public static final String KEY_REMOVESUCCESSOR
public static final String KEY_CONSISTENCY
public static final String KEY_STELLA
public static final String KEY_HISTORYDB
public static final String KEY_TASKDB
public static final String KEY_TARGETDB
public static final String KEY_PROPOSALDB
private static final boolean DEFREMOVEDAUGHTERS
private static final boolean DEFREMOVESUCCESSOR
private static final boolean DEFCONSISTENCY
private TaskSql tasksql
private ProposalSql propsql
private TargetSql starsql
private HistorySql histsql
private Map<String,ParsedTarget> all
private Map<String,ParsedTarget> active
private Map<String,ParsedTarget> finished
| Constructor Detail |
|---|
public TargetDatabase(Map<String,String> sprop)
init() section.
| Method Detail |
|---|
public void init()
#KEY_TARGETFILE is set, the target list
is searched, read and passed to the #resolveFileTargets method.
init in interface Initializableinit in class AbstractSqlpublic boolean restore()
all Collection. The active targets start with a
copy of all. After that, the non-enabled targets as well as the finished
targets (i.e. those with a non-null finished date) are removed, the
latter stored in finished. If the KEY_REMOVEDAUGHTERS key points
to true, all resolved daughters are removed from the active list.
Finally, if either of the KEY_REMOVELIST or
KEY_REMOVEFILE properties is given, the targets with these names
are removed from the active targets. Finally, if the
KEY_CONSISTENCY trigger is set, all restored targets are checked
for their consistency.
restore in interface TargetProviding<ParsedTarget>public HistorySql getHistorySql()
getHistorySql in interface HistoryProvidingprivate boolean restoreTargets()
all Collection. The active targets start with a
copy of all. After that, the non-enabled targets as well as the finished
targets (i.e. those with a non-null finished date) are removed, the
latter stored in finished. If the KEY_REMOVEDAUGHTERS key points
to true, all resolved daughters are removed from the active list.
Finally, if either of the KEY_REMOVELIST or
KEY_REMOVEFILE properties is given, the targets with these names
are removed from the active targets.
public Collection<ParsedTarget> getCompletedTargets()
getCompletedTargets in interface TargetProviding<ParsedTarget>HistoryAware,
Appointablepublic Collection<ParsedTarget> getAllTargets()
TargetProviding
getAllTargets in interface TargetProviding<ParsedTarget>public Collection<ParsedTarget> getActiveTargets()
TargetProvidingTargetProviding.getAllTargets().
getActiveTargets in interface TargetProviding<ParsedTarget>
private static final void trimHistory(List<? extends HistoryAware.Pick> history,
long notlater)
public boolean addTarget(ParsedTarget dom)
The target is added to the database, if the consistency flag is set
addTarget in interface TargetProviding<ParsedTarget>public boolean removeTarget(ParsedTarget dom)
removeTarget in interface TargetProviding<ParsedTarget>public void clear()
clear in interface TargetProviding<ParsedTarget>public ParsedTarget getFromAll(String name)
getFromAll in interface TargetProviding<ParsedTarget>public ParsedTarget getFromActive(String name)
getFromActive in interface TargetProviding<ParsedTarget>public Map<String,String> mapToUsers()
mapToUsers in interface TargetQuickProviding<ParsedTarget>public Map<String,StarDescription> mapToStars()
mapToStars in interface TargetQuickProviding<ParsedTarget>
private boolean removeFrom(Map<String,ParsedTarget> map,
ParsedTarget dom)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||