RelaxedObjectMapper() { super(); this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); this.configure(DeserializationFeature.FAIL_ON_NULL_CREATOR_PROPERTIES, false); this.setSerializationInclusion(JsonInclude.Include.NON_NULL); } }
public void publishLatestHalyard(String latestHalyard) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } versionsCollection.setLatestHalyard(latestHalyard); googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void publishLatestHalyard(String latestHalyard) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } versionsCollection.setLatestHalyard(latestHalyard); googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void publishLatestSpinnaker(String latestSpinnaker) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } boolean hasLatest = versionsCollection.getVersions().stream().anyMatch(v -> v.getVersion().equals(latestSpinnaker)); if (!hasLatest) { throw new HalException(FATAL, "Version " + latestSpinnaker + " does not exist in the list of published versions"); } versionsCollection.setLatestSpinnaker(latestSpinnaker); googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
RelaxedObjectMapper() { super(); this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); this.configure(DeserializationFeature.FAIL_ON_NULL_CREATOR_PROPERTIES, false); this.setSerializationInclusion(JsonInclude.Include.NON_NULL); } }
public void publishLatestSpinnaker(String latestSpinnaker) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } boolean hasLatest = versionsCollection.getVersions().stream().anyMatch(v -> v.getVersion().equals(latestSpinnaker)); if (!hasLatest) { throw new HalException(FATAL, "Version " + latestSpinnaker + " does not exist in the list of published versions"); } versionsCollection.setLatestSpinnaker(latestSpinnaker); googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void publishVersion(Version version) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } deleteVersion(versionsCollection, version.getVersion()); versionsCollection.getVersions().add(version); googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void publishVersion(Version version) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } deleteVersion(versionsCollection, version.getVersion()); versionsCollection.getVersions().add(version); googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void writeArtifactConfig(String bomPath, String artifactName, String profilePath) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } BillOfMaterials bom; File profileFile = Paths.get(profilePath).toFile(); String profileContents; try { bom = relaxedObjectMapper.convertValue( yamlParser.load(IOUtils.toString(new FileInputStream(bomPath))), BillOfMaterials.class); } catch (IOException e) { throw new HalException(new ConfigProblemBuilder(FATAL, "Unable to load Bill of Materials: " + e.getMessage()).build() ); } try { profileContents = IOUtils.toString(new FileInputStream(profileFile)); } catch (IOException e) { throw new HalException(new ConfigProblemBuilder(FATAL, "Unable to load profile : " + e.getMessage()).build() ); } googleWriteableProfileRegistry.writeArtifactConfig(bom, artifactName, profileFile.getName(), profileContents); } }
public void writeArtifactConfig(String bomPath, String artifactName, String profilePath) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } BillOfMaterials bom; File profileFile = Paths.get(profilePath).toFile(); String profileContents; try { bom = relaxedObjectMapper.convertValue( yamlParser.load(IOUtils.toString(new FileInputStream(bomPath))), BillOfMaterials.class); } catch (IOException e) { throw new HalException(new ConfigProblemBuilder(FATAL, "Unable to load Bill of Materials: " + e.getMessage()).build() ); } try { profileContents = IOUtils.toString(new FileInputStream(profileFile)); } catch (IOException e) { throw new HalException(new ConfigProblemBuilder(FATAL, "Unable to load profile : " + e.getMessage()).build() ); } googleWriteableProfileRegistry.writeArtifactConfig(bom, artifactName, profileFile.getName(), profileContents); } }
public void deprecateVersion(Version version, String illegalReason) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } deleteVersion(versionsCollection, version.getVersion()); if (!StringUtils.isEmpty(illegalReason)) { List<Versions.IllegalVersion> illegalVersions = versionsCollection.getIllegalVersions(); if (illegalVersions == null) { illegalVersions = new ArrayList<>(); } illegalVersions.add(new Versions.IllegalVersion().setVersion(version.getVersion()).setReason(illegalReason)); versionsCollection.setIllegalVersions(illegalVersions); } googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void deprecateVersion(Version version, String illegalReason) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } Versions versionsCollection = versionsService.getVersions(); if (versionsCollection == null) { throw new HalException(FATAL, NO_GCS_ENABLED); } deleteVersion(versionsCollection, version.getVersion()); if (!StringUtils.isEmpty(illegalReason)) { List<Versions.IllegalVersion> illegalVersions = versionsCollection.getIllegalVersions(); if (illegalVersions == null) { illegalVersions = new ArrayList<>(); } illegalVersions.add(new Versions.IllegalVersion().setVersion(version.getVersion()).setReason(illegalReason)); versionsCollection.setIllegalVersions(illegalVersions); } googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class))); }
public void writeBom(String bomPath) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } BillOfMaterials bom; String bomContents; String version; try { bomContents = IOUtils.toString(new FileInputStream(bomPath)); bom = relaxedObjectMapper.convertValue( yamlParser.load(bomContents), BillOfMaterials.class); version = bom.getVersion(); } catch (IOException e) { throw new HalException(new ConfigProblemBuilder(FATAL, "Unable to load Bill of Materials: " + e.getMessage()).build() ); } if (version == null) { throw new HalException(new ConfigProblemBuilder(FATAL, "No version was supplied in this BOM.").build()); } googleWriteableProfileRegistry.writeBom(bom.getVersion(), bomContents); }
public void writeBom(String bomPath) { if (googleWriteableProfileRegistry == null) { throw new HalException(FATAL, NO_WRITER_ENABLED); } BillOfMaterials bom; String bomContents; String version; try { bomContents = IOUtils.toString(new FileInputStream(bomPath)); bom = relaxedObjectMapper.convertValue( yamlParser.load(bomContents), BillOfMaterials.class); version = bom.getVersion(); } catch (IOException e) { throw new HalException(new ConfigProblemBuilder(FATAL, "Unable to load Bill of Materials: " + e.getMessage()).build() ); } if (version == null) { throw new HalException(new ConfigProblemBuilder(FATAL, "No version was supplied in this BOM.").build()); } googleWriteableProfileRegistry.writeBom(bom.getVersion(), bomContents); }
Map persistentStoreMap = objectMapper.convertValue(persistentStore, Map.class); persistentStoreMap.put("enabled", persistentStoreType.equals(persistentStorage.getPersistentStoreType()));
Map persistentStoreMap = objectMapper.convertValue(persistentStore, Map.class); persistentStoreMap.put("enabled", persistentStoreType.equals(persistentStorage.getPersistentStoreType()));