/**
* Configures a bean from an XML file.
*/
public static Configuration parseConfiguration(final File file) throws CacheException {
if (file == null) {
throw new CacheException("Attempt to configure ehcache from null file.");
}
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Configuring ehcache from file: " + file.toString());
}
Configuration configuration = null;
InputStream input = null;
try {
input = new BufferedInputStream(new FileInputStream(file));
configuration = parseConfiguration(input);
} catch (Exception e) {
throw new CacheException("Error configuring from " + file + ". Initial cause was " + e.getMessage(), e);
} finally {
try {
if (input != null) {
input.close();
}