{
InputStream configStream =
LocalDirFS.class.getResourceAsStream(CONFIG_ENTRY);
if (configStream == null)
{
throw new FSException("Configuration file: " + CONFIG_ENTRY
+ " could not be found on the CLASSPATH");
}
logger.log(Level.INFO,
"Loading filesystem provider config from "
+ "CLASSPATH entry {0}", CONFIG_ENTRY);
Properties config = new Properties();
config.load(configStream);
String rootDirProperty = config.getProperty(PROP_DIR_ROOT);
if (rootDirProperty == null)
{
throw new FSException("Config file "+CONFIG_ENTRY
+ " had no value for property: " + PROP_DIR_ROOT);
}
rootDir = new File(rootDirProperty);
logger.log(Level.INFO, "Using local directory: {0}",
rootDir.getAbsolutePath());
if (!rootDir.exists())
{
logger.log(Level.INFO,
"Attempting to create directory: {0}",
rootDir.getAbsolutePath());
rootDir.mkdirs();
}
}
catch (IOException e)
{
throw new FSException(
"Failed to load configuration from classpath entity: "
+ CONFIG_ENTRY, e);
}
setEnabled(true);