public void saveConfig(GWCConfig gwcConfig) throws IOException { gwcConfigPersister.save(gwcConfig); }
public void saveConfig(GWCConfig gwcConfig) throws IOException { gwcConfigPersister.save(gwcConfig); // make sure we switch to the lock provider just configured updateLockProvider(gwcConfig.getLockProviderName()); }
upgradeWMSIntegrationConfig(geoServer, oldDefaults); createDefaultTileLayerInfos(oldDefaults); configPersister.save(oldDefaults); configPersister.save(config); configPersister.save(config); || gwcConfig.getCacheProviderClass().isEmpty()) { gwcConfig.setCacheProviderClass(GuavaCacheProvider.class.toString()); configPersister.save(gwcConfig); map.put(GuavaCacheProvider.class.toString(), new CacheConfiguration()); gwcConfig.setCacheConfigurations(map); configPersister.save(gwcConfig); } else { if (LOGGER.isLoggable(Level.FINEST)) { if (!blobStore.getCacheProviders().containsKey(cacheProviderClass)) { gwcConfig.setCacheProviderClass(GuavaCacheProvider.class.toString()); configPersister.save(gwcConfig); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(
/** * @see org.geoserver.config.GeoServerInitializer#initialize(org.geoserver.config.GeoServer) */ public void initialize(final GeoServer geoServer) throws Exception { LOGGER.info("Initializing GeoServer specific GWC configuration from " + GWCConfigPersister.GWC_CONFIG_FILE); final Version currentVersion = new Version("1.0.0"); final File configFile = configPersister.findConfigFile(); if (configFile == null) { LOGGER.fine("GWC's GeoServer specific configuration not found, creating with old defaults"); GWCConfig oldDefaults = GWCConfig.getOldDefaults(); oldDefaults.setVersion(currentVersion.toString()); upgradeWMSIntegrationConfig(geoServer, oldDefaults); createDefaultTileLayerInfos(oldDefaults); configPersister.save(oldDefaults); } final GWCConfig config = configPersister.getConfig(); final Version version = new Version(config.getVersion()); if (currentVersion.compareTo(version) > 0) { // got the global config file, so old defaults are already in place if need be. Now // check whether we need to migrate the configuration from the Layer/GroupInfo metadata // maps to the tile layer catalog store moveTileLayerInfosToTileLayerCatalog(); config.setVersion(currentVersion.toString()); configPersister.save(config); } final GWCConfig gwcConfig = configPersister.getConfig(); checkNotNull(gwcConfig); }
public void testUpgradeDirectWMSIntegrationFlag() throws Exception { // no gwc-gs.xml exists, so that initialization runs when(configPersister.findConfigFile()).thenReturn(null); // no catalog layers for this test List<LayerInfo> layers = ImmutableList.of(); List<LayerGroupInfo> groups = ImmutableList.of(); when(rawCatalog.getLayers()).thenReturn(layers); when(rawCatalog.getLayerGroups()).thenReturn(groups); WMSInfoImpl wmsInfo = new WMSInfoImpl(); // initialize wmsInfo with a value for the old direct wms integration flag wmsInfo.getMetadata().put(GWCInitializer.WMS_INTEGRATION_ENABLED_KEY, Boolean.TRUE); // make sure WMSInfo exists when(geoServer.getService(eq(WMSInfo.class))).thenReturn(wmsInfo); ArgumentCaptor<GWCConfig> captor = ArgumentCaptor.forClass(GWCConfig.class); // run layer initialization initializer.initialize(geoServer); verify(configPersister, times(2)).save(captor.capture()); assertTrue(captor.getAllValues().get(0).isDirectWMSIntegrationEnabled()); assertFalse(wmsInfo.getMetadata().containsKey(GWCInitializer.WMS_INTEGRATION_ENABLED_KEY)); verify(geoServer).save(same(wmsInfo)); }
config.setDirectWMSIntegrationEnabled(true); persister.save(config); assertSame(config, persister.getConfig());