/** * Creates a new instance based on the data in the given manifest content * * @param manifestContent to create from */ public TOSCAMetaFile(ManifestContents manifestContent) { this.block0 = manifestContent.getMainAttributes(); for (String name : manifestContent.getSectionNames()) { Map<String, String> fileBlock = new HashMap<String, String>(); fileBlock.put(TOSCAMetaFileAttributes.NAME, name); fileBlock.putAll(manifestContent.getAttributesForSection(name)); this.fileBlocks.add(fileBlock); } }
private void mergeManifests(ManifestContents base, ManifestContents add) { base.getMainAttributes().putAll(add.getMainAttributes()); for (String sectionName : add.getSectionNames()) { base.getAttributesForSection(sectionName).putAll(add.getAttributesForSection(sectionName)); } }
protected ProvenanceVerification verifyFileInManifest(ModelProvenanceElement element, String fileId, String checksum) throws SerializationException { // 1. parse element.state as ManifestContent ManifestContents manifestContents = new RecoveringManifestParser() .parse(element.getFingerprint()); if (manifestContents.getSectionNames().contains(fileId)) { String storedHash = manifestContents.getAttributesForSection(fileId).get(TOSCAMetaFileAttributes.HASH); if (Objects.isNull(storedHash)) { return NO_HASH_AVAILABLE; } else if (storedHash.equals(checksum)) { // 2.1 if section == fileId and hash == checksum -> file verified return VERIFIED; } else { return INVALID; } } return ID_NOT_FOUND; }
public void modify(ManifestContents manifest) { PlaceholderValueTransformer transformer = new VersionExpansionTransformer(manifest); PropertyPlaceholderResolver placeholderResolver = new PropertyPlaceholderResolver(); for (Entry<String, String> entry : manifest.getMainAttributes().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); manifest.getMainAttributes().put(key, placeholderResolver.resolve(value, this.properties, transformer)); } for(String name : manifest.getSectionNames()) { for(Entry<String, String> entry : manifest.getAttributesForSection(name).entrySet()) { String key = entry.getKey(); String value = entry.getValue(); manifest.getAttributesForSection(name).put(key, placeholderResolver.resolve(value, this.properties, transformer)); } } }
List<String> names = mf.getSectionNames();
.parse(modelProvenanceElement.getFingerprint()); for (String name : manifestContents.getSectionNames()) { if (name.equals(fileId)) { modelProvenanceElement.setAuthorizedFlag(authorizationInfo);