org.apache.commons.configuration
Class HierarchicalXMLConfiguration

java.lang.Object
  extended byorg.apache.commons.configuration.AbstractConfiguration
      extended byorg.apache.commons.configuration.HierarchicalConfiguration
          extended byorg.apache.commons.configuration.HierarchicalXMLConfiguration
All Implemented Interfaces:
Configuration, FileConfiguration

public class HierarchicalXMLConfiguration
extends HierarchicalConfiguration
implements FileConfiguration

A specialized hierarchical configuration class that is able to parse XML documents.

The parsed document will be stored keeping its structure. The contained properties can be accessed using all methods supported by the base class HierarchicalConfiguration.

Since:
commons-configuration 1.0
Version:
$Revision: 1.3 $, $Date: 2004/09/22 17:17:30 $
Author:
Jörg Schaible, Oliver Heger

Nested Class Summary
 
Nested classes inherited from class org.apache.commons.configuration.HierarchicalConfiguration
HierarchicalConfiguration.CloneVisitor, HierarchicalConfiguration.DefinedKeysVisitor, HierarchicalConfiguration.DefinedVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitor
 
Nested classes inherited from class org.apache.commons.configuration.AbstractConfiguration
AbstractConfiguration.PropertiesTokenizer
 
Field Summary
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, START_TOKEN
 
Constructor Summary
HierarchicalXMLConfiguration()
           
 
Method Summary
 String getBasePath()
          Return the base path.
 File getFile()
          Return the file where the configuration is stored.
 String getFileName()
          Return the name of the file.
 URL getURL()
          Return the URL where the configuration is stored.
 void initProperties(Document document)
          Initializes this configuration from an XML document.
 void load()
          Load the configuration from the underlying URL.
 void load(File file)
          Load the configuration from the specified file.
 void load(InputStream in)
          Load the configuration from the specified stream, using the default platform specific encoding.
 void load(InputStream in, String encoding)
          Load the configuration from the specified stream, using the specified encoding.
 void load(Reader in)
          Load the configuration from the specified reader.
 void load(String fileName)
          Locate the specified file and load the configuration.
 void load(URL url)
          Load the configuration from the specified URL.
 void save()
          Save the configuration.
 void save(File file)
          Save the configuration to the specified file.
 void save(OutputStream out)
          Save the configuration to the specified stream.
 void save(OutputStream out, String encoding)
          Save the configuration to the specified stream, using the specified encoding.
 void save(String fileName)
          Save the configuration to the specified file.
 void save(URL url)
          Save the configuration to the specified URL if it's a file URL.
 void save(Writer out)
          Save the configuration to the specified writer.
 void setBasePath(String basePath)
          Set the base path.
 void setFile(File file)
          Set the file where the configuration is stored.
 void setFileName(String fileName)
          Set the name of the file.
 void setURL(URL url)
          The URL where the configuration is stored.
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration
addNodes, addPropertyDirect, clearProperty, containsKey, createAddPath, fetchAddNode, fetchNodeList, findLastPathNode, findPropertyNodes, getKeys, getMaxIndex, getPropertyDirect, getRoot, isEmpty, nodeDefined, removeNode, setRoot, subset
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addProperty, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getVector, getVector, interpolate, interpolateHelper, isThrowExceptionOnMissing, setDelimiter, setProperty, setThrowExceptionOnMissing, split
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.configuration.Configuration
addProperty, clearProperty, containsKey, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getVector, getVector, isEmpty, setProperty, subset
 

Constructor Detail

HierarchicalXMLConfiguration

public HierarchicalXMLConfiguration()
Method Detail

initProperties

public void initProperties(Document document)
Initializes this configuration from an XML document.

Parameters:
document - the document to be parsed

load

public void load()
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the underlying URL. If the URL is not specified, it attempts to locate the specified file name.

Specified by:
load in interface FileConfiguration
Throws:
ConfigurationException

load

public void load(String fileName)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Locate the specified file and load the configuration.

Specified by:
load in interface FileConfiguration
Parameters:
fileName - the name of the file loaded
Throws:
ConfigurationException

load

public void load(File file)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified file.

Specified by:
load in interface FileConfiguration
Parameters:
file - the loaded file
Throws:
ConfigurationException

load

public void load(URL url)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified URL.

Specified by:
load in interface FileConfiguration
Parameters:
url - the URL of the file loaded
Throws:
ConfigurationException

load

public void load(InputStream in)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified stream, using the default platform specific encoding.

Specified by:
load in interface FileConfiguration
Parameters:
in - the input stream
Throws:
ConfigurationException

load

public void load(InputStream in,
                 String encoding)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified stream, using the specified encoding. If the encoding is null the default encoding is used.

Specified by:
load in interface FileConfiguration
Parameters:
in - the input stream
encoding - the encoding used. null to use the default encoding
Throws:
ConfigurationException

load

public void load(Reader in)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified reader.

Specified by:
load in interface FileConfiguration
Parameters:
in - the reader
Throws:
ConfigurationException

save

public void save()
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration.

Specified by:
save in interface FileConfiguration
Throws:
ConfigurationException

save

public void save(String fileName)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified file.

Specified by:
save in interface FileConfiguration
Parameters:
fileName -
Throws:
ConfigurationException

save

public void save(File file)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified file.

Specified by:
save in interface FileConfiguration
Parameters:
file -
Throws:
ConfigurationException

save

public void save(URL url)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified URL if it's a file URL.

Specified by:
save in interface FileConfiguration
Parameters:
url -
Throws:
ConfigurationException

save

public void save(OutputStream out)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified stream.

Specified by:
save in interface FileConfiguration
Parameters:
out -
Throws:
ConfigurationException

save

public void save(OutputStream out,
                 String encoding)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified stream, using the specified encoding. If the encoding is null the default encoding is used.

Specified by:
save in interface FileConfiguration
Parameters:
out -
encoding -
Throws:
ConfigurationException

save

public void save(Writer out)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified writer.

Specified by:
save in interface FileConfiguration
Parameters:
out - the writer
Throws:
ConfigurationException

getFileName

public String getFileName()
Description copied from interface: FileConfiguration
Return the name of the file.

Specified by:
getFileName in interface FileConfiguration

setFileName

public void setFileName(String fileName)
Description copied from interface: FileConfiguration
Set the name of the file.

Specified by:
setFileName in interface FileConfiguration
Parameters:
fileName - the name of the file

getBasePath

public String getBasePath()
Description copied from interface: FileConfiguration
Return the base path.

Specified by:
getBasePath in interface FileConfiguration

setBasePath

public void setBasePath(String basePath)
Description copied from interface: FileConfiguration
Set the base path. Relative configurations are loaded from this path.

Specified by:
setBasePath in interface FileConfiguration
Parameters:
basePath - the base path.

getFile

public File getFile()
Description copied from interface: FileConfiguration
Return the file where the configuration is stored.

Specified by:
getFile in interface FileConfiguration

setFile

public void setFile(File file)
Description copied from interface: FileConfiguration
Set the file where the configuration is stored.

Specified by:
setFile in interface FileConfiguration
Parameters:
file -

getURL

public URL getURL()
Description copied from interface: FileConfiguration
Return the URL where the configuration is stored.

Specified by:
getURL in interface FileConfiguration

setURL

public void setURL(URL url)
Description copied from interface: FileConfiguration
The URL where the configuration is stored.

Specified by:
setURL in interface FileConfiguration
Parameters:
url -


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.