public static Supplier<MetricStore> getMetricStore(String deploymentName, String metricStoreType, boolean validate) { return () -> { Object rawMetricStore = ResponseUnwrapper.get(getService().getMetricStore(deploymentName, metricStoreType, validate)); return getObjectMapper().convertValue(rawMetricStore, MetricStores.translateMetricStoreType(metricStoreType)); }; }
public static Supplier<MetricStore> getMetricStore(String deploymentName, String metricStoreType, boolean validate) { return () -> { Object rawMetricStore = ResponseUnwrapper.get(getService().getMetricStore(deploymentName, metricStoreType, validate)); return getObjectMapper().convertValue(rawMetricStore, MetricStores.translateMetricStoreType(metricStoreType)); }; }
@RequestMapping(value = "/{metricStoreType:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setMetricStore(@PathVariable String deploymentName, @PathVariable String metricStoreType, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawMetricStore) { MetricStore metricStore = objectMapper.convertValue( rawMetricStore, MetricStores.translateMetricStoreType(metricStoreType) ); return GenericUpdateRequest.<MetricStore>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(m -> metricStoresService.setMetricStore(deploymentName, m)) .validator(() -> metricStoresService.validateMetricStore(deploymentName, metricStoreType)) .description("Edit " + metricStoreType + " metric store") .build() .execute(validationSettings, metricStore); }
public MetricStore getMetricStore(String deploymentName, String metricStoreType) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setMetricStores().setMetricStore(metricStoreType); List<MetricStore> matching = lookupService.getMatchingNodesOfType(filter, MetricStore.class); try { switch (matching.size()) { case 0: MetricStore metricStores = MetricStores.translateMetricStoreType(metricStoreType).newInstance(); setMetricStore(deploymentName, metricStores); return metricStores; case 1: return matching.get(0); default: throw new RuntimeException("It shouldn't be possible to have multiple metricStore nodes of the same type. This is a bug."); } } catch (InstantiationException | IllegalAccessException e) { throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Can't create an empty metric store node " + "for metricStore type \"" + metricStoreType + "\"").build() ); } }
public MetricStore getMetricStore(String deploymentName, String metricStoreType) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setMetricStores().setMetricStore(metricStoreType); List<MetricStore> matching = lookupService.getMatchingNodesOfType(filter, MetricStore.class); try { switch (matching.size()) { case 0: MetricStore metricStores = MetricStores.translateMetricStoreType(metricStoreType).newInstance(); setMetricStore(deploymentName, metricStores); return metricStores; case 1: return matching.get(0); default: throw new RuntimeException("It shouldn't be possible to have multiple metricStore nodes of the same type. This is a bug."); } } catch (InstantiationException | IllegalAccessException e) { throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Can't create an empty metric store node " + "for metricStore type \"" + metricStoreType + "\"").build() ); } }