Search in sources :

Example 6 with YTArtifactDefinition

use of org.eclipse.winery.model.tosca.yaml.YTArtifactDefinition in project winery by eclipse.

the class ToCanonical method convertNodeTypeImplementation.

/**
 * Converts TOSCA YAML ArtifactDefinitions to TOSCA XML NodeTypeImplementations and ArtifactTemplates
 */
private void convertNodeTypeImplementation(Map<String, YTArtifactDefinition> implArtifacts, Map<String, YTArtifactDefinition> deploymentArtifacts, String type, String targetNamespace) {
    for (Map.Entry<String, YTArtifactDefinition> implArtifact : implArtifacts.entrySet()) {
        for (Map.Entry<String, YTArtifactDefinition> deploymentArtifact : deploymentArtifacts.entrySet()) {
            if (implArtifact.getKey().equalsIgnoreCase(deploymentArtifact.getKey())) {
                deploymentArtifacts.remove(deploymentArtifact.getKey());
            }
        }
    }
    TNodeTypeImplementation.Builder builder = (new TNodeTypeImplementation.Builder(type + "_impl", new QName(targetNamespace, type)).setTargetNamespace(targetNamespace));
    List<TImplementationArtifact> implementationArtifacts = convertImplementationArtifact(implArtifacts, targetNamespace);
    builder.setImplementationArtifacts(implementationArtifacts);
    this.nodeTypeImplementations.add(builder.build());
}
Also used : TImplementationArtifact(org.eclipse.winery.model.tosca.TImplementationArtifact) YTArtifactDefinition(org.eclipse.winery.model.tosca.yaml.YTArtifactDefinition) QName(javax.xml.namespace.QName) AssignmentBuilder(org.eclipse.winery.repository.yaml.converter.support.AssignmentBuilder) TNodeTypeImplementation(org.eclipse.winery.model.tosca.TNodeTypeImplementation) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap)

Aggregations

YTArtifactDefinition (org.eclipse.winery.model.tosca.yaml.YTArtifactDefinition)6 LinkedHashMap (java.util.LinkedHashMap)4 Map (java.util.Map)3 YTServiceTemplate (org.eclipse.winery.model.tosca.yaml.YTServiceTemplate)3 Path (java.nio.file.Path)2 ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 JAXBException (javax.xml.bind.JAXBException)1 QName (javax.xml.namespace.QName)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 MultiException (org.eclipse.winery.model.converter.support.exception.MultiException)1 GenericId (org.eclipse.winery.model.ids.GenericId)1 ArtifactTypeId (org.eclipse.winery.model.ids.definitions.ArtifactTypeId)1 CapabilityTypeId (org.eclipse.winery.model.ids.definitions.CapabilityTypeId)1 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)1 NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)1