com.xenonsoft.bridgetown.resources
Class XMLConfigLoader

java.lang.Object
  extended bycom.xenonsoft.bridgetown.resources.AbstractConfigLoader
      extended bycom.xenonsoft.bridgetown.resources.XMLConfigLoader
All Implemented Interfaces:
IConfigLoader, java.io.Serializable
Direct Known Subclasses:
WebConfigLoader

public class XMLConfigLoader
extends AbstractConfigLoader

Default sample XML configuration loader that uses the Commons Digester to parse an XML file.

Version:
$Id: XMLConfigLoader.java,v 1.8 2005/02/23 01:31:14 peter_pilgrim Exp $
Author:
Peter Pilgrim, 04-Aug-2004
See Also:
Serialized Form

Field Summary
protected  boolean debug
          boolean flag if the XML parser should be produce debuggable output
protected  boolean namespaceAware
          boolean flag if the XML parser should be XML namespace aware or not
protected static java.lang.String[] registrations
          The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about.
protected  boolean validating
          boolean flag if the XML parser should be validating
 
Fields inherited from class com.xenonsoft.bridgetown.resources.AbstractConfigLoader
file, inputStream, uri
 
Constructor Summary
XMLConfigLoader()
          Default constructor
 
Method Summary
protected  org.apache.commons.digester.Digester createParser()
          Creates the digester parse with the rules all set up.
 boolean isDebug()
          Gets the debug output flag for the Commons Digester parser
 boolean isNamespaceAware()
          Gets boolean flag if the XML parser should be XML namespace aware or not
 boolean isValidating()
          Gets the XML validating flag for the Commons Digester parser
 AssemblyConfig load()
          Loads the service assembly configuration from the supplied resource.
 void setDebug(boolean debug)
          Sets the debug output flag for the Commons Digester parser
 void setNamespaceAware(boolean namespaceAware)
          Sets boolean flag if the XML parser should be XML namespace aware or not
 void setValidating(boolean validating)
          Sets the XML validating flag for the Commons Digester parser
 
Methods inherited from class com.xenonsoft.bridgetown.resources.AbstractConfigLoader
load, load, load, setFile, setInputStream, setUri, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

registrations

protected static final java.lang.String[] registrations

The set of public identifiers, and corresponding resource names, for the versions of the configuration file DTDs that we know about. There MUST be an even number of Strings in this list!


validating

protected boolean validating
boolean flag if the XML parser should be validating


debug

protected boolean debug
boolean flag if the XML parser should be produce debuggable output


namespaceAware

protected boolean namespaceAware
boolean flag if the XML parser should be XML namespace aware or not

Constructor Detail

XMLConfigLoader

public XMLConfigLoader()
Default constructor

Method Detail

isDebug

public boolean isDebug()
Gets the debug output flag for the Commons Digester parser

Returns:
Returns the debug.

setDebug

public void setDebug(boolean debug)
Sets the debug output flag for the Commons Digester parser

Parameters:
debug - the new value for debug

isValidating

public boolean isValidating()
Gets the XML validating flag for the Commons Digester parser

Returns:
Returns the validating.

setValidating

public void setValidating(boolean validating)
Sets the XML validating flag for the Commons Digester parser

Parameters:
validating - the new value for validating

isNamespaceAware

public boolean isNamespaceAware()
Gets boolean flag if the XML parser should be XML namespace aware or not

Returns:
Returns the namespaceAware.

setNamespaceAware

public void setNamespaceAware(boolean namespaceAware)
Sets boolean flag if the XML parser should be XML namespace aware or not

Parameters:
namespaceAware - the new value for namespaceAware

load

public AssemblyConfig load()
Loads the service assembly configuration from the supplied resource.
  1. The implementation checks for existance of an InputStream, if it is found, and the stream is opened and available, then method uses the stream.
  2. If the File exists, then the method loads the configuration from the system file.
  3. Finally the implementation tries to load the configuration URI path. It constructs an URL and attempts to retrieve stream from the resource.

CAUTION: THIS CLASS MIGHT BE REFACTORED or REDESIGNED along with the superclasses.

Returns:
Assembly configuration root
Throws:
AssemblyConfigException - if the configuration fails to load
See Also:
IConfigLoader.load()

createParser

protected org.apache.commons.digester.Digester createParser()
Creates the digester parse with the rules all set up.

Returns:
the Common Digester parser ready to parse and load a configuration


Copyright © 2005 XeNoNSoFT.com. All Rights Reserved.