Search in sources :

Example 1 with TDeploymentArtifact

use of org.eclipse.winery.model.tosca.TDeploymentArtifact in project winery by eclipse.

the class IGenericRepository method getReferencedDefinitionsChildIds.

default Collection<DefinitionsChildId> getReferencedDefinitionsChildIds(ComplianceRuleId id) {
    // We have to use a HashSet to ensure that no duplicate ids are added
    // E.g., there may be multiple relationship templates having the same type
    Collection<DefinitionsChildId> ids = new HashSet<>();
    TComplianceRule complianceRule = this.getElement(id);
    // TODO extend to required Structure
    if (complianceRule.getIdentifier() != null) {
        for (TEntityTemplate entityTemplate : complianceRule.getIdentifier().getNodeTemplateOrRelationshipTemplate()) {
            QName qname = entityTemplate.getType();
            if (entityTemplate instanceof TNodeTemplate) {
                ids.add(new NodeTypeId(qname));
                TNodeTemplate n = (TNodeTemplate) entityTemplate;
                // crawl through deployment artifacts
                TDeploymentArtifacts deploymentArtifacts = n.getDeploymentArtifacts();
                if (deploymentArtifacts != null) {
                    List<TDeploymentArtifact> das = deploymentArtifacts.getDeploymentArtifact();
                    for (TDeploymentArtifact da : das) {
                        ids.add(new ArtifactTypeId(da.getArtifactType()));
                        if ((qname = da.getArtifactRef()) != null) {
                            ids.add(new ArtifactTemplateId(qname));
                        }
                    }
                }
                // crawl through reqs/caps
                TNodeTemplate.Requirements requirements = n.getRequirements();
                if (requirements != null) {
                    for (TRequirement req : requirements.getRequirement()) {
                        QName type = req.getType();
                        RequirementTypeId rtId = new RequirementTypeId(type);
                        ids.add(rtId);
                    }
                }
                TNodeTemplate.Capabilities capabilities = n.getCapabilities();
                if (capabilities != null) {
                    for (TCapability cap : capabilities.getCapability()) {
                        QName type = cap.getType();
                        CapabilityTypeId ctId = new CapabilityTypeId(type);
                        ids.add(ctId);
                    }
                }
                // crawl through policies
                org.eclipse.winery.model.tosca.TNodeTemplate.Policies policies = n.getPolicies();
                if (policies != null) {
                    for (TPolicy pol : policies.getPolicy()) {
                        QName type = pol.getPolicyType();
                        PolicyTypeId ctId = new PolicyTypeId(type);
                        ids.add(ctId);
                    }
                }
            } else {
                assert (entityTemplate instanceof TRelationshipTemplate);
                ids.add(new RelationshipTypeId(qname));
            }
        }
    }
    return ids;
}
Also used : DefinitionsChildId(org.eclipse.winery.common.ids.definitions.DefinitionsChildId) ArtifactTypeId(org.eclipse.winery.common.ids.definitions.ArtifactTypeId) TRequirement(org.eclipse.winery.model.tosca.TRequirement) TComplianceRule(org.eclipse.winery.model.tosca.TComplianceRule) TRelationshipTemplate(org.eclipse.winery.model.tosca.TRelationshipTemplate) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) HashSet(java.util.HashSet) RelationshipTypeId(org.eclipse.winery.common.ids.definitions.RelationshipTypeId) TEntityTemplate(org.eclipse.winery.model.tosca.TEntityTemplate) CapabilityTypeId(org.eclipse.winery.common.ids.definitions.CapabilityTypeId) QName(javax.xml.namespace.QName) TCapability(org.eclipse.winery.model.tosca.TCapability) ArtifactTemplateId(org.eclipse.winery.common.ids.definitions.ArtifactTemplateId) TDeploymentArtifacts(org.eclipse.winery.model.tosca.TDeploymentArtifacts) PolicyTypeId(org.eclipse.winery.common.ids.definitions.PolicyTypeId) RequirementTypeId(org.eclipse.winery.common.ids.definitions.RequirementTypeId) TPolicy(org.eclipse.winery.model.tosca.TPolicy) NodeTypeId(org.eclipse.winery.common.ids.definitions.NodeTypeId)

Example 2 with TDeploymentArtifact

use of org.eclipse.winery.model.tosca.TDeploymentArtifact in project winery by eclipse.

the class IGenericRepository method getReferencedDefinitionsChildIds.

default Collection<DefinitionsChildId> getReferencedDefinitionsChildIds(NodeTypeImplementationId id) {
    // We have to use a HashSet to ensure that no duplicate ids are added
    // There may be multiple DAs/IAs referencing the same type
    Collection<DefinitionsChildId> ids = new HashSet<>();
    final TNodeTypeImplementation element = this.getElement(id);
    // DAs
    TDeploymentArtifacts deploymentArtifacts = element.getDeploymentArtifacts();
    if (deploymentArtifacts != null) {
        for (TDeploymentArtifact da : deploymentArtifacts.getDeploymentArtifact()) {
            QName qname;
            if ((qname = da.getArtifactRef()) != null) {
                ids.add(new ArtifactTemplateId(qname));
            }
            ids.add(new ArtifactTypeId(da.getArtifactType()));
        }
    }
    // IAs
    return this.getReferencedTOSCAComponentImplementationArtifactIds(ids, element.getImplementationArtifacts(), id);
}
Also used : TDeploymentArtifacts(org.eclipse.winery.model.tosca.TDeploymentArtifacts) DefinitionsChildId(org.eclipse.winery.common.ids.definitions.DefinitionsChildId) ArtifactTypeId(org.eclipse.winery.common.ids.definitions.ArtifactTypeId) QName(javax.xml.namespace.QName) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact) TNodeTypeImplementation(org.eclipse.winery.model.tosca.TNodeTypeImplementation) ArtifactTemplateId(org.eclipse.winery.common.ids.definitions.ArtifactTemplateId) HashSet(java.util.HashSet)

Example 3 with TDeploymentArtifact

use of org.eclipse.winery.model.tosca.TDeploymentArtifact in project winery by eclipse.

the class DeploymentArtifactsResource method getDeploymentArtifacts.

/**
 * Determines the list of DAs belonging to the given node template.
 * <p>
 * If no DAs are existing, an empty list is created in the model for the
 * node template
 */
private static List<TDeploymentArtifact> getDeploymentArtifacts(TNodeTemplate nodeTemplate) {
    TDeploymentArtifacts deploymentArtifacts = nodeTemplate.getDeploymentArtifacts();
    final List<TDeploymentArtifact> res;
    if (deploymentArtifacts == null) {
        deploymentArtifacts = new TDeploymentArtifacts();
        nodeTemplate.setDeploymentArtifacts(deploymentArtifacts);
    }
    res = deploymentArtifacts.getDeploymentArtifact();
    return res;
}
Also used : TDeploymentArtifacts(org.eclipse.winery.model.tosca.TDeploymentArtifacts) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact)

Example 4 with TDeploymentArtifact

use of org.eclipse.winery.model.tosca.TDeploymentArtifact in project winery by eclipse.

the class AbstractRefinementTest method setUp.

protected static void setUp() {
    // region *** topology ***
    TNodeTemplate nt1 = new TNodeTemplate.Builder("1", QName.valueOf("{http://ex.org}nodeType_1")).setX("10").setY("10").build();
    TNodeTemplate nt2 = new TNodeTemplate.Builder("2", QName.valueOf("{http://ex.org}nodeType_2")).setX("110").setY("10").build();
    TNodeTemplate nt3 = new TNodeTemplate.Builder("3", QName.valueOf("{http://ex.org}nodeType_3")).setX("210").setY("10").build();
    TNodeTemplate nt4 = new TNodeTemplate.Builder("4", QName.valueOf("{http://ex.org}nodeType_4")).setX("110").setY("110").build();
    TRelationshipTemplate rt21 = new TRelationshipTemplate.Builder("21", QName.valueOf("{http://ex.org}relType_1"), nt2, nt1).build();
    TRelationshipTemplate rt32 = new TRelationshipTemplate.Builder("32", QName.valueOf("{http://ex.org}relType_1"), nt3, nt2).build();
    TRelationshipTemplate rt24 = new TRelationshipTemplate.Builder("24", QName.valueOf("{http://ex.org}relType_2"), nt2, nt4).build();
    /*
        #######   (1)  #######   (1)  #######
        # (1) # <----- # (2) # <----- # (3) #
        #######        #######        #######
                          | (2)
                         \/
                       #######
                       # (4) #
                       #######
         */
    topology = new TTopologyTemplate.Builder().addNodeTemplate(nt1).addNodeTemplate(nt2).addNodeTemplate(nt3).addNodeTemplate(nt4).addRelationshipTemplate(rt21).addRelationshipTemplate(rt32).addRelationshipTemplate(rt24).build();
    // endregion
    // region *** topology2 ***
    /*
        #######   (1)  #######
        # (1) # <----- # (2) #
        #######        #######
                          | (2)
                         \/
                       #######
                       # (4) #
                       #######
         */
    topology2 = new TTopologyTemplate.Builder().addNodeTemplate(nt1).addNodeTemplate(nt2).addNodeTemplate(nt4).addRelationshipTemplate(rt21).addRelationshipTemplate(rt24).build();
    // endregion
    // region *** topology 3 ***
    /*
        #######   (1)  #######
        # (1) # <----- # (2) #
        #######        #######
                          | (2)
                         \/
                       #######----|
                       # (4) # DA |
                       #######----|
         */
    QName artifactTypeFile = new QName("file", "http://example.org/tosca/at");
    QName test_da = new QName("test_da", "http://example.org/tosca/atemp/das");
    TNodeTemplate nt30 = new TNodeTemplate.Builder("30", QName.valueOf("{http://ex.org}nodeType_4")).setX("110").setY("110").build();
    TRelationshipTemplate rt230 = new TRelationshipTemplate.Builder("302", QName.valueOf("{http://ex.org}relType_2"), nt2, nt30).build();
    TDeploymentArtifact da = new TDeploymentArtifact.Builder("test_da", artifactTypeFile).setArtifactRef(test_da).build();
    nt30.setDeploymentArtifacts(new ArrayList<>(Collections.singletonList(da)));
    topology3 = new TTopologyTemplate.Builder().addNodeTemplate(nt1).addNodeTemplate(nt2).addNodeTemplate(nt30).addRelationshipTemplate(rt21).addRelationshipTemplate(rt230).build();
    // endregion
    // region *** topology4 ***
    TRelationshipTemplate rt14 = new TRelationshipTemplate.Builder("14", QName.valueOf("{http://ex.org}relType_1"), nt1, nt4).build();
    /*
        #######  (1)  #######
        # (3) # -----># (2) #
        #######       #######
                         | (2)
                        \/
        #######  (1)  #######
        # (1) # -----># (4) #
        #######       #######
        */
    topology4 = new TTopologyTemplate.Builder().addNodeTemplate(nt1).addNodeTemplate(nt2).addNodeTemplate(nt3).addNodeTemplate(nt4).addRelationshipTemplate(rt32).addRelationshipTemplate(rt14).addRelationshipTemplate(rt24).build();
    // endregion
    // region *** matching PRM ***
    // region *** detector ***
    TNodeTemplate nt7 = new TNodeTemplate.Builder("7", QName.valueOf("{http://ex.org}nodeType_2")).build();
    TNodeTemplate nt8 = new TNodeTemplate.Builder("8", QName.valueOf("{http://ex.org}nodeType_4")).build();
    TRelationshipTemplate rt78 = new TRelationshipTemplate.Builder("78", QName.valueOf("{http://ex.org}relType_2"), nt7, nt8).build();
    /*
        #######
        # (2) #
        #######
           | (2)
          \/
        #######
        # (4) #
        #######
         */
    TTopologyTemplate detector = new TTopologyTemplate.Builder().addNodeTemplate(nt7).addNodeTemplate(nt8).addRelationshipTemplate(rt78).build();
    // endregion
    // region *** refinement structure
    TNodeTemplate nt10 = new TNodeTemplate.Builder("10", QName.valueOf("{http://ex.org}nodeType_10")).setX("5").setY("10").build();
    TNodeTemplate nt11 = new TNodeTemplate.Builder("11", QName.valueOf("{http://ex.org}nodeType_11")).setX("105").setY("5").build();
    TNodeTemplate nt12 = new TNodeTemplate.Builder("12", QName.valueOf("{http://ex.org}nodeType_12")).setX("55").setY("105").build();
    TNodeTemplate nt13 = new TNodeTemplate.Builder("13", QName.valueOf("{http://ex.org}nodeType_13")).setX("55").setY("205").build();
    TRelationshipTemplate rt1012 = new TRelationshipTemplate.Builder("1012", QName.valueOf("{http://ex.org}relType_2"), nt10, nt12).build();
    TRelationshipTemplate rt1112 = new TRelationshipTemplate.Builder("1112", QName.valueOf("{http://ex.org}relType_2"), nt11, nt12).build();
    TRelationshipTemplate rt1213 = new TRelationshipTemplate.Builder("1213", QName.valueOf("{http://ex.org}relType_2"), nt12, nt13).build();
    /*
        ########        ########
        # (10) #        # (11) #
        ########        ########
            | (2)          | (2)
            +-------|------+
                   \/
                ########
                # (12) #
                ########
                    | (2)
                   \/
                ########
                # (13) #
                ########
         */
    TTopologyTemplate refinementStructure = new TTopologyTemplate.Builder().addNodeTemplate(nt10).addNodeTemplate(nt11).addNodeTemplate(nt12).addNodeTemplate(nt13).addRelationshipTemplate(rt1012).addRelationshipTemplate(rt1112).addRelationshipTemplate(rt1213).build();
    // endregion
    // region *** relation mapping ***
    OTRelationMapping rm1 = new OTRelationMapping(new OTRelationMapping.Builder());
    rm1.setDetectorElement(nt7);
    rm1.setRelationType(QName.valueOf("{http://ex.org}relType_1"));
    rm1.setDirection(OTRelationDirection.INGOING);
    rm1.setValidSourceOrTarget(QName.valueOf("{http://ex.org}nodeType_3"));
    rm1.setRefinementElement(nt11);
    OTRelationMapping rm2 = new OTRelationMapping(new OTRelationMapping.Builder());
    rm2.setDetectorElement(nt7);
    rm2.setRelationType(QName.valueOf("{http://ex.org}relType_1"));
    rm2.setDirection(OTRelationDirection.OUTGOING);
    rm2.setValidSourceOrTarget(QName.valueOf("{http://ex.org}nodeType_1"));
    rm2.setRefinementElement(nt10);
    // endregion
    OTPatternRefinementModel prmWithNt2HostedOnNt4AndIngoingRt1AtNt2AndOutgoingRt1AtNt2 = new OTPatternRefinementModel(new OTPatternRefinementModel.Builder());
    prmWithNt2HostedOnNt4AndIngoingRt1AtNt2AndOutgoingRt1AtNt2.setDetector(detector);
    prmWithNt2HostedOnNt4AndIngoingRt1AtNt2AndOutgoingRt1AtNt2.setRefinementTopology(refinementStructure);
    ToscaGraph topologyGraph = ToscaTransformer.createTOSCAGraph(topology);
    ToscaGraph detectorGraph = ToscaTransformer.createTOSCAGraph(detector);
    ToscaIsomorphismMatcher matcher = new ToscaIsomorphismMatcher();
    Iterator<GraphMapping<ToscaNode, ToscaEdge>> mappings = matcher.findMatches(detectorGraph, topologyGraph, new ToscaTypeMatcher());
    GraphMapping<ToscaNode, ToscaEdge> detectorWithTopologyMapping = mappings.next();
    List<OTRelationMapping> relationMappings = new ArrayList<>();
    relationMappings.add(rm1);
    relationMappings.add(rm2);
    prmWithNt2HostedOnNt4AndIngoingRt1AtNt2AndOutgoingRt1AtNt2.setRelationMappings(relationMappings);
    candidateForTopology = new RefinementCandidate(prmWithNt2HostedOnNt4AndIngoingRt1AtNt2AndOutgoingRt1AtNt2, detectorWithTopologyMapping, detectorGraph, 1);
    // endregion
    // region *** invalidCandidateForTopology **
    OTPatternRefinementModel prmWithNt2HostedOnNt4AndOutgoingRt1AtNt2 = new OTPatternRefinementModel(new OTPatternRefinementModel.Builder());
    prmWithNt2HostedOnNt4AndOutgoingRt1AtNt2.setDetector(detector);
    List<OTRelationMapping> relationMappingsNonMatchingPrm = new ArrayList<>();
    relationMappingsNonMatchingPrm.add(rm2);
    prmWithNt2HostedOnNt4AndOutgoingRt1AtNt2.setRelationMappings(relationMappingsNonMatchingPrm);
    invalidCandidateForTopology = new RefinementCandidate(prmWithNt2HostedOnNt4AndOutgoingRt1AtNt2, detectorWithTopologyMapping, detectorGraph, 2);
    // endregion
    // region *** Candidates for Topology 2 ***
    ToscaGraph topology2Graph = ToscaTransformer.createTOSCAGraph(topology2);
    GraphMapping<ToscaNode, ToscaEdge> detectorWithTopology2Mapping = matcher.findMatches(detectorGraph, topology2Graph, new ToscaTypeMatcher()).next();
    candidateForTopology2 = new RefinementCandidate(prmWithNt2HostedOnNt4AndIngoingRt1AtNt2AndOutgoingRt1AtNt2, detectorWithTopology2Mapping, detectorGraph, 3);
    secondValidCandidateForTopology2 = new RefinementCandidate(prmWithNt2HostedOnNt4AndOutgoingRt1AtNt2, detectorWithTopology2Mapping, detectorGraph, 4);
    // endregion
    // region *** Candidates for Topology 3 ***
    ToscaGraph topologyGraph3 = ToscaTransformer.createTOSCAGraph(topology3);
    GraphMapping<ToscaNode, ToscaEdge> detectorToTopology3Mapping = new ToscaIsomorphismMatcher().findMatches(detectorGraph, topologyGraph3, new ToscaTypeMatcher()).next();
    OTDeploymentArtifactMapping deploymentArtifactMapping1 = new OTDeploymentArtifactMapping(new OTDeploymentArtifactMapping.Builder());
    deploymentArtifactMapping1.setId("daMap-1");
    deploymentArtifactMapping1.setArtifactType(artifactTypeFile);
    deploymentArtifactMapping1.setDetectorElement(nt8);
    deploymentArtifactMapping1.setRefinementElement(nt13);
    OTPatternRefinementModel matchingPrmWithDa = new OTPatternRefinementModel(new OTPatternRefinementModel.Builder());
    matchingPrmWithDa.setDetector(detector);
    matchingPrmWithDa.setRefinementTopology(refinementStructure);
    matchingPrmWithDa.setDeploymentArtifactMappings(Collections.singletonList(deploymentArtifactMapping1));
    matchingPrmWithDa.setRelationMappings(relationMappings);
    candidateForTopology3WithDa = new RefinementCandidate(matchingPrmWithDa, detectorToTopology3Mapping, detectorGraph, 5);
    QName artifactTypeZip = new QName("zip", "http://example.org/tosca/at");
    OTDeploymentArtifactMapping deploymentArtifactMapping2 = new OTDeploymentArtifactMapping(new OTDeploymentArtifactMapping.Builder());
    deploymentArtifactMapping2.setId("daMap-1");
    deploymentArtifactMapping2.setArtifactType(artifactTypeZip);
    deploymentArtifactMapping2.setDetectorElement(nt7);
    deploymentArtifactMapping2.setRefinementElement(nt11);
    OTPatternRefinementModel nonMatchingPrmWithDa = new OTPatternRefinementModel(new OTPatternRefinementModel.Builder());
    nonMatchingPrmWithDa.setDetector(detector);
    nonMatchingPrmWithDa.setRefinementTopology(refinementStructure);
    nonMatchingPrmWithDa.setDeploymentArtifactMappings(Collections.singletonList(deploymentArtifactMapping2));
    nonMatchingPrmWithDa.setRelationMappings(relationMappings);
    candidateForTopology3WithNotMatchingDa = new RefinementCandidate(nonMatchingPrmWithDa, detectorToTopology3Mapping, detectorGraph, 6);
    // endregion
    // region *** Candidates for Topology 4 ***
    ToscaGraph topology4Graph = ToscaTransformer.createTOSCAGraph(topology4);
    GraphMapping<ToscaNode, ToscaEdge> detectorWithTopology4Mapping = matcher.findMatches(detectorGraph, topology4Graph, new ToscaTypeMatcher()).next();
    OTRelationMapping rm3 = new OTRelationMapping(new OTRelationMapping.Builder());
    rm3.setRelationType(QName.valueOf("{http://ex.org}relType_1"));
    rm3.setDirection(OTRelationDirection.INGOING);
    rm3.setDetectorElement(nt7);
    rm3.setRefinementElement(nt11);
    OTPatternRefinementModel prmWithNT2HostedOnNT4AndIngoingRT1AtNT2 = new OTPatternRefinementModel(new OTPatternRefinementModel.Builder());
    prmWithNT2HostedOnNT4AndIngoingRT1AtNT2.setDetector(detector);
    prmWithNT2HostedOnNT4AndIngoingRT1AtNT2.setRefinementTopology(refinementStructure);
    prmWithNT2HostedOnNT4AndIngoingRT1AtNT2.setRelationMappings(Collections.singletonList(rm3));
    invalidCandidateForTopology4 = new RefinementCandidate(prmWithNT2HostedOnNT4AndIngoingRT1AtNT2, detectorWithTopology4Mapping, detectorGraph, 7);
    OTRelationMapping rm4 = new OTRelationMapping(new OTRelationMapping.Builder());
    rm4.setRelationType(QName.valueOf("{http://ex.org}relType_1"));
    rm4.setDirection(OTRelationDirection.INGOING);
    rm4.setDetectorElement(nt8);
    rm4.setRefinementElement(nt13);
    OTPatternRefinementModel prmWithNT2HostedOnNT4AndIngoingRT1AtNT2AndIngoingRT1AtNT4 = new OTPatternRefinementModel(new OTPatternRefinementModel.Builder());
    prmWithNT2HostedOnNT4AndIngoingRT1AtNT2AndIngoingRT1AtNT4.setDetector(detector);
    prmWithNT2HostedOnNT4AndIngoingRT1AtNT2AndIngoingRT1AtNT4.setRefinementTopology(refinementStructure);
    prmWithNT2HostedOnNT4AndIngoingRT1AtNT2AndIngoingRT1AtNT4.setRelationMappings(Arrays.asList(rm3, rm4));
    validCandidateForTopology4 = new RefinementCandidate(prmWithNT2HostedOnNT4AndIngoingRT1AtNT2AndIngoingRT1AtNT4, detectorWithTopology4Mapping, detectorGraph, 8);
// endregion
}
Also used : ToscaGraph(org.eclipse.winery.topologygraph.model.ToscaGraph) OTDeploymentArtifactMapping(org.eclipse.winery.model.tosca.extensions.OTDeploymentArtifactMapping) ArrayList(java.util.ArrayList) TRelationshipTemplate(org.eclipse.winery.model.tosca.TRelationshipTemplate) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) ToscaNode(org.eclipse.winery.topologygraph.model.ToscaNode) ToscaEdge(org.eclipse.winery.topologygraph.model.ToscaEdge) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) ToscaTypeMatcher(org.eclipse.winery.topologygraph.matching.ToscaTypeMatcher) ToscaIsomorphismMatcher(org.eclipse.winery.topologygraph.matching.ToscaIsomorphismMatcher) QName(javax.xml.namespace.QName) OTRelationMapping(org.eclipse.winery.model.tosca.extensions.OTRelationMapping) OTPatternRefinementModel(org.eclipse.winery.model.tosca.extensions.OTPatternRefinementModel) GraphMapping(org.jgrapht.GraphMapping)

Example 5 with TDeploymentArtifact

use of org.eclipse.winery.model.tosca.TDeploymentArtifact in project winery by eclipse.

the class EdmmConverter method createArtifact.

private void createArtifact(TNodeTemplate nodeTemplate, EntityId componentNodeId, EntityGraph entityGraph) {
    if (nodeTemplate.getDeploymentArtifacts() != null && nodeTemplate.getDeploymentArtifacts().size() > 0) {
        EntityId artifactsEntityId = componentNodeId.extend(DefaultKeys.ARTIFACTS);
        entityGraph.addEntity(new SequenceEntity(artifactsEntityId, entityGraph));
        for (TDeploymentArtifact artifact : nodeTemplate.getDeploymentArtifacts()) {
            String path = null;
            TArtifactTemplate artifactTemplate = artifactTemplates.get(artifact.getArtifactRef());
            if (artifactTemplate != null && artifactTemplate.getArtifactReferences().size() > 0) {
                path = artifactTemplate.getArtifactReferences().get(0).getReference();
            }
            EntityId artifactEntityId = artifactsEntityId.extend(artifact.getArtifactType().getLocalPart().toLowerCase());
            createPathReferenceEntity(entityGraph, path, artifactEntityId);
        }
    }
}
Also used : EntityId(io.github.edmm.core.parser.EntityId) SequenceEntity(io.github.edmm.core.parser.SequenceEntity) TArtifactTemplate(org.eclipse.winery.model.tosca.TArtifactTemplate) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact)

Aggregations

TDeploymentArtifact (org.eclipse.winery.model.tosca.TDeploymentArtifact)34 QName (javax.xml.namespace.QName)19 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)19 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)12 TRelationshipTemplate (org.eclipse.winery.model.tosca.TRelationshipTemplate)11 ArrayList (java.util.ArrayList)9 HashSet (java.util.HashSet)9 ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)8 TEntityTemplate (org.eclipse.winery.model.tosca.TEntityTemplate)8 ArtifactTypeId (org.eclipse.winery.model.ids.definitions.ArtifactTypeId)7 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)7 Test (org.junit.jupiter.api.Test)7 List (java.util.List)6 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)6 TNodeTypeImplementation (org.eclipse.winery.model.tosca.TNodeTypeImplementation)6 TDeploymentArtifacts (org.eclipse.winery.model.tosca.TDeploymentArtifacts)5 Optional (java.util.Optional)4 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)4 TImplementationArtifact (org.eclipse.winery.model.tosca.TImplementationArtifact)4 IOException (java.io.IOException)3