Class XMLConfigUtil
- java.lang.Object
- 
- edu.uiuc.ncsa.security.util.configuration.XMLConfigUtil
 
- 
- All Implemented Interfaces:
- TimeConstants
 - Direct Known Subclasses:
- ServletXMLConfigUtil,- UpkeepConfigUtils
 
 public class XMLConfigUtil extends Object implements TimeConstants Static utilities for working with XML configurations.Created by Jeff Gaynor 
 on 3/23/12 at 8:23 AM
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classXMLConfigUtil.TimeThingy
 - 
Field Summary- 
Fields inherited from interface edu.uiuc.ncsa.security.util.configuration.TimeConstantsONE_DAY, ONE_HOUR, ONE_MINUTES, ONE_MONTH, ONE_WEEK, ONE_YEAR, SECONDS, UNITS__WEEK, UNITS_DAYS, UNITS_DAYS_LONG, UNITS_HOURS, UNITS_HOURS_LONG, UNITS_MILLISECOND_LONG, UNITS_MILLISECOND_MULTIPLIER, UNITS_MILLISECONDS, UNITS_MINUTES, UNITS_MINUTES_LONG, UNITS_MINUTES_LONG2, UNITS_MONTHS, UNITS_MONTHS_LONG, UNITS_SECONDS, UNITS_SECONDS_LONG, UNITS_SECONDS_LONG2, UNITS_WEEK_LONG, UNITS_YEARS, UNITS_YEARS_LONG
 
- 
 - 
Constructor SummaryConstructors Constructor Description XMLConfigUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description protected static XMLConfigUtil.TimeThingycreateTimeThingy(String x, boolean isSeconds)static org.apache.commons.configuration.tree.ConfigurationNodefindConfiguration(String fileName, String configName, String topNodeTag)Finds the configuration in an XML file, given the filename, name of the configuration (or null if you want to use the only one there) and the top node tag (E.g.static org.apache.commons.configuration.tree.ConfigurationNodefindMultiNode(String fileName, String cfgName, String cfgTagName)Entry point for multiple-inheritance.protected static org.apache.commons.configuration.tree.ConfigurationNodefindNamedConfig(org.apache.commons.configuration.XMLConfiguration cfg, String cfgName, String topNodeTag)This takes a configuration and looks in it for a given name for the tag.protected static MultiConfigurationsgetConfigurations2(String fileName, String cfgTagName)protected static longgetMultiplier(String units)Gets the correct multiplier for the units.static LonggetValueSecsOrMillis(String x)For getting times in configuration files.static LonggetValueSecsOrMillis(String x, boolean isSeconds)static voidmain(String[] args)Quick double check of this class.protected static XMLConfigUtil.TimeThingyNEWcreateTimeThingy(String s, boolean isSeconds)protected static String[]splitNumber(String x, boolean isSeconds)Splits a time into number and unit, normalizing.
 
- 
- 
- 
Method Detail- 
findConfigurationpublic static org.apache.commons.configuration.tree.ConfigurationNode findConfiguration(String fileName, String configName, String topNodeTag) Finds the configuration in an XML file, given the filename, name of the configuration (or null if you want to use the only one there) and the top node tag (E.g. "client" or "server"). This only permits single inheritance.- Parameters:
- fileName-
- configName-
- topNodeTag-
- Returns:
 
 - 
findMultiNodepublic static org.apache.commons.configuration.tree.ConfigurationNode findMultiNode(String fileName, String cfgName, String cfgTagName) throws org.apache.commons.configuration.ConfigurationException Entry point for multiple-inheritance.- Parameters:
- fileName-
- cfgName-
- cfgTagName-
- Returns:
- Throws:
- org.apache.commons.configuration.ConfigurationException
 
 - 
getConfigurations2protected static MultiConfigurations getConfigurations2(String fileName, String cfgTagName) throws org.apache.commons.configuration.ConfigurationException - Throws:
- org.apache.commons.configuration.ConfigurationException
 
 - 
findNamedConfigprotected static org.apache.commons.configuration.tree.ConfigurationNode findNamedConfig(org.apache.commons.configuration.XMLConfiguration cfg, String cfgName, String topNodeTag)This takes a configuration and looks in it for a given name for the tag. Called byfindConfiguration(String, String, String).- Parameters:
- cfg-
- cfgName-
- topNodeTag-
- Returns:
 
 - 
getValueSecsOrMillispublic static Long getValueSecsOrMillis(String x) For getting times in configuration files. The acceptable entries arex + sec for seconds x + s for seconds x + ms for milliseconds x (no units) for milliseconds Using this assumes that the default is milliseconds for the field. If you need to set the default for the field as seconds, usegetValueSecsOrMillis(String, boolean).- Parameters:
- x-
- Returns:
 
 - 
getValueSecsOrMillispublic static Long getValueSecsOrMillis(String x, boolean isSeconds) - Parameters:
- x- un-parsed number
- isSeconds- no units means it is seconds (true) or milliseconds (false)
- Returns:
 
 - 
createTimeThingyprotected static XMLConfigUtil.TimeThingy createTimeThingy(String x, boolean isSeconds) 
 - 
NEWcreateTimeThingyprotected static XMLConfigUtil.TimeThingy NEWcreateTimeThingy(String s, boolean isSeconds) 
 - 
splitNumberprotected static String[] splitNumber(String x, boolean isSeconds) Splits a time into number and unit, normalizing.- Parameters:
- x-
- Returns:
 
 - 
getMultiplierprotected static long getMultiplier(String units) Gets the correct multiplier for the units.- Parameters:
- units-
- Returns:
 
 - 
mainpublic static void main(String[] args) Quick double check of this class. Run it and peruse the output.- Parameters:
- args-
 
 
- 
 
-