/** * Get all services info objects of a GeoServer instance, including the global service and * workspace services. */ private static List<ServiceInfo> getAllServices(GeoServer geoServer) { List<ServiceInfo> allServices = new ArrayList<>(); // get global services allServices.addAll(geoServer.getServices()); // get services per workspace List<WorkspaceInfo> workspaces = geoServer.getCatalog().getWorkspaces(); for (WorkspaceInfo workspace : workspaces) { // get the services of this workspace allServices.addAll(geoServer.getFacade().getServices(workspace)); } return allServices; }
WMTSInfo globalServiceInfo = geoServer.getFacade().getService(WMTSInfo.class); globalServiceInfo.setEnabled(config.isWMTSEnabled()); geoServer.save(globalServiceInfo);