private <T extends AbstractInstantiableTemplate> void processTemplate(ArchivePathChecker archivePathResolver, T template, ParsingResult<ArchiveRoot> parsedArchive) { if (template.getArtifacts() != null) { template.getArtifacts().values().stream().filter(artifact -> artifact != null) .forEach(artifact -> processArtifact(archivePathResolver, artifact, parsedArchive)); } processInterfaces(archivePathResolver, template.getInterfaces(), parsedArchive); }
private <T extends AbstractInstantiableTemplate, U extends AbstractInheritableToscaType> Stream<ArtifactTask> validateTemplate(String name, T template) { return safe(template.getArtifacts()).entrySet().stream().filter(artifactEntry -> StringUtils.isBlank(artifactEntry.getValue().getArtifactRef())) .map(artifactEntry -> new ArtifactTask(name, artifactEntry.getKey(), ArtifactTaskCode.MISSING)); }
/** * Map the template's artifacts associated with an input to into the given artifactMap. * * @param artifactMap The map of inputArtifactId -> List of associated artifacts into which to map the given template's artifacts. * @param template The template for which to map artifact. */ private static void processInputArtifactForTemplate(Map<String, List<DeploymentArtifact>> artifactMap, AbstractInstantiableTemplate template) { for (DeploymentArtifact da : template.getArtifacts().values()) { String inputArtifactId = InputArtifactUtil.getInputArtifactId(da); if (inputArtifactId != null) { List<DeploymentArtifact> das = artifactMap.get(inputArtifactId); if (das == null) { das = Lists.newArrayList(); artifactMap.put(inputArtifactId, das); } das.add(da); } } } }
private static void fillAbstractInstantiableTemplate(AbstractInstantiableTemplate template, AbstractInstantiableToscaType type, AbstractInstantiableTemplate templateToMerge, boolean mergeUndefinedProps) { fillAbstractTemplate(template, type, templateToMerge, mergeUndefinedProps); template.setArtifacts(Maps.newLinkedHashMap()); fillDeploymentArtifactsMap(template.getArtifacts(), type.getArtifacts(), templateToMerge != null ? templateToMerge.getArtifacts() : null); // For now we just copy attributes as is. template.setAttributes(type.getAttributes()); if (templateToMerge != null && templateToMerge.getInterfaces() != null) { // FIXME we should merge here rather than replace template.setInterfaces(templateToMerge.getInterfaces()); } }