org.apache.shale.dialog.basic.config
Class ConfigurationParser

java.lang.Object
  extended by org.apache.shale.dialog.basic.config.ConfigurationParser

public final class ConfigurationParser
extends Object

Configuration utility for parsing configuration resources for defining dialogs. This class has no dependencies on web tier APIs, only on the parsing technology (Commons Digester) being used.

To use this utility, instantiate a new instance and set the dialogs, resource, and validating properties. Then, call the parse() method. You can parse more than one resource by resetting the resource property and calling parse() again.

Since:
1.0.4

Constructor Summary
ConfigurationParser()
           
 
Method Summary
 Map getDialogs()
          Return the Map of Dialog instances into which parsed information will be stored, keyed by dialog name.
 URL getResource()
          Return the URL of the configuration resource to be parsed.
 boolean isValidating()
          Return a flag indicating whether we will be doing a validating parse or not.
 void parse()
          Parse the configuration resource identified by the resource property, storing resulting information in the Map specified by the dialogs property.
 void setDialogs(Map dialogs)
          Set the Map of Dialog instances into which parsed information will be stored, keyed by dialog name.
 void setResource(URL resource)
          Set the URL of the configuration resource to be parsed.
 void setValidating(boolean validating)
          Set a flag indicating whether we will be doing a validating parse or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationParser

public ConfigurationParser()
Method Detail

getDialogs

public Map getDialogs()

Return the Map of Dialog instances into which parsed information will be stored, keyed by dialog name.

Returns:
The map of available Dialogs, keyed by name

setDialogs

public void setDialogs(Map dialogs)

Set the Map of Dialog instances into which parsed information will be stored, keyed by dialog name.

Parameters:
dialogs - The new map

getResource

public URL getResource()

Return the URL of the configuration resource to be parsed.

Returns:
The URL of the dialogs configuration resource

setResource

public void setResource(URL resource)

Set the URL of the configuration resource to be parsed.

Parameters:
resource - The new resource URL

isValidating

public boolean isValidating()

Return a flag indicating whether we will be doing a validating parse or not. Default value is true.

Returns:
Whether the parse is a validating one

setValidating

public void setValidating(boolean validating)

Set a flag indicating whether we will be doing a validating parse or not.

Parameters:
validating - New flag value

parse

public void parse()
           throws IOException,
                  SAXException

Parse the configuration resource identified by the resource property, storing resulting information in the Map specified by the dialogs property.

Throws:
IOException - if an input/output error occurs
SAXException - if an XML parsing error occurs


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.