stella.util
Class HeaderUpdate

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

public class HeaderUpdate
extends PropertyBundles

Class that updates fits headers. The fuits file in question is read, the required key is searched and if it is not present, its value is recalculated and writtn into the header.


Nested Class Summary
static class HeaderUpdate.Read
          First argument are the properties of the header update, second one is the fits file.
static class HeaderUpdate.Write
          First argument are the properties of the header update, second one is the fits file.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFCOMMENTS
          Default fits keys to comments.
private static String DEFNAMESKEYS
          Default fits keys to parameter names.
private static File DEFUPDATEPATH
          Default path where to write the new fits files.
static String KEY_COMMENTS
          Links parameter names to header keywords.
static String KEY_FITSDB
          Links parameter names to header keywords.
static String KEY_NAMESKEYS
          Links parameter names to header keywords.
static String KEY_SET
          The properties of the parameter cluster.
static String KEY_TARGETLIST
          The properties of the target list .
static String KEY_UPDATEPATH
          The path to the updated file, if a new file must be writtn.
private  Map<String,String> key2comment
          Map of fits key names to parameter names.
private  Map<String,String> key2name
          Map of fits key names to parameter names.
private  ParameterClustering set
          The parameters for the update.
private  Collection<TargetDefinition> targets
          The list of targets.
 
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
HeaderUpdate(Map prop)
          Constructs a new header update.
 
Method Summary
private  boolean database(List fitsfiles)
          Reads files from path, scans for fits keys and, if they are present enters them into the database.
 void init()
          Initializes the look-up table and the parameter set.
 boolean update(File fitsfile)
          Updates the given fits file.
 
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

KEY_SET

public static final String KEY_SET
The properties of the parameter cluster.

See Also:
Constant Field Values

KEY_UPDATEPATH

public static final String KEY_UPDATEPATH
The path to the updated file, if a new file must be writtn.

See Also:
Constant Field Values

KEY_TARGETLIST

public static final String KEY_TARGETLIST
The properties of the target list .

See Also:
Constant Field Values

KEY_NAMESKEYS

public static final String KEY_NAMESKEYS
Links parameter names to header keywords.

See Also:
Constant Field Values

KEY_COMMENTS

public static final String KEY_COMMENTS
Links parameter names to header keywords.

See Also:
Constant Field Values

KEY_FITSDB

public static final String KEY_FITSDB
Links parameter names to header keywords.

See Also:
Constant Field Values

DEFNAMESKEYS

private static final String DEFNAMESKEYS
Default fits keys to parameter names.

See Also:
Constant Field Values

DEFCOMMENTS

private static final String DEFCOMMENTS
Default fits keys to comments.

See Also:
Constant Field Values

DEFUPDATEPATH

private static final File DEFUPDATEPATH
Default path where to write the new fits files.


set

private ParameterClustering set
The parameters for the update.


targets

private Collection<TargetDefinition> targets
The list of targets.


key2name

private Map<String,String> key2name
Map of fits key names to parameter names.


key2comment

private Map<String,String> key2comment
Map of fits key names to parameter names.

Constructor Detail

HeaderUpdate

public HeaderUpdate(Map prop)
Constructs a new header update.

Method Detail

init

public void init()
Initializes the look-up table and the parameter set.

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

update

public boolean update(File fitsfile)
               throws IOException,
                      nom.tam.fits.FitsException
Updates the given fits file.

Returns:
True, if file was updated.
Throws:
IOException
nom.tam.fits.FitsException

database

private boolean database(List fitsfiles)
                  throws SQLException,
                         nom.tam.fits.FitsException,
                         IOException
Reads files from path, scans for fits keys and, if they are present enters them into the database.

Throws:
SQLException
nom.tam.fits.FitsException
IOException