org.kuali.rice.core.config
Class ConfigParserImpl

java.lang.Object
  extended by org.kuali.rice.core.config.ConfigParserImpl
All Implemented Interfaces:
ConfigParser

public class ConfigParserImpl
extends Object
implements ConfigParser

ConfigParser implementation that supports a hierarchy of configs, in which configs can include other configs. Variable tokens are resolved at parse time, in the order in which they are encountered. This class relies on Spring for resource loading and Apache Commons Lang for variable replacement.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
static String ALTERNATE_BUILD_LOCATION_KEY
           
 
Constructor Summary
ConfigParserImpl()
           
 
Method Summary
protected  int generateRandomInteger(String rangeSpec)
          Generates a random integer in the range specified by the specifier, in the format: min-max
protected  void getNodeValue(String name, String location, Node n, StringBuilder sb)
           
protected  void parse(LinkedHashMap<String,Object> params, String[] locations)
          Parses a list of locations
protected  void parse(LinkedHashMap<String,Object> params, String location, org.apache.commons.lang.text.StrSubstitutor subs, int depth)
          Parses a single config location
 void parse(Map props, String[] locations)
          Parses config file resources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALTERNATE_BUILD_LOCATION_KEY

public static final String ALTERNATE_BUILD_LOCATION_KEY
See Also:
Constant Field Values
Constructor Detail

ConfigParserImpl

public ConfigParserImpl()
Method Detail

parse

public void parse(Map props,
                  String[] locations)
           throws IOException
Description copied from interface: ConfigParser
Parses config file resources

Specified by:
parse in interface ConfigParser
locations - an array of file or classpath config resources
Throws:
IOException
See Also:
org.kuali.rice.core.config.ConfigParser#parse(java.lang.String[])

parse

protected void parse(LinkedHashMap<String,Object> params,
                     String[] locations)
              throws IOException
Parses a list of locations

Parameters:
params - the current parameter map
locations - a list of locations to parse
Throws:
IOException

parse

protected void parse(LinkedHashMap<String,Object> params,
                     String location,
                     org.apache.commons.lang.text.StrSubstitutor subs,
                     int depth)
              throws IOException
Parses a single config location

Parameters:
params - the current parameter map
location - the location to parse
subs - a StrSubstitutor used to substitute variable tokens
Throws:
IOException

generateRandomInteger

protected int generateRandomInteger(String rangeSpec)
Generates a random integer in the range specified by the specifier, in the format: min-max

Parameters:
rangeSpec - a range specification, 'min-max'
Returns:
a random integer in the range specified by the specifier, in the format: min-max

getNodeValue

protected void getNodeValue(String name,
                            String location,
                            Node n,
                            StringBuilder sb)
                     throws IOException
Parameters:
name - name of the node
location - config file location
n - the node
sb - a StringBuilder into which to set contents of the node, preserving any XML content
Throws:
IOException


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.