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;
}
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;
}
Aggregations