deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.crs.configuration.deegree.xml.stax.parsers
Class DefinitionParser

java.lang.Object
  extended by org.deegree.crs.configuration.deegree.xml.stax.parsers.DefinitionParser
Direct Known Subclasses:
CoordinateSystemParser, DatumParser, EllipsoidParser, PrimemeridianParser, ProjectionParser, TransformationParser

public abstract class DefinitionParser
extends Object

The CRSParsers class TODO add class documentation here.

Version:
$Revision: 22633 $, $Date: 2010-02-19 11:29:55 +0100 (Fr, 19 Feb 2010) $
Author:
Rutger Bezema, last edited by: $Author: rbezema $

Constructor Summary
protected DefinitionParser(DeegreeCRSProvider<StAXResource> provider, URL configURL)
           
 
Method Summary
protected abstract  QName expectedRootName()
           
protected  XMLStreamReader getConfigReader()
          Get the configuration reader.
protected  URL getConfigURL()
           
 DeegreeCRSProvider<StAXResource> getProvider()
           
 boolean moveReaderToNextIdentifiable(XMLStreamReader reader, QName elementName)
          Forwards the stream
 boolean moveReaderToNextIdentifiable(XMLStreamReader reader, Set<QName> allowedElements)
          Forwards the stream
protected  CRSIdentifiable parseIdentifiable(XMLStreamReader reader)
          Parses all elements of the identifiable object, it is assumed the reader is on a top level element, the next element will be an id.
protected  double parseLatLonType(XMLStreamReader reader, QName qName, boolean required, double defaultValue)
          Post: reader will be at XMLStreamConstants.START_ELEMENT of the next element.
protected  Unit parseUnit(XMLStreamReader reader, boolean required)
          Parses a unit from the given xml-parent.
 boolean readEntireFile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionParser

protected DefinitionParser(DeegreeCRSProvider<StAXResource> provider,
                           URL configURL)
Parameters:
provider -
configURL -
Method Detail

expectedRootName

protected abstract QName expectedRootName()
Returns:
the top level element of a configuration file.

getConfigReader

protected XMLStreamReader getConfigReader()
                                   throws XMLStreamException
Get the configuration reader. The stream will be before the end document event or null if the entire file was read.

Returns:
the configuration reader.
Throws:
XMLStreamException

parseIdentifiable

protected CRSIdentifiable parseIdentifiable(XMLStreamReader reader)
                                     throws CRSConfigurationException
Parses all elements of the identifiable object, it is assumed the reader is on a top level element, the next element will be an id. After this method the reader will point to the first element after areasOfUse.

Parameters:
reader - the xml-reader pointing to parent of the first id-element
Returns:
the identifiable object or null if no id was given.
Throws:
CRSConfigurationException

parseUnit

protected Unit parseUnit(XMLStreamReader reader,
                         boolean required)
                  throws CRSConfigurationException
Parses a unit from the given xml-parent.

Parameters:
reader - xml-reader to parse the unit from.
required - if the unit is required.
Returns:
the unit object or null if not required and not found.
Throws:
CRSConfigurationException - if the unit object could not be created.

getProvider

public DeegreeCRSProvider<StAXResource> getProvider()
Returns:
the provider used for reversed look ups, will never be null

moveReaderToNextIdentifiable

public boolean moveReaderToNextIdentifiable(XMLStreamReader reader,
                                            QName elementName)
                                     throws XMLStreamException
Forwards the stream

Parameters:
reader - to forward
elementName -
Returns:
true if the stream is pointing to an element with the given qname.
Throws:
XMLStreamException

parseLatLonType

protected double parseLatLonType(XMLStreamReader reader,
                                 QName qName,
                                 boolean required,
                                 double defaultValue)
                          throws XMLStreamException
Post: reader will be at XMLStreamConstants.START_ELEMENT of the next element.

Parameters:
reader - to be used.
qName - name of the element
required - if true and the element is missing an exception will be thrown.
defaultValue -
Returns:
the value of the lat lon type or 0 if the element was not defined (and was not required.)
Throws:
XMLStreamException

moveReaderToNextIdentifiable

public boolean moveReaderToNextIdentifiable(XMLStreamReader reader,
                                            Set<QName> allowedElements)
                                     throws XMLStreamException
Forwards the stream

Parameters:
reader - to forward
allowedElements -
Returns:
true if the stream is pointing to an element with the given qname.
Throws:
XMLStreamException

readEntireFile

public boolean readEntireFile()
Returns:
true if the entire file has been read, false otherwise.

getConfigURL

protected URL getConfigURL()
Returns:
the configuration url.

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>