org.vfny.geoserver.global.xml
Class XMLConfigReader

java.lang.Object
  extended byorg.vfny.geoserver.global.xml.XMLConfigReader

public class XMLConfigReader
extends java.lang.Object

XMLConfigReader purpose.

Description of XMLConfigReader Static class to load a configuration org.vfny.geoserver.global.dto

Example Use:


 ModelConfig m = XMLConfigReader.load(new File("/conf/"));
 


Constructor Summary
protected XMLConfigReader()
          XMLConfigReader constructor.
  XMLConfigReader(java.io.File root)
           This method loads the config files from the specified directory into a ModelConfig.
 
Method Summary
 DataDTO getData()
          getData purpose.
 GeoServerDTO getGeoServer()
          getGeoServer purpose.
protected  java.util.List getKeyWords(org.w3c.dom.Element keywordsElem)
          getKeyWords purpose.
protected  java.util.logging.Level getLoggingLevel(org.w3c.dom.Element globalConfigElem)
          getLoggingLevel purpose.
 WFSDTO getWfs()
          getWfs purpose.
 WMSDTO getWms()
          getWms purpose.
protected static boolean isInfoFile(java.io.File testFile)
          isInfoFile purpose.
 boolean isInitialized()
           
protected  void load()
          load purpose.
protected  void loadCatalog(java.io.File catalogFile, java.io.File featureTypeDir)
          loadCatalog purpose.
protected  java.util.Map loadConnectionParams(org.w3c.dom.Element connElem)
          loadConnectionParams purpose.
protected  ContactDTO loadContact(org.w3c.dom.Element contactInfoElement)
          loadContact purpose.
protected  DataStoreInfoDTO loadDataStore(org.w3c.dom.Element dsElem)
          loadDataStore purpose.
protected  java.util.Map loadDataStores(org.w3c.dom.Element dsRoot)
          loadDataStores purpose.
protected  org.geotools.filter.Filter loadDefinitionQuery(org.w3c.dom.Element typeRoot)
          loadDefinitionQuery purpose.
protected  FeatureTypeInfoDTO loadFeature(java.io.File infoFile)
          Load FeatureTypeInfoDTO from a directory.
protected  FeatureTypeInfoDTO loadFeaturePt2(org.w3c.dom.Element fTypeRoot)
          loadFeaturePt2 purpose.
protected  java.util.Map loadFeatureTypes(java.io.File featureTypeRoot)
          Load map of FeatureTypeDTO instances from a directory.
protected  void loadGlobal(org.w3c.dom.Element globalElem)
          loadGlobal purpose.
protected  com.vividsolutions.jts.geom.Envelope loadLatLongBBox(org.w3c.dom.Element bboxElem)
          loadLatLongBBox purpose.
protected  java.util.Map loadNameSpaces(org.w3c.dom.Element nsRoot)
          loadNameSpaces purpose.
protected  void loadSchema(java.io.File schemaFile, FeatureTypeInfoDTO dto)
          Process schema File for a list of AttributeTypeInfoDTO.
protected  ServiceDTO loadService(org.w3c.dom.Element serviceRoot)
          loadService purpose.
protected  void loadServices(java.io.File configFile)
          loadServices purpose.
protected  java.util.Map loadStyles(org.w3c.dom.Element stylesElem, java.io.File baseDir)
          loadStyles purpose.
protected  void loadWFS(org.w3c.dom.Element wfsElement)
          loadWFS purpose.
protected  void loadWMS(org.w3c.dom.Element wmsElement)
          loadWMS purpose.
static void processSchema(org.w3c.dom.Element elem, FeatureTypeInfoDTO featureTypeInfoDTO)
          Process schema DOM for a list of AttributeTypeInfoDTO.
protected  void setDefaultNS()
          setDefaultNS purpose.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLConfigReader

protected XMLConfigReader()
XMLConfigReader constructor.

Should never be called.


XMLConfigReader

public XMLConfigReader(java.io.File root)
                throws ConfigurationException

This method loads the config files from the specified directory into a ModelConfig. If the path is incorrect, or the directory is formed correctly, a ConfigException will be thrown and/or null returned.

The config directory is as follows:

Parameters:
root - A directory which contains the config files.
Throws:
ConfigurationException - When an error occurs.
Method Detail

isInitialized

public boolean isInitialized()

load

protected void load()
             throws ConfigurationException
load purpose.

Main load routine, sets up file handles for various other portions of the load procedure.

Throws:
ConfigurationException

loadServices

protected void loadServices(java.io.File configFile)
                     throws ConfigurationException
loadServices purpose.

loads services.xml into memory with the assistance of other class methods.

Parameters:
configFile - services.xml
Throws:
ConfigurationException - When an error occurs.

loadCatalog

protected void loadCatalog(java.io.File catalogFile,
                           java.io.File featureTypeDir)
                    throws ConfigurationException
loadCatalog purpose.

loads catalog.xml into memory with the assistance of other class methods.

Parameters:
catalogFile - catalog.xml
featureTypeDir - the directory containing the info.xml files for the featuretypes.
Throws:
ConfigurationException - When an error occurs.

setDefaultNS

protected void setDefaultNS()
setDefaultNS purpose.

Finds and sets the default namespace. The namespaces in catalog must already be loaded.


getLoggingLevel

protected java.util.logging.Level getLoggingLevel(org.w3c.dom.Element globalConfigElem)
                                           throws ConfigurationException
getLoggingLevel purpose.

Parses the LoggingLevel from a DOM tree and converts the level into a Level Object.

Parameters:
globalConfigElem -
Returns:
The logging Level
Throws:
ConfigurationException - When an error occurs.

loadGlobal

protected void loadGlobal(org.w3c.dom.Element globalElem)
                   throws ConfigurationException
loadGlobal purpose.

Converts a DOM tree into a GlobalData configuration.

Parameters:
globalElem - A DOM tree representing a complete global configuration.
Throws:
ConfigurationException - When an error occurs.

loadContact

protected ContactDTO loadContact(org.w3c.dom.Element contactInfoElement)
                          throws ConfigurationException
loadContact purpose.

Converts a DOM tree into a ContactConfig

Parameters:
contactInfoElement - a DOM tree to convert into a ContactConfig.
Returns:
The resulting ContactConfig object from the DOM tree.
Throws:
ConfigurationException - When an error occurs.

loadWFS

protected void loadWFS(org.w3c.dom.Element wfsElement)
                throws ConfigurationException
loadWFS purpose.

Converts a DOM tree into a WFS object.

Parameters:
wfsElement - a DOM tree to convert into a WFS object.
Throws:
ConfigurationException - When an error occurs.
See Also:
GlobalData#getBaseUrl()

loadWMS

protected void loadWMS(org.w3c.dom.Element wmsElement)
                throws ConfigurationException
loadWMS purpose.

Converts a DOM tree into a WMS object.

Parameters:
wmsElement - a DOM tree to convert into a WMS object.
Throws:
ConfigurationException - When an error occurs.
See Also:
GlobalData#getBaseUrl()

loadService

protected ServiceDTO loadService(org.w3c.dom.Element serviceRoot)
                          throws ConfigurationException
loadService purpose.

Converts a DOM tree into a ServiceDTO object.

Parameters:
serviceRoot - a DOM tree to convert into a ServiceDTO object.
Returns:
A complete ServiceDTO object loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadNameSpaces

protected java.util.Map loadNameSpaces(org.w3c.dom.Element nsRoot)
                                throws ConfigurationException
loadNameSpaces purpose.

Converts a DOM tree into a Map of NameSpaces.

Parameters:
nsRoot - a DOM tree to convert into a Map of NameSpaces.
Returns:
A complete Map of NameSpaces loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadStyles

protected java.util.Map loadStyles(org.w3c.dom.Element stylesElem,
                                   java.io.File baseDir)
                            throws ConfigurationException
loadStyles purpose.

Converts a DOM tree into a Map of Styles.

Parameters:
stylesElem - a DOM tree to convert into a Map of Styles.
baseDir - DOCUMENT ME!
Returns:
A complete Map of Styles loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadDataStores

protected java.util.Map loadDataStores(org.w3c.dom.Element dsRoot)
                                throws ConfigurationException
loadDataStores purpose.

Converts a DOM tree into a Map of DataStores.

Parameters:
dsRoot - a DOM tree to convert into a Map of DataStores.
Returns:
A complete Map of DataStores loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadDataStore

protected DataStoreInfoDTO loadDataStore(org.w3c.dom.Element dsElem)
                                  throws ConfigurationException
loadDataStore purpose.

Converts a DOM tree into a DataStoreInfo object.

Parameters:
dsElem - a DOM tree to convert into a DataStoreInfo object.
Returns:
A complete DataStoreInfo object loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadConnectionParams

protected java.util.Map loadConnectionParams(org.w3c.dom.Element connElem)
                                      throws ConfigurationException
loadConnectionParams purpose.

Converts a DOM tree into a Map of Strings which represent connection parameters.

Parameters:
connElem - a DOM tree to convert into a Map of Strings which represent connection parameters.
Returns:
A complete Map of Strings which represent connection parameters loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadFeatureTypes

protected java.util.Map loadFeatureTypes(java.io.File featureTypeRoot)
                                  throws ConfigurationException
Load map of FeatureTypeDTO instances from a directory.

Expected directory structure:

If a schema.xml file is not used, the information may be generated from a FeatureType using DataTransferObjectFactory.

Parameters:
featureTypeRoot - Root FeatureType directory
Returns:
Map of FeatureTypeInfoDTO by dataStoreId:typeName
Throws:
ConfigurationException - When an error occurs.
java.lang.IllegalArgumentException - DOCUMENT ME!

loadFeature

protected FeatureTypeInfoDTO loadFeature(java.io.File infoFile)
                                  throws ConfigurationException
Load FeatureTypeInfoDTO from a directory.

Expected directory structure:

If a schema.xml file is not used, the information may be generated from a FeatureType using DataTransferObjectFactory.

Parameters:
infoFile - a File to convert into a FeatureTypeInfo object. (info.xml)
Returns:
A complete FeatureTypeInfo object loaded from the File handle provided.
Throws:
ConfigurationException - When an error occurs.
java.lang.IllegalArgumentException - DOCUMENT ME!
See Also:
loadFeaturePt2(Element)

loadFeaturePt2

protected FeatureTypeInfoDTO loadFeaturePt2(org.w3c.dom.Element fTypeRoot)
                                     throws ConfigurationException
loadFeaturePt2 purpose.

Converts a DOM tree into a FeatureTypeInfo object.

Parameters:
fTypeRoot - a DOM tree to convert into a FeatureTypeInfo object.
Returns:
A complete FeatureTypeInfo object loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

getKeyWords

protected java.util.List getKeyWords(org.w3c.dom.Element keywordsElem)
getKeyWords purpose.

Converts a DOM tree into a List of Strings representing keywords.

Parameters:
keywordsElem - a DOM tree to convert into a List of Strings representing keywords.
Returns:
A complete List of Strings representing keywords loaded from the DOM tree provided.

loadLatLongBBox

protected com.vividsolutions.jts.geom.Envelope loadLatLongBBox(org.w3c.dom.Element bboxElem)
                                                        throws ConfigurationException
loadLatLongBBox purpose.

Converts a DOM tree into a Envelope object.

Parameters:
bboxElem - a DOM tree to convert into a Envelope object.
Returns:
A complete Envelope object loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

loadDefinitionQuery

protected org.geotools.filter.Filter loadDefinitionQuery(org.w3c.dom.Element typeRoot)
                                                  throws ConfigurationException
loadDefinitionQuery purpose.

Converts a DOM tree into a Filter object.

Parameters:
typeRoot - a DOM tree to convert into a Filter object.
Returns:
A complete Filter object loaded from the DOM tree provided.
Throws:
ConfigurationException - When an error occurs.

isInfoFile

protected static boolean isInfoFile(java.io.File testFile)
isInfoFile purpose.

Used to perform safety checks on info.xml file handles.

Parameters:
testFile - The file to test.
Returns:
true if the file is an info.xml file.

loadSchema

protected void loadSchema(java.io.File schemaFile,
                          FeatureTypeInfoDTO dto)
                   throws ConfigurationException
Process schema File for a list of AttributeTypeInfoDTO.

The provided FeatureTypeInfoDTO will be updated with the schemaBase.

Parameters:
schemaFile - File containing schema definition
dto - Schema DOM element
Throws:
ConfigurationException

processSchema

public static void processSchema(org.w3c.dom.Element elem,
                                 FeatureTypeInfoDTO featureTypeInfoDTO)
                          throws ConfigurationException
Process schema DOM for a list of AttributeTypeInfoDTO.

The provided FeatureTypeInfoDTO will be updated with the schemaBase.

Parameters:
elem - Schema DOM element
featureTypeInfoDTO -
Throws:
ConfigurationException

getData

public DataDTO getData()
getData purpose.

Description ...

Returns:

getGeoServer

public GeoServerDTO getGeoServer()
getGeoServer purpose.

Description ...

Returns:

getWfs

public WFSDTO getWfs()
getWfs purpose.

Description ...

Returns:

getWms

public WMSDTO getWms()
getWms purpose.

Description ...

Returns: