public class DOMTarget extends Object implements DTDConstants
Note that the DOM created out of the object-definition file may be altered at runtime for the sake of error handling.
A valid object-definition file must follow this DTD grammar.
An dom target always expects that all elements are set. Targets that
provide only fragmentary information must be augmented prior to processing
using the various factory methods in the TargetFragment class.
What follows is a description of the individual, non-selfexplanory elements, attributes and their allowed values (if any restrictions apply).
The Object element takes two attributes, the required attribute
type and the enumeration attribute access which defaults to
'enabled' . The type attribute allows the sequencer to load the
proper observing sequence for this object. Access is used to qualify the
access properties of a target. It defaults to enabled.
History is an element that defines the observing history of this
object. If it is not directly stored in the xml-file, The db attribute
defines a database access for the history. The
TargetFragment#fillHistory method takes care of proper loading. A
target history consists of an arbitrary number of Picks. Each Pick
carries a success boolean attribute, the start and duration of the
observation, along with the optional SNgot and a comment. The
Observstart is a parsable date, following the generic
java.text.DataFormat.parse contract. Duration is the duration
of the observation, in ms. SNgot is the signal-to-noise acheived at this
observation.
The optional Abort elements defines the target's behaviour in case of
non-successful observations. Errors that Block a target set its
access attribute to false. Delay errors disable access for the
specified for time, in seconds. Retry errors immediately
re-schedule the target, while Ignore specifies errors that are simply
ignored, i.e. the target is considered successfully observed. If this block
is missing, any error received blocks the target.
Select is a required element that is mainly intended as a hint or rule
for the scheduler. The Requires element carries an expression that
must be parsable to a primitive boolean at run-time. The Constrain
sections, if present, consists of a Parameter entry, specifying a
parameter name in the parameter set at hand for the scheduler. If a paramter
stated is a TargetDependingParameter, it's value is checked
against this target. Each parameter is followed by a constrain, which is one
of these four possiblities:
TargetFragment defaults to
TargetFragment#DEFGAIN and TargetFragment#DEFTIMESLOT), it is
used to specify the dispatch-scheduling behaviour. The merit consists of an
optional Timeslot and a variable number of Gains. Both elements
define Meriting objects, the only difference is how they are treated
in calculating the target merit: First, all gains are summed up and then
multiplied with the timeslot, or one if no timeslot is given. This also
implies that gains should default to zero, while a undefined timeslot should
deliver one in its Meriting.getMerit(globals.GlobalGrouping, stella.Appointable, java.util.Collection<stella.Appointable>, long) method. Depending on the
-required- class attribute, the corresponding meriting class is
instantiated at runtime and initialized with the Init section, if
present. The list of Constants give names and values of various
parameters used within the meriting instance.#getProperties method. Any star section consists of five
subsections, where the first two are mandatory, namely General,
Instrument, Guiding, FitsHeader and FieldOfView. The
General section consists of the following elements:
TargetFragment#fillUndefinedElements. Note that due to the general
SQL- contract catalog identifiers are non-case sensitive.Parameter. May have an attribute at stating when the
variable's value should be recorded. Valid at identifiers are
'start', 'end', and 'central'. Defaults to central.TargetFragment#fillUndefinedElements.| Modifier and Type | Class and Description |
|---|---|
static class |
DOMTarget.Deserialize
A class to test serialization.
|
static class |
DOMTarget.FileToFile
A class that reads in an xml-file, parses, and writes an xml-file.
|
static class |
DOMTarget.Filter
A class that reads in an xml-file, parses, and writes an xml-file, if it
satisfies a certain filter.
|
static class |
DOMTarget.Properties
A class that reads in an xml-file, parses, and prints out the global
properties of the target.
|
static class |
DOMTarget.Serialize
A class that reads in an xml-file, parses, and serializes it.
|
static class |
DOMTarget.SerializeMerit
A clas to test serialization of merits.
|
| Modifier and Type | Field and Description |
|---|---|
private static DateFormat |
DEFDATETIMEFORMAT |
ABORT, ABOVE, ABSTRACT, ABSTRACTPROPOSAL, ADDRESS, BELOW, BLOCK, BROADCAST, BROADCASTWITH, BV, CHAINING, CHANGE, CLASS, COMMAND, COMMANDID, COMMANDINIT, COMMANDLAST, COMMANDPARAMETER, COMMANDREF, COMMENT, COMPLETE, CONDITION, CONSTANT, CONSTANTNAME, CONSTANTVALUE, CONSTRAINT, CONSTRAINTOVERDUE, CONSTRAINTRELAX, DATA, DAUGHTER, DEC, DELAY, DELAYMAX, DELAYTIME, DISABLED, DOCPATH, DURATION, ELAPSED, EMAIL, ENABLED, EPOCH, EQUINOX, EXCEPTION, EXCEPTIONDAUGHTER, EXCEPTIONFOR, EXCEPTIONSUCCESSOR, EXCEPTIONTHIS, FALSE, FIELDOFVIEW, FILE, FITSHEADER, FITSHEADERID, FORMATCLASS, FORMATPATTERN, FROM, GAIN, HISTORY, HISTORYCOMPLETE, HISTORYDB, HISTORYMAX, HISTORYREAD, IGNORE, IMAGETYPE, INIT, INSTITUTION, INSTRUMENT, INTERN, KEY, MAX, MERIT, MIN, NOTIFY, OBJECT, OBJECTID, OBJECTNAME, OBSERVSTART, PICK, PICKMERIT, PICKSUCCESS, PMDEC, PMRA, POSITION, RA, RATE, REC, REQUIRES, RETRY, RETRYMAX, SELECT, SENDING, SEQUENCE, SEQUENCETYPE, SET, SETNAME, SETUP, SETUPID, STEP, STEPCOUNTER, STEPWHILE, SUCCESSOR, TARGET, TARGETACCESS, TARGETDB, TARGETNAME, TARGETNAMEPROPOSAL, TARGETREAD, TARGETSUBMITTED, TARGETTYPE, TASK, TASKDONE, TASKID, TEAM, TIMESLOT, TITLE, TO, TRUE, USER, V, VARIABLE| Constructor and Description |
|---|
DOMTarget() |
| Modifier and Type | Method and Description |
|---|---|
private static Element |
appendErrorElements(Element root,
String tag,
List<String> err)
Takes a list of strings that are error names and converts them into an
element tree.
|
private static Element |
appendMeritElements(Element root,
String tag,
List<Meriting> merit)
Takes a list of living
Meriting references and converts them to
either DTDConstants.TIMESLOT or DTDConstants.GAIN elements, depending on the tag
name supplied. |
private static Comparable<?> |
constraintParse(Node con,
String tag,
String fclass,
String fpatt)
Parses a constraint node to get min/max/from-to/below-above out of it.
|
static SporeTarget |
deserializeTarget(String tel,
File in)
Deserializes an object from an URL.
|
static SporeTarget |
deserializeTarget(String tel,
URL in)
Deserializes an object from an URL.
|
private static List<Appointable.Constraint> |
getConstraintList(Element xml,
String tag)
Scans a node for constraint elements.
|
private static ExpressionEvaluator |
getExpression(Node xml,
String tag)
Scans an element for an expresion.
|
static SporeTarget |
newTarget(Document xml,
Map<String,String> prop)
Parses a document that describes a STELLA target into a
SporeTarget. |
private static List<HistoryAware.Pick> |
parseHistory(Document xml,
int len,
DateFormat df)
Parses the history list from an xml file.
|
static SporeTarget |
parseInto(Document xml,
SporeTarget ret)
Parses all of the information available in the XML document to valid
fields in the
SporeTarget, but does not interact with information
contained in any DB tables. |
static boolean |
serializeTarget(SporeTarget write,
File out)
Serializes an object to a file.
|
static Document |
toDocument(SporeTarget target,
Map<String,String> stardef)
Converts a parsed target into a DOM.
|
private static final DateFormat DEFDATETIMEFORMAT
public static final SporeTarget newTarget(Document xml, Map<String,String> prop)
SporeTarget. The document handed over should have all optional
fields filled in, i.e. it should be created with the
TargetFragment#createTargetDocument method.public static final SporeTarget parseInto(Document xml, SporeTarget ret)
SporeTarget, but does not interact with information
contained in any DB tables. Can be issued with sub-classes from
XmlTarget.xml - An (empty) target hullret - public static Document toDocument(SporeTarget target, Map<String,String> stardef)
private static ExpressionEvaluator getExpression(Node xml, String tag)
private static final List<Appointable.Constraint> getConstraintList(Element xml, String tag)
private static Comparable<?> constraintParse(Node con, String tag, String fclass, String fpatt)
private static List<HistoryAware.Pick> parseHistory(Document xml, int len, DateFormat df)
public static final SporeTarget deserializeTarget(String tel, File in)
public static final SporeTarget deserializeTarget(String tel, URL in)
public static final boolean serializeTarget(SporeTarget write, File out)
private static final Element appendErrorElements(Element root, String tag, List<String> err)
root - The root element, an DTDConstants.EXCEPTIONtag - The tag name for appending error nameserr - A list of error names.private static final Element appendMeritElements(Element root, String tag, List<Meriting> merit)
Meriting references and converts them to
either DTDConstants.TIMESLOT or DTDConstants.GAIN elements, depending on the tag
name supplied. Each merit-element constructed is appended to the
root-element.