String propertiesFileName = System.getProperty("ec2PropertiesFile");
List<String> requireds = getRequiredPropertyNames();
if(propertiesFileName == null)
throw new VoldemortException("ec2PropertiesFile system property must be defined that "
+ "provides the path to file containing the following "
+ "required properties: "
+ StringUtils.join(requireds, ", "));
Properties properties = new Properties();
InputStream in = null;
try {
in = new FileInputStream(propertiesFileName);
properties.load(in);
} catch(IOException e) {
throw new VoldemortException(e);
} finally {
IOUtils.closeQuietly(in);
}
for(String required: requireds) {
// Allow system properties to override
if(System.getProperties().containsKey(required))
properties.put(required, System.getProperty(required));
if(!properties.containsKey(required))
throw new VoldemortException("Required properties: "
+ StringUtils.join(requireds, ", ") + "; missing "
+ required);
}
return properties;