Search in sources :

Example 66 with IRepository

use of org.eclipse.winery.repository.backend.IRepository in project winery by eclipse.

the class Ec2AmiRefinementPlugin method getDetectorGraphs.

@Override
protected List<TTopologyTemplate> getDetectorGraphs() {
    IRepository repository = RepositoryFactory.getRepository();
    TNodeType computeType = repository.getElement(new NodeTypeId(COMPUTE_QNAME));
    TNodeTemplate compute = ModelUtilities.instantiateNodeTemplate(computeType);
    LinkedHashMap<String, String> computeKvProperties = new LinkedHashMap<>();
    String detectorPropertyRegex = typeByAmi.keySet().stream().collect(Collectors.joining("|", "(", ")"));
    computeKvProperties.put(PROPERTY_EC2_AMI, detectorPropertyRegex);
    TEntityTemplate.WineryKVProperties computeProperties = new TEntityTemplate.WineryKVProperties();
    computeProperties.setKVProperties(computeKvProperties);
    compute.setProperties(computeProperties);
    return Collections.singletonList(new TTopologyTemplate.Builder().addNodeTemplate(compute).build());
}
Also used : TEntityTemplate(org.eclipse.winery.model.tosca.TEntityTemplate) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) IRepository(org.eclipse.winery.repository.backend.IRepository) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) TNodeType(org.eclipse.winery.model.tosca.TNodeType) LinkedHashMap(java.util.LinkedHashMap)

Example 67 with IRepository

use of org.eclipse.winery.repository.backend.IRepository in project winery by eclipse.

the class MySqlDbRefinementPlugin method getDetectorGraphs.

@Override
protected List<TTopologyTemplate> getDetectorGraphs() {
    IRepository repository = RepositoryFactory.getRepository();
    TNodeType mySQLType = repository.getElement(new NodeTypeId(mySqlDbQName));
    TNodeTemplate mySQL_DBMS = ModelUtilities.instantiateNodeTemplate(mySQLType);
    return Collections.singletonList(new TTopologyTemplate.Builder().addNodeTemplate(mySQL_DBMS).build());
}
Also used : TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) IRepository(org.eclipse.winery.repository.backend.IRepository) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) TNodeType(org.eclipse.winery.model.tosca.TNodeType)

Example 68 with IRepository

use of org.eclipse.winery.repository.backend.IRepository in project winery by eclipse.

the class MySqlDbmsRefinementPlugin method getDetectorGraphs.

@Override
protected List<TTopologyTemplate> getDetectorGraphs() {
    IRepository repository = RepositoryFactory.getRepository();
    TNodeType mySQLType = repository.getElement(new NodeTypeId(mySqlName));
    TNodeTemplate mySQL_DBMS = ModelUtilities.instantiateNodeTemplate(mySQLType);
    return Collections.singletonList(new TTopologyTemplate.Builder().addNodeTemplate(mySQL_DBMS).build());
}
Also used : TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) NodeTypeId(org.eclipse.winery.model.ids.definitions.NodeTypeId) IRepository(org.eclipse.winery.repository.backend.IRepository) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) TNodeType(org.eclipse.winery.model.tosca.TNodeType)

Example 69 with IRepository

use of org.eclipse.winery.repository.backend.IRepository 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 70 with IRepository

use of org.eclipse.winery.repository.backend.IRepository 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

IRepository (org.eclipse.winery.repository.backend.IRepository)75 TNodeType (org.eclipse.winery.model.tosca.TNodeType)29 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)28 NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)27 IOException (java.io.IOException)24 QName (javax.xml.namespace.QName)24 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)22 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)21 ArrayList (java.util.ArrayList)20 Map (java.util.Map)20 HashMap (java.util.HashMap)15 LoggerFactory (org.slf4j.LoggerFactory)15 LinkedHashMap (java.util.LinkedHashMap)14 List (java.util.List)14 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)14 RepositoryFactory (org.eclipse.winery.repository.backend.RepositoryFactory)14 Collectors (java.util.stream.Collectors)13 POST (javax.ws.rs.POST)13 Path (javax.ws.rs.Path)13 Produces (javax.ws.rs.Produces)13