/** * Saves and applies the integrated GWC's GeoServer specific configuration to the * {@code <data dir>/gwc-gs.xml} file. * * @param config * * @throws IOException */ public void save(final GWCConfig config) throws IOException { LOGGER.finer("Saving integrated GWC configuration"); File tmp = new File(getConfigRoot(), GWC_CONFIG_FILE + ".tmp"); XStreamPersister xmlPersister = this.persisterFactory.createXMLPersister(); configureXstream(xmlPersister.getXStream()); OutputStream out = new FileOutputStream(tmp); try { xmlPersister.save(config, out); } finally { out.close(); } File configFile = new File(getConfigRoot(), GWC_CONFIG_FILE); IOUtils.rename(tmp, configFile); this.config = config; LOGGER.finer("Integrated GWC configuration saved to " + configFile.getAbsolutePath()); }
/** * Saves and applies the integrated GWC's GeoServer specific configuration to the {@code <data * dir>/gwc-gs.xml} file. * * @param config * @throws IOException */ public void save(final GWCConfig config) throws IOException { LOGGER.finer("Saving integrated GWC configuration"); Resource tmp = getConfigRoot().get(GWC_CONFIG_FILE + ".tmp"); XStreamPersister xmlPersister = this.persisterFactory.createXMLPersister(); configureXstream(xmlPersister.getXStream()); OutputStream out = tmp.out(); try { xmlPersister.save(config, out); } finally { out.close(); } Resource configFile = getConfigRoot().get(GWC_CONFIG_FILE); tmp.renameTo(configFile); this.config = config; LOGGER.finer("Integrated GWC configuration saved to " + configFile.path()); }