boolean checkStoresOnStartup(XStreamPersister xp) { Resource f = resourceLoader.get("global.xml"); if (Resources.exists(f)) { try { GeoServerInfo global = depersist(xp, f, GeoServerInfo.class); final ResourceErrorHandling resourceErrorHandling = global.getResourceErrorHandling(); return resourceErrorHandling != null && !ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS.equals( resourceErrorHandling); } catch (IOException e) { LOGGER.log( Level.INFO, "Failed to determine the capabilities resource error handling", e); } } return true; }
void loadLayerGroups(Resource layerGroups, Catalog catalog, XStreamPersister xp) { try (AsynchResourceIterator<byte[]> it = new AsynchResourceIterator<>(layerGroups, XML_FILTER, r -> r.getContents())) { while (it.hasNext()) { try { LayerGroupInfo lg = depersist(xp, it.next(), LayerGroupInfo.class); if (lg.getLayers() == null || lg.getLayers().size() == 0) { LOGGER.warning( "Skipping empty layer group '" + lg.getName() + "', it is invalid"); continue; } catalog.add(lg); LOGGER.info("Loaded layer group '" + lg.getName() + "'"); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to load layer group", e); } } } }
void loadStyles(Resource styles, Catalog catalog, XStreamPersister xp) throws IOException { Filter<Resource> styleFilter = r -> XML_FILTER.accept(r) && !Resources.exists(styles.get(r.name() + ".xml")); try (AsynchResourceIterator<byte[]> it = new AsynchResourceIterator<>(styles, styleFilter, r -> r.getContents())) { while (it.hasNext()) { try { StyleInfo s = depersist(xp, it.next(), StyleInfo.class); catalog.add(s); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Loaded style '" + s.getName() + "'"); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to load style", e); } } } }
private void loadWmtsStore( StoreContents storeContents, CatalogImpl catalog, XStreamPersister xp) { final Resource storeResource = storeContents.resource; WMTSStoreInfo wmts = null; try { wmts = depersist(xp, storeContents.contents, WMTSStoreInfo.class); catalog.add(wmts); LOGGER.info("Loaded wmtsstore '" + wmts.getName() + "'"); } catch (Exception e) { LOGGER.log( Level.WARNING, "Failed to load wmts store '" + storeResource.name() + "'", e); return; } // load wmts layers LayerLoader<WMTSLayerInfo> coverageLoader = new LayerLoader<>(WMTSLayerInfo.class, xp, catalog); try (AsynchResourceIterator<LayerContents> it = new AsynchResourceIterator<>( storeResource.parent(), Resources.DirectoryFilter.INSTANCE, WMTS_LAYER_MAPPER)) { while (it.hasNext()) { LayerContents lc = it.next(); coverageLoader.accept(lc); } } }
final Resource storeResource = storeContents.resource; try { cs = depersist(xp, storeContents.contents, CoverageStoreInfo.class); catalog.add(cs);
private void loadWmsStore( StoreContents storeContents, CatalogImpl catalog, XStreamPersister xp) { final Resource storeResource = storeContents.resource; WMSStoreInfo wms = null; try { wms = depersist(xp, storeContents.contents, WMSStoreInfo.class); catalog.add(wms); LOGGER.info( "Loaded wmsstore '" + wms.getName() + "', " + (wms.isEnabled() ? "enabled" : "disabled")); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to load wms store '" + storeResource.name() + "'", e); return; } // load wms layers LayerLoader<WMSLayerInfo> coverageLoader = new LayerLoader<>(WMSLayerInfo.class, xp, catalog); try (AsynchResourceIterator<LayerContents> it = new AsynchResourceIterator<>( storeResource.parent(), Resources.DirectoryFilter.INSTANCE, WMS_LAYER_MAPPER)) { while (it.hasNext()) { LayerContents lc = it.next(); coverageLoader.accept(lc); } } }
DataStoreInfo ds; try { ds = depersist(xp, storeContents.contents, DataStoreInfo.class); catalog.add(ds);
if (Resources.exists(f)) { try { GeoServerInfo global = depersist(xp, f, GeoServerInfo.class); geoServer.setGlobal(global); } catch (Exception e) { if (Resources.exists(f)) { try { LoggingInfo logging = depersist(xp, f, LoggingInfo.class); geoServer.setLogging(logging); } catch (Exception e) { if (Resources.exists(f)) { try { SettingsInfo settings = depersist(xp, f, SettingsInfo.class); geoServer.add(settings); } catch (Exception e) {
if (Resources.exists(dws)) { try { defaultWorkspace = depersist(xp, dws, WorkspaceInfo.class); LOGGER.info("Loaded default workspace " + defaultWorkspace.getName()); } catch (Exception e) { final Resource workspaceResource = wc.resource; try { ws = depersist(xp, wc.contents, WorkspaceInfo.class); catalog.add(ws); if (LOGGER.isLoggable(Level.INFO)) { ns = depersist(xp, wc.nsContents, NamespaceInfo.class); catalog.add(ns); } catch (Exception e) {