if (this.configuration != null) {
// The cache configuration has already been loaded.
return;
}
if (configFilePath == null) {
throw new CacheException("the path of the cache configuration file was not specified.");
}
InputStream configInputStream;
try {
configInputStream = new FileInputStream(new File(configFilePath));
} catch (FileNotFoundException e) {
throw new CacheException("Cache configuration file (cache.xml) does not exist in the " +
"path " + configFilePath, e);
}
try {
OMElement documentElement = new StAXOMBuilder(configInputStream).getDocumentElement();
Map<String, List<String>> configuration = new HashMap<String, List<String>>();
readChildElements(documentElement, new Stack<String>(), configuration);
this.configuration = configuration;
log.debug("Successfully loaded Cache Configuration");
} catch (XMLStreamException e) {
throw new CacheException("Unable to parse the cache configuration.", e);
} finally {
try {
configInputStream.close();
} catch (IOException ignore) {
// We only want to ensure that the configuration file is properly closed. Throwing