org.infinispan.config.parsing
Class XmlConfigurationParserImpl

java.lang.Object
  extended by org.infinispan.config.parsing.XmlParserBase
      extended by org.infinispan.config.parsing.XmlConfigurationParserImpl
All Implemented Interfaces:
XmlConfigurationParser

public class XmlConfigurationParserImpl
extends XmlParserBase
implements XmlConfigurationParser

The default XML configuration parser

Since:
4.0
Author:
Manik Surtani

Constructor Summary
XmlConfigurationParserImpl()
          Constructs a new parser
XmlConfigurationParserImpl(InputStream inputStream)
          Constructs a parser and initializes it with the input stream passed in, by calling initialize(InputStream).
XmlConfigurationParserImpl(String fileName)
          Constructs a parser and initializes it with the file name passed in, by calling initialize(String).
 
Method Summary
 void configureGlobalJmxStatistics(Element e, GlobalConfiguration c)
           
 void initialize(InputStream inputStream)
          Initializes the parser with a stream that contains the contents of an XML configuration file to parse.
 void initialize(String fileName)
          Initializes the parser with a String that represents the name of the configuration file to parse.
 boolean isValidElementRoot(Element element)
          Tests whether the element passed in is a valid config element.
 Configuration parseDefaultConfiguration()
          Parses the default template configuration.
 GlobalConfiguration parseGlobalConfiguration()
          GlobalConfiguration would also have a reference to the template default configuration, accessible via GlobalConfiguration.getDefaultConfiguration()

This is typically used to configure a DefaultCacheManager

 Map<String,Configuration> parseNamedConfigurations()
          Parses and retrieves configuration overrides for named caches.
 
Methods inherited from class org.infinispan.config.parsing.XmlParserBase
existsAttribute, getAllElements, getAllElementsInCoreNS, getAttributeValue, getBoolean, getInt, getLong, getSingleElement, getSingleElementInCoreNS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlConfigurationParserImpl

public XmlConfigurationParserImpl()
Constructs a new parser


XmlConfigurationParserImpl

public XmlConfigurationParserImpl(String fileName)
                           throws IOException
Constructs a parser and initializes it with the file name passed in, by calling initialize(String).

Parameters:
fileName - file name to initialize the parser with
Throws:
IOException - if there is a problem reading or locating the file.

XmlConfigurationParserImpl

public XmlConfigurationParserImpl(InputStream inputStream)
                           throws IOException
Constructs a parser and initializes it with the input stream passed in, by calling initialize(InputStream).

Parameters:
inputStream - input stream to initialize the parser with
Throws:
IOException - if there is a problem reading the stream
Method Detail

initialize

public void initialize(String fileName)
                throws IOException
Description copied from interface: XmlConfigurationParser
Initializes the parser with a String that represents the name of the configuration file to parse. Parsers would attempt to find this file on the classpath first, and failing that, treat the String as an absolute path name on the file system.

Specified by:
initialize in interface XmlConfigurationParser
Parameters:
fileName - name of file that contains the XML configuration
Throws:
IOException - if there is a problem reading the configuration file

initialize

public void initialize(InputStream inputStream)
                throws IOException
Description copied from interface: XmlConfigurationParser
Initializes the parser with a stream that contains the contents of an XML configuration file to parse.

Specified by:
initialize in interface XmlConfigurationParser
Parameters:
inputStream - stream to read from
Throws:
IOException - if there is a problem reading from the stream

parseDefaultConfiguration

public Configuration parseDefaultConfiguration()
                                        throws ConfigurationException
Description copied from interface: XmlConfigurationParser
Parses the default template configuration.

Specified by:
parseDefaultConfiguration in interface XmlConfigurationParser
Returns:
a configuration instance representing the "default" block in the configuration file
Throws:
ConfigurationException - if there is a problem parsing the configuration XML

parseNamedConfigurations

public Map<String,Configuration> parseNamedConfigurations()
                                                   throws ConfigurationException
Description copied from interface: XmlConfigurationParser
Parses and retrieves configuration overrides for named caches.

Specified by:
parseNamedConfigurations in interface XmlConfigurationParser
Returns:
a Map of Configuration overrides keyed on cache name
Throws:
ConfigurationException - if there is a problem parsing the configuration XML

parseGlobalConfiguration

public GlobalConfiguration parseGlobalConfiguration()
Description copied from interface: XmlConfigurationParser
GlobalConfiguration would also have a reference to the template default configuration, accessible via GlobalConfiguration.getDefaultConfiguration()

This is typically used to configure a DefaultCacheManager

Specified by:
parseGlobalConfiguration in interface XmlConfigurationParser
Returns:
a GlobalConfiguration as parsed from the configuration file.

configureGlobalJmxStatistics

public void configureGlobalJmxStatistics(Element e,
                                         GlobalConfiguration c)

isValidElementRoot

public boolean isValidElementRoot(Element element)
Tests whether the element passed in is a valid config element.

Parameters:
element - element to test
Returns:
true of the element is a modern one and can be parsed using the current parser.


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.