nl.astron.lofar.odtb.mom2otdbadapter.mom2listener
Class XMLParser

java.lang.Object
  extended by nl.astron.lofar.odtb.mom2otdbadapter.mom2listener.XMLParser

public class XMLParser
extends java.lang.Object

parse the XML input from MoM and returns a LofarObservations. If needed it used the Mom2OtdbConverter to convert values to otdb values

Author:
Bastiaan Verhoef

Field Summary
private static java.lang.String ARRAY_CONFIGURATION
           
private static java.lang.String BACKEND
           
private static java.lang.String BAND_FILTER
           
private static java.lang.String CHILDREN
           
private static java.lang.String CURRENT_STATUS
           
private static java.lang.String DEC
           
private static java.lang.String DEFAULT_ARRAY_CONFIGURATION
           
private static java.lang.String DETAILED_ARRAY_CONFIGURATION
           
private static java.lang.String DIRECTION_TYPE
           
private static java.lang.String ITEM
           
private  org.apache.commons.logging.Log log
           
private static java.lang.String MEASUREMENT
           
private static java.lang.String MEASUREMENT_ATTRIBUTES
           
private static java.lang.String MOM2_ID
           
private static java.lang.String NUMBER_OF_BANDS
           
private static java.lang.String OBSERVATION
           
private static java.lang.String OBSERVATION_ATTRIBUTES
           
private static java.lang.String PREFIX
           
private static java.lang.String RA
           
private static java.lang.String REQUESTED_DURATION
           
private static java.lang.String SPACING
           
private static java.lang.String SRG_CONFIGURATION
           
private static java.lang.String START_FREQUENCY
           
private static java.lang.String STATION
           
private static java.lang.String SUBBAND_PLACEMENT
           
 
Constructor Summary
XMLParser()
           
 
Method Summary
protected  boolean equal(org.w3c.dom.Node node, java.lang.String nodeName)
          The equal method compares if an node has the given name
protected  boolean equalIgnorePrefix(org.w3c.dom.Node node, java.lang.String nodeName)
          Compares if a node has the given name, ignoring the prefix of the node
protected  java.lang.String formatStatus(java.lang.String status)
          Retrieve status from status element
protected  java.lang.String getAttribute(org.w3c.dom.NamedNodeMap map, java.lang.String name)
          Retrieve an attribute value from a attribute map
 LofarObservation getLofarObservation(org.w3c.dom.Document document)
          Parse a xml document and returns a lofar obseravation
protected  java.lang.Integer getSeconds(java.lang.String string)
          Get seconds from a xml duration string
protected  java.lang.String getValue(org.w3c.dom.Node node)
          The getValue method returns the value of an node
protected  void parseArrayConfiguration(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the arrayConfiguration xml element.
protected  void parseChildren(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the children xml element.
protected  void parseCurrentStatus(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the currentStatus xml element.
protected  void parseItem(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the item xml element.
protected  void parseMeasurement(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the measurement xml element.
protected  void parseMeasurementAttributes(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the measurementAttributes xml element.
protected  void parseObservationAttributes(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the observationAttributes xml element.
protected  void parseStations(org.w3c.dom.Node node, LofarObservation lofarObservation)
          Parse the stations xml element.
protected  java.lang.String removePrefix(org.w3c.dom.Node node)
          Returns the node name without prefix
protected  java.lang.String withPrefix(java.lang.String string)
          add prefix to a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log

PREFIX

private static final java.lang.String PREFIX
See Also:
Constant Field Values

MOM2_ID

private static final java.lang.String MOM2_ID
See Also:
Constant Field Values

OBSERVATION

private static final java.lang.String OBSERVATION
See Also:
Constant Field Values

CURRENT_STATUS

private static final java.lang.String CURRENT_STATUS
See Also:
Constant Field Values

OBSERVATION_ATTRIBUTES

private static final java.lang.String OBSERVATION_ATTRIBUTES
See Also:
Constant Field Values

ARRAY_CONFIGURATION

private static final java.lang.String ARRAY_CONFIGURATION
See Also:
Constant Field Values

DEFAULT_ARRAY_CONFIGURATION

private static final java.lang.String DEFAULT_ARRAY_CONFIGURATION
See Also:
Constant Field Values

DETAILED_ARRAY_CONFIGURATION

private static final java.lang.String DETAILED_ARRAY_CONFIGURATION
See Also:
Constant Field Values

STATION

private static final java.lang.String STATION
See Also:
Constant Field Values

SRG_CONFIGURATION

private static final java.lang.String SRG_CONFIGURATION
See Also:
Constant Field Values

BAND_FILTER

private static final java.lang.String BAND_FILTER
See Also:
Constant Field Values

SUBBAND_PLACEMENT

private static final java.lang.String SUBBAND_PLACEMENT
See Also:
Constant Field Values

NUMBER_OF_BANDS

private static final java.lang.String NUMBER_OF_BANDS
See Also:
Constant Field Values

START_FREQUENCY

private static final java.lang.String START_FREQUENCY
See Also:
Constant Field Values

SPACING

private static final java.lang.String SPACING
See Also:
Constant Field Values

BACKEND

private static final java.lang.String BACKEND
See Also:
Constant Field Values

CHILDREN

private static final java.lang.String CHILDREN
See Also:
Constant Field Values

ITEM

private static final java.lang.String ITEM
See Also:
Constant Field Values

MEASUREMENT

private static final java.lang.String MEASUREMENT
See Also:
Constant Field Values

MEASUREMENT_ATTRIBUTES

private static final java.lang.String MEASUREMENT_ATTRIBUTES
See Also:
Constant Field Values

RA

private static final java.lang.String RA
See Also:
Constant Field Values

DEC

private static final java.lang.String DEC
See Also:
Constant Field Values

DIRECTION_TYPE

private static final java.lang.String DIRECTION_TYPE
See Also:
Constant Field Values

REQUESTED_DURATION

private static final java.lang.String REQUESTED_DURATION
See Also:
Constant Field Values
Constructor Detail

XMLParser

public XMLParser()
Method Detail

getLofarObservation

public LofarObservation getLofarObservation(org.w3c.dom.Document document)
Parse a xml document and returns a lofar obseravation

Parameters:
document - xml document
Returns:
LofarObservation

parseObservationAttributes

protected void parseObservationAttributes(org.w3c.dom.Node node,
                                          LofarObservation lofarObservation)
Parse the observationAttributes xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseArrayConfiguration

protected void parseArrayConfiguration(org.w3c.dom.Node node,
                                       LofarObservation lofarObservation)
Parse the arrayConfiguration xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseStations

protected void parseStations(org.w3c.dom.Node node,
                             LofarObservation lofarObservation)
Parse the stations xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseCurrentStatus

protected void parseCurrentStatus(org.w3c.dom.Node node,
                                  LofarObservation lofarObservation)
Parse the currentStatus xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseChildren

protected void parseChildren(org.w3c.dom.Node node,
                             LofarObservation lofarObservation)
Parse the children xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseItem

protected void parseItem(org.w3c.dom.Node node,
                         LofarObservation lofarObservation)
Parse the item xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseMeasurement

protected void parseMeasurement(org.w3c.dom.Node node,
                                LofarObservation lofarObservation)
Parse the measurement xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

parseMeasurementAttributes

protected void parseMeasurementAttributes(org.w3c.dom.Node node,
                                          LofarObservation lofarObservation)
Parse the measurementAttributes xml element.

Parameters:
node - xml node that must be parsed
lofarObservation - LofarObservation that must be filled

getAttribute

protected java.lang.String getAttribute(org.w3c.dom.NamedNodeMap map,
                                        java.lang.String name)
Retrieve an attribute value from a attribute map

Parameters:
map - attribute map
name - name of the attribute
Returns:
attribute value

withPrefix

protected java.lang.String withPrefix(java.lang.String string)
add prefix to a string

Parameters:
string - input string
Returns:
string with prefix

getValue

protected java.lang.String getValue(org.w3c.dom.Node node)
The getValue method returns the value of an node

Parameters:
node -
Returns:
value of the node

getSeconds

protected java.lang.Integer getSeconds(java.lang.String string)
Get seconds from a xml duration string

Parameters:
string - duration string
Returns:
seconds

equal

protected boolean equal(org.w3c.dom.Node node,
                        java.lang.String nodeName)
The equal method compares if an node has the given name

Parameters:
node -
nodeName -
Returns:
true if equals

equalIgnorePrefix

protected boolean equalIgnorePrefix(org.w3c.dom.Node node,
                                    java.lang.String nodeName)
Compares if a node has the given name, ignoring the prefix of the node

Parameters:
node -
nodeName -
Returns:
true, if equals

removePrefix

protected java.lang.String removePrefix(org.w3c.dom.Node node)
Returns the node name without prefix

Parameters:
node -
Returns:
node name withoud prefix

formatStatus

protected java.lang.String formatStatus(java.lang.String status)
Retrieve status from status element

Parameters:
status - status element string
Returns:
status