public class TargetDatabase extends AbstractSql implements TargetQuickProviding<SporeTarget>, HistoryProviding
| Modifier and Type | Class and Description |
|---|---|
private class |
TargetDatabase.ConsistencyThread |
static class |
TargetDatabase.Listing
Test class for changing from target list to target database.
|
AbstractSql.Columns, AbstractSql.ExtractPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private Map<String,SporeTarget> |
active
My parsed collection of active targets, available after init.
|
private Map<String,SporeTarget> |
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 |
DEFREMOVESCIENCE
On default, we do not remove science targets.
|
private Map<String,SporeTarget> |
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_KEEPLIST
The key to the comma-list of targets kept in active though finished.
|
static String |
KEY_PROPOSALDB
If present, the properties of the proposal database.
|
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_REMOVESCIENCE
If true, remove all but engineering targets.
|
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.
|
KEY_TABLE, SQLBATCHDIR, SQLFAILDIRKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORSERIAL, XMLKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
TargetDatabase(Map<String,String> sprop)
Constructs a new target database provider.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addTarget(SporeTarget dom)
Adds a new target to this provider.
|
void |
clear()
Empties the targets hash map.
|
Collection<SporeTarget> |
getActiveTargets()
Returns all active targets.
|
Collection<SporeTarget> |
getAllTargets()
Returns all targets known to this provider.
|
Collection<SporeTarget> |
getCompletedTargets()
Parsed Targets provide a complete flag.
|
SporeTarget |
getFromActive(String name)
Returns a set of all target names.
|
SporeTarget |
getFromAll(String name)
Returns a set of all target names.
|
HistorySql |
getHistorySql()
Access to the history database.
|
void |
init()
The init section.
|
Map<String,Star> |
mapToStars()
If only a linking of target names to main stars is needed, try this
method, it is much faster.
|
(package private) Map<String,Star> |
mapToStarsSlow() |
Map<String,String> |
mapToUsers()
If only access to target names vs.
|
private boolean |
removeFrom(Map<String,SporeTarget> map,
SporeTarget dom)
Removes the specified target from the table.
|
boolean |
removeTarget(SporeTarget dom)
Removes the target-defining DOM from the scheduler, classified
by its name.
|
boolean |
restore()
Restores all targets.
|
private boolean |
restoreTargets()
Restores all targets.
|
delete, distinct, distinct, exit, getAccess, getDefaultArchive, getDefaultFormat, getTable, insert, isEntry, release, release, replace, retrieve, retrieve, retrieve, single, singleclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, 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, stringPropertiespublic static final String KEY_KEEPLIST
public static final String KEY_REMOVELIST
public static final String KEY_REMOVEFILE
public static final String KEY_REMOVESCIENCE
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 DEFCONSISTENCY
private static final boolean DEFREMOVESCIENCE
private TaskSql tasksql
private ProposalSql propsql
private TargetSql starsql
private HistorySql histsql
private Map<String,SporeTarget> all
private Map<String,SporeTarget> active
private Map<String,SporeTarget> finished
public void init()
throws InitException
#KEY_TARGETFILE is set, the target list
is searched, read and passed to the #resolveFileTargets method.init in interface Initializableinit in class AbstractSqlInitExceptionpublic 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<SporeTarget>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<SporeTarget> getCompletedTargets()
getCompletedTargets in interface TargetProviding<SporeTarget>HistoryAware,
Appointablepublic Collection<SporeTarget> getAllTargets()
TargetProvidinggetAllTargets in interface TargetProviding<SporeTarget>public Collection<SporeTarget> getActiveTargets()
TargetProvidingTargetProviding.getAllTargets().getActiveTargets in interface TargetProviding<SporeTarget>public boolean addTarget(SporeTarget dom)
The target is added to the database, if the consistency flag is set
addTarget in interface TargetProviding<SporeTarget>public boolean removeTarget(SporeTarget dom)
removeTarget in interface TargetProviding<SporeTarget>public void clear()
clear in interface TargetProviding<SporeTarget>public SporeTarget getFromAll(String name)
getFromAll in interface TargetProviding<SporeTarget>public SporeTarget getFromActive(String name)
getFromActive in interface TargetProviding<SporeTarget>public Map<String,String> mapToUsers()
mapToUsers in interface TargetQuickProviding<SporeTarget>public Map<String,Star> mapToStars()
mapToStars in interface TargetQuickProviding<SporeTarget>private boolean removeFrom(Map<String,SporeTarget> map, SporeTarget dom)