public static void store(WMSDTO wms, WFSDTO wfs, GeoServerDTO geoServer,
File root) throws ConfigurationException {
LOGGER.finest("In method store WMSDTO,WFSDTO, GeoServerDTO");
if (geoServer == null) {
throw new ConfigurationException(
"null parameter in store(WFSDTO,WMSDTO, GeoServerDTO): cannot write.");
}
WriterUtils.initFile(root, true);
boolean inDataDir = GeoserverDataDirectory.isTrueDataDir();
//We're just checking if it's actually a data_dir, not trying to
//to do backwards compatibility. So if an old data_dir is made in
//the old way, on save it'll come to the new way.
File fileDir = inDataDir ? root : new File(root, "WEB-INF/");
File configDir = WriterUtils.initFile(fileDir, true);
File configFile = WriterUtils.initWriteFile(new File(configDir,
"services.xml"), false);
try {
FileWriter fw = new FileWriter(configFile);
storeServices(new WriterHelper(fw), wms, wfs, geoServer);
fw.close();
} catch (IOException e) {
throw new ConfigurationException("Store" + root, e);
}
}