private static ServerConfiguration getServerConfig(File serverDir,
String profile) throws IOException {
ServerConfigurationParser parser =
new ServerConfigurationParser(new FileInputStream(new File(
serverDir, "config/fedora.fcfg")));
ServerConfiguration serverConfig = parser.parse();
// set all the values according to the profile, if specified
if (profile != null) {
int c = setValuesForProfile(serverConfig, profile);
c +=
setValuesForProfile(serverConfig.getModuleConfigurations(),
profile);
c +=
setValuesForProfile(serverConfig
.getDatastoreConfigurations(), profile);
if (c == 0) {
throw new IOException("Unrecognized server-profile: " + profile);
}
}