stella.sql
Class TargetConsistency

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.sql.TargetConsistency
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class TargetConsistency
extends PropertyBundles

Class to check the consistancy of the task and history database to target xml files. This class acts server-like, it has no public constructors, and all methods are statically accessible. To allow some configuration, a scan for SCAN with PropertyLoader.scanLoad(java.lang.String) is performed.


Nested Class Summary
static class TargetConsistency.CrossCheck
          Checks for stars in the task table with no entry in the target table and updates them.
private static class TargetConsistency.UpdateThread
          A thread that updates the targt database with simbad-resolved stars.
private static class TargetConsistency.URLInfo
          Retrieves and stores info from an URL
static class TargetConsistency.User
          Adds a new user or proposal by parsing the target xml.
static class TargetConsistency.Xml
          Scans a targetlist for consistency.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static Map<String,StarDescription> fallback
          This is the fallback, if no simbad info can be retrieved.
private static HistorySql histsql
          The history-db reference.
static String KEY_HISTORYDB
          If special history-db properties are required.
static String KEY_OBSERVEDB
          If special observe-db properties are required.
static String KEY_PERMISSIONDB
          If special permission-db properties are required.
static String KEY_PROPOSALDB
          If special proposal-db properties are required.
static String KEY_TARGETDB
          If special target-db properties are required.
static String KEY_TASKDB
          If special task-db properties are required.
static String KEY_USERDB
          If special user-db properties are required.
private static ObserveSql observesql
          The history-db reference.
private static PermissionSql permsql
          The history-db reference.
private static ProposalSql proposalsql
          The history-db reference.
private static TargetConsistency run
          The single running reference.
static String SCAN
          The resource name psql.static.conf.
private static List<String> simbad
          On cositency checks we gather all new SIMBAD target names.
private static TargetSql targetsql
          The history-db reference.
private static TaskSql tasksql
          The history-db reference.
private static UserSql usersql
          The history-db reference.
 
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
private TargetConsistency(Map<String,String> prop)
          Constructs the single living instqance of the target consistancy class.
 
Method Summary
private static boolean addPermission(TargetDefinition td)
          Add all permission for this proposal, including su permission for the PI and normal permissions for the team members.
private static boolean checkForObject(String main)
          Checks and prepares for updates of the target-db for the given new star.
static boolean checkTargetXml(String telid, Map<String,ParsedTarget> loaded)
          Checks for all targets in the collection if the modification time of the file resource is younger than the modification time stored.
private static boolean checkUpdateProposal(TargetDefinition td)
          Checks and updates the proposal sql if the propsal is not found.
private static boolean checkUpdateUser(TargetDefinition td)
          Checks and updates the user sql if the user is not found.
 void init()
          Constructs all tables.
static Thread startTargetUpdate()
          Starts a thread for updating the target database, based on the list of stars retrieved on checkTargetXml(java.lang.String, java.util.Map).
 
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

SCAN

public static final String SCAN
The resource name psql.static.conf.

See Also:
Constant Field Values

KEY_HISTORYDB

public static final String KEY_HISTORYDB
If special history-db properties are required.

See Also:
Constant Field Values

KEY_TASKDB

public static final String KEY_TASKDB
If special task-db properties are required.

See Also:
Constant Field Values

KEY_TARGETDB

public static final String KEY_TARGETDB
If special target-db properties are required.

See Also:
Constant Field Values

KEY_PROPOSALDB

public static final String KEY_PROPOSALDB
If special proposal-db properties are required.

See Also:
Constant Field Values

KEY_USERDB

public static final String KEY_USERDB
If special user-db properties are required.

See Also:
Constant Field Values

KEY_PERMISSIONDB

public static final String KEY_PERMISSIONDB
If special permission-db properties are required.

See Also:
Constant Field Values

KEY_OBSERVEDB

public static final String KEY_OBSERVEDB
If special observe-db properties are required.

See Also:
Constant Field Values

histsql

private static HistorySql histsql
The history-db reference.


tasksql

private static TaskSql tasksql
The history-db reference.


targetsql

private static TargetSql targetsql
The history-db reference.


proposalsql

private static ProposalSql proposalsql
The history-db reference.


usersql

private static UserSql usersql
The history-db reference.


permsql

private static PermissionSql permsql
The history-db reference.


observesql

private static ObserveSql observesql
The history-db reference.


run

private static TargetConsistency run
The single running reference.


simbad

private static List<String> simbad
On cositency checks we gather all new SIMBAD target names.


fallback

private static Map<String,StarDescription> fallback
This is the fallback, if no simbad info can be retrieved.

Constructor Detail

TargetConsistency

private TargetConsistency(Map<String,String> prop)
Constructs the single living instqance of the target consistancy class. Called during class load.

Method Detail

init

public void init()
Constructs all tables.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

checkTargetXml

public static boolean checkTargetXml(String telid,
                                     Map<String,ParsedTarget> loaded)
Checks for all targets in the collection if the modification time of the file resource is younger than the modification time stored. If so, the target in the database is replaced. Return true, if at least one target was updated.


startTargetUpdate

public static Thread startTargetUpdate()
Starts a thread for updating the target database, based on the list of stars retrieved on checkTargetXml(java.lang.String, java.util.Map). The thread doing the update is returned.


checkForObject

private static boolean checkForObject(String main)
Checks and prepares for updates of the target-db for the given new star.


checkUpdateUser

private static boolean checkUpdateUser(TargetDefinition td)
Checks and updates the user sql if the user is not found.


checkUpdateProposal

private static boolean checkUpdateProposal(TargetDefinition td)
Checks and updates the proposal sql if the propsal is not found.


addPermission

private static boolean addPermission(TargetDefinition td)
Add all permission for this proposal, including su permission for the PI and normal permissions for the team members.