/**
* Builds the configuration if necessary.
*/
private synchronized void configure() {
StringAttributeMap config = IntegrationContextFactory.CONFIG;
if (config == null) {
config = new StringAttributeMap();
String configFile = IntegrationContextFactory.CONFIG_FILE;
URL configUrl = null;
ResourcePath rp = new ResourcePath();
try {
configUrl = rp.makeUrl(configFile);
} catch (IOException e) {
LOGGER.finer(configFile+" was not loaded.");
}
if (configUrl != null) {
String err = "Exception while loading: "+configFile;
try {
LOGGER.config("Loading configuration file: "+configFile);
Document dom = DomUtil.makeDomFromResourcePath(configFile,false);
XPath xpath = XPathFactory.newInstance().newXPath();
NodeList nl = (NodeList)xpath.evaluate("//parameter",dom,XPathConstants.NODESET);
for (int i=0; i< nl.getLength(); i++) {
Node nd = nl.item(i);
String key = Val.chkStr(xpath.evaluate("@key",nd));
String value = Val.chkStr(xpath.evaluate("@value",nd));
if (key.length() > 0) {
config.add(new StringAttribute(key,value));
}
}
} catch (ParserConfigurationException e) {
LOGGER.log(Level.SEVERE,err,e);
} catch (SAXException e) {