Search in sources :

Example 66 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId in project winery by eclipse.

the class WeaveCartsHandler method handleNode.

@Override
public Set<String> handleNode(TNodeTemplate dockerContainer, TTopologyTemplate topologyTemplate, String imageId) {
    Set<String> discoveredNodeIds = new HashSet<>();
    IRepository repository = RepositoryFactory.getRepository();
    dockerContainer.setType(QNAME_ALPINE_CONTAINER);
    TNodeType javaType = repository.getElement(new NodeTypeId(QNAME_JAVA8));
    TNodeTemplate java = ModelUtilities.instantiateNodeTemplate(javaType);
    topologyTemplate.addNodeTemplate(java);
    ModelUtilities.createRelationshipTemplateAndAddToTopology(java, dockerContainer, ToscaBaseTypes.hostedOnRelationshipType, topologyTemplate);
    TNodeType springType = repository.getElement(new NodeTypeId(QNAME_SPRING_WEB));
    TNodeTemplate spring = ModelUtilities.instantiateNodeTemplate(springType);
    spring.setName(dockerContainer.getName());
    topologyTemplate.addNodeTemplate(spring);
    ModelUtilities.createRelationshipTemplateAndAddToTopology(spring, java, ToscaBaseTypes.hostedOnRelationshipType, topologyTemplate);
    discoveredNodeIds.add(dockerContainer.getId());
    discoveredNodeIds.add(java.getId());
    discoveredNodeIds.add(spring.getId());
    return discoveredNodeIds;
}
Also used : NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) IRepository(org.eclipse.winery.repository.backend.IRepository) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) HashSet(java.util.HashSet) TNodeType(org.eclipse.winery.model.tosca.TNodeType)

Example 67 with NodeTypeId

use of org.eclipse.winery.model.ids.definitions.NodeTypeId in project winery by eclipse.

the class WeaveFrontEndHandler method handleNode.

@Override
public Set<String> handleNode(TNodeTemplate dockerContainer, TTopologyTemplate topologyTemplate, String imageId) {
    Set<String> discoveredNodeIds = new HashSet<>();
    IRepository repository = RepositoryFactory.getRepository();
    dockerContainer.setType(QNAME_ALPINE_CONTAINER);
    TNodeType nodeJsType = repository.getElement(new NodeTypeId(QNAME_NODEJS_10));
    TNodeTemplate nodeJs = ModelUtilities.instantiateNodeTemplate(nodeJsType);
    topologyTemplate.addNodeTemplate(nodeJs);
    ModelUtilities.createRelationshipTemplateAndAddToTopology(nodeJs, dockerContainer, ToscaBaseTypes.hostedOnRelationshipType, topologyTemplate);
    TNodeType nodeAppType = repository.getElement(new NodeTypeId(QNAME_NODE_APP));
    TNodeTemplate nodeApp = ModelUtilities.instantiateNodeTemplate(nodeAppType);
    nodeApp.setName(dockerContainer.getName());
    topologyTemplate.addNodeTemplate(nodeApp);
    ModelUtilities.createRelationshipTemplateAndAddToTopology(nodeApp, nodeJs, ToscaBaseTypes.hostedOnRelationshipType, topologyTemplate);
    discoveredNodeIds.add(dockerContainer.getId());
    discoveredNodeIds.add(nodeJs.getId());
    discoveredNodeIds.add(nodeApp.getId());
    return discoveredNodeIds;
}
Also used : NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) IRepository(org.eclipse.winery.repository.backend.IRepository) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) HashSet(java.util.HashSet) TNodeType(org.eclipse.winery.model.tosca.TNodeType)

Aggregations

NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)67 TNodeType (org.eclipse.winery.model.tosca.TNodeType)36 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)28 Test (org.junit.jupiter.api.Test)27 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)23 QName (javax.xml.namespace.QName)21 IRepository (org.eclipse.winery.repository.backend.IRepository)20 RelationshipTypeId (org.eclipse.winery.model.ids.definitions.RelationshipTypeId)15 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)15 WineryVersion (org.eclipse.winery.common.version.WineryVersion)14 Response (javax.ws.rs.core.Response)13 IOException (java.io.IOException)12 LinkedHashMap (java.util.LinkedHashMap)12 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)11 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)11 ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)10 TRelationshipTemplate (org.eclipse.winery.model.tosca.TRelationshipTemplate)10 ArrayList (java.util.ArrayList)9 TDefinitions (org.eclipse.winery.model.tosca.TDefinitions)9 TEntityTemplate (org.eclipse.winery.model.tosca.TEntityTemplate)9