public NetUIConfig parse(final XmlInputStreamResolver xmlResolver) {
NetUIConfig configBean = null;
InputStream xmlInputStream = null;
XmlInputStreamResolver theXmlResolver = xmlResolver;
try {
/* use the default XmlInputStream */
if(theXmlResolver == null)
theXmlResolver = DEFAULT_CONFIG_RESOLVER;
xmlInputStream = theXmlResolver.getInputStream();
/* the default XmlInputStream could not provide a valid InputStream; try the default */
if(xmlInputStream == null) {
theXmlResolver = DEFAULT_CONFIG_RESOLVER;
xmlInputStream = theXmlResolver.getInputStream();
if(LOGGER.isInfoEnabled())
LOGGER.info("Loading the default NetUI config file. The runtime will be configured " +
"with a set of minimum parameters.");
/* todo: should this throw an exception? */
if(xmlInputStream == null)
throw new ConfigInitializationException("The NetUI runtime could not find the default config file. " +
"The webapp may not function properly.");
}
if(LOGGER.isInfoEnabled())
LOGGER.info("NetUIConfigParser -- load config: " + theXmlResolver.getResourcePath());
configBean = parse(theXmlResolver.getResourcePath(), xmlInputStream);
}
finally {
try {if(xmlInputStream != null) xmlInputStream.close();} catch(IOException ignore) {}
}