* Load protocols from a properties file.
*
* @param path path to the properties file relative to the classpath
*/
static void loadProperties(String path) {
InputStream stream = null;
try {
Properties props = new Properties();
stream = ProtocolDirectory.class.getResourceAsStream(path);
if (stream == null) {
throw new RuntimeException("Unable to load required properties file '" + path + '\'');
}
props.load(stream);
for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
String name = (String) iter.next();
String objectName = props.getProperty(name);
Protocol inst = loadProtocol(objectName);
s_protocolMap.put(name, inst);
}
} catch (IOException e) {
throw new RuntimeException("Unable to load required properties file '" + path + '\'');
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException ignore) {
}
}
}
}