throw new IllegalArgumentException("No configuration found in " + dir.getAbsolutePath()
+ ".");
if(!configurationFiles.contains(STORE_DEFINITIONS_STORE_NAME)) {
// parse stores.xml and create STORES sub-dir
StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
List<StoreDefinition> storeDefinitions = null;
try {
storeDefinitions = mapper.readStoreList(new File(dir.getAbsolutePath()
+ File.separator + STORES_KEY));
} catch(IOException e) {
throw new VoldemortException("Cannot parse the store definitions from "
+ STORES_KEY + " file ", e);
}
if(storeDefinitions == null) {
throw new VoldemortException("Neither STORES nor stores.xml exist in the config directory");
}
// Create the STORES sub directory
File storeDefinitionsDir = new File(storeDefDirPath);
if(!storeDefinitionsDir.mkdir()) {
throw new VoldemortException("Unable to create " + STORE_DEFINITIONS_STORE_NAME
+ " sub directory");
}
for(StoreDefinition storeDef: storeDefinitions) {
try {
FileUtils.writeStringToFile(new File(storeDefDirPath + File.separator
+ storeDef.getName()),
mapper.writeStore(storeDef));
} catch(IOException e) {
throw new VoldemortException("Cannot write store definition to file: "
+ storeDef.getName(), e);
}
}