private static GeoServerTileLayerInfoImpl load(final MetadataMap metadataMap) { GeoServerTileLayerInfoImpl info = new GeoServerTileLayerInfoImpl(); // whether the config needs to be saved final boolean enabled = metadataMap.get(CONFIG_KEY_ENABLED, Boolean.class).booleanValue(); info.setEnabled(enabled); int gutter = metadataMap.get(CONFIG_KEY_GUTTER, Integer.class).intValue(); info.setGutter(gutter); String gridsets = metadataMap.get(CONFIG_KEY_GRIDSETS, String.class); Set<XMLGridSubset> gridSetIds = unmarshalGridSubsets(gridsets); info.getGridSubsets().addAll(gridSetIds); int metaTilingX = metadataMap.get(CONFIG_KEY_METATILING_X, Integer.class).intValue(); info.setMetaTilingX(metaTilingX); int metaTilingY = metadataMap.get(CONFIG_KEY_METATILING_Y, Integer.class).intValue(); info.setMetaTilingY(metaTilingY); if (metadataMap.containsKey(CONFIG_KEY_FORMATS)) { String mimeFormatsStr = metadataMap.get(CONFIG_KEY_FORMATS, String.class); Set<String> mimeFormats = unmarshalSet(mimeFormatsStr); info.getMimeFormats().addAll(mimeFormats); } if (metadataMap.containsKey(CONFIG_KEY_AUTO_CACHE_STYLES)) { boolean autoCacheStyles = metadataMap.get(CONFIG_KEY_AUTO_CACHE_STYLES, Boolean.class).booleanValue(); info.setAutoCacheStyles(autoCacheStyles); } if (metadataMap.containsKey(CONFIG_KEY_IN_MEMORY_CACHED)) { boolean inMemoryCached = metadataMap.get(CONFIG_KEY_IN_MEMORY_CACHED, Boolean.class); info.setInMemoryCached(inMemoryCached); } return info; }
/** * Creates a default tile layer info based on the global defaults, public only for unit testing * purposes. */ public static GeoServerTileLayerInfoImpl create(GWCConfig defaults) { GeoServerTileLayerInfoImpl info = new GeoServerTileLayerInfoImpl(); info.setEnabled(defaults.isCacheLayersByDefault()); info.setAutoCacheStyles(defaults.isCacheNonDefaultStyles()); for (String gsetId : defaults.getDefaultCachingGridSetIds()) { XMLGridSubset subset = new XMLGridSubset(); subset.setGridSetName(gsetId); info.getGridSubsets().add(subset); } info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats()); info.setGutter(defaults.getGutter()); info.setMetaTilingX(defaults.getMetaTilingX()); info.setMetaTilingY(defaults.getMetaTilingY()); info.setInMemoryCached(true); return info; }