Search in sources :

Example 1 with TServiceTemplate

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

the class BackendUtils method createWrapperDefinitionsAndInitialEmptyElement.

public static Definitions createWrapperDefinitionsAndInitialEmptyElement(IRepository repository, DefinitionsChildId id) {
    final Definitions definitions = createWrapperDefinitions(id);
    HasIdInIdOrNameField element;
    if (id instanceof RelationshipTypeImplementationId) {
        element = new TRelationshipTypeImplementation();
    } else if (id instanceof NodeTypeImplementationId) {
        element = new TNodeTypeImplementation();
    } else if (id instanceof RequirementTypeId) {
        element = new TRequirementType();
    } else if (id instanceof NodeTypeId) {
        element = new TNodeType();
    } else if (id instanceof RelationshipTypeId) {
        element = new TRelationshipType();
    } else if (id instanceof CapabilityTypeId) {
        element = new TCapabilityType();
    } else if (id instanceof ArtifactTypeId) {
        element = new TArtifactType();
    } else if (id instanceof PolicyTypeId) {
        element = new TPolicyType();
    } else if (id instanceof PolicyTemplateId) {
        element = new TPolicyTemplate();
    } else if (id instanceof ServiceTemplateId) {
        element = new TServiceTemplate();
    } else if (id instanceof ArtifactTemplateId) {
        element = new TArtifactTemplate();
    } else if (id instanceof XSDImportId) {
        // TImport has no id; thus directly generating it without setting an id
        TImport tImport = new TImport();
        definitions.setElement(tImport);
        return definitions;
    } else {
        throw new IllegalStateException("Unhandled id branch. Could happen for XSDImportId");
    }
    copyIdToFields(element, id);
    definitions.setElement((TExtensibleElements) element);
    return definitions;
}
Also used : ArtifactTypeId(org.eclipse.winery.common.ids.definitions.ArtifactTypeId) TArtifactTemplate(org.eclipse.winery.model.tosca.TArtifactTemplate) TImport(org.eclipse.winery.model.tosca.TImport) TCapabilityType(org.eclipse.winery.model.tosca.TCapabilityType) TRequirementType(org.eclipse.winery.model.tosca.TRequirementType) TNodeTypeImplementation(org.eclipse.winery.model.tosca.TNodeTypeImplementation) HasIdInIdOrNameField(org.eclipse.winery.model.tosca.HasIdInIdOrNameField) TArtifactType(org.eclipse.winery.model.tosca.TArtifactType) TPolicyType(org.eclipse.winery.model.tosca.TPolicyType) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate) NodeTypeImplementationId(org.eclipse.winery.common.ids.definitions.NodeTypeImplementationId) XSDImportId(org.eclipse.winery.common.ids.definitions.imports.XSDImportId) RelationshipTypeId(org.eclipse.winery.common.ids.definitions.RelationshipTypeId) CapabilityTypeId(org.eclipse.winery.common.ids.definitions.CapabilityTypeId) TDefinitions(org.eclipse.winery.model.tosca.TDefinitions) Definitions(org.eclipse.winery.model.tosca.Definitions) RelationshipTypeImplementationId(org.eclipse.winery.common.ids.definitions.RelationshipTypeImplementationId) ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) ArtifactTemplateId(org.eclipse.winery.common.ids.definitions.ArtifactTemplateId) TNodeType(org.eclipse.winery.model.tosca.TNodeType) TRelationshipType(org.eclipse.winery.model.tosca.TRelationshipType) TPolicyTemplate(org.eclipse.winery.model.tosca.TPolicyTemplate) PolicyTypeId(org.eclipse.winery.common.ids.definitions.PolicyTypeId) TRelationshipTypeImplementation(org.eclipse.winery.model.tosca.TRelationshipTypeImplementation) RequirementTypeId(org.eclipse.winery.common.ids.definitions.RequirementTypeId) PolicyTemplateId(org.eclipse.winery.common.ids.definitions.PolicyTemplateId) NodeTypeId(org.eclipse.winery.common.ids.definitions.NodeTypeId)

Example 2 with TServiceTemplate

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

the class BackendUtils method synchronizeReferences.

/**
 * Synchronizes the known plans with the data in the XML. When there is a stored file, but no known entry in the
 * XML, we guess "BPEL" as language and "build plan" as type.
 */
public static void synchronizeReferences(ServiceTemplateId id) throws IOException {
    final IRepository repository = RepositoryFactory.getRepository();
    final TServiceTemplate serviceTemplate = repository.getElement(id);
    // locally stored plans
    TPlans plans = serviceTemplate.getPlans();
    // plans stored in the repository
    PlansId plansContainerId = new PlansId(id);
    SortedSet<PlanId> nestedPlans = repository.getNestedIds(plansContainerId, PlanId.class);
    Set<PlanId> plansToAdd = new HashSet<>();
    plansToAdd.addAll(nestedPlans);
    if (nestedPlans.isEmpty()) {
        if (plans == null) {
            // data on the file system equals the data -> no plans
            return;
        } else {
        // noinspection StatementWithEmptyBody
        // we have to check for equality later
        }
    }
    if (plans == null) {
        plans = new TPlans();
        serviceTemplate.setPlans(plans);
    }
    for (Iterator<TPlan> iterator = plans.getPlan().iterator(); iterator.hasNext(); ) {
        TPlan plan = iterator.next();
        if (plan.getPlanModel() != null) {
            // in case, a plan is directly contained in a Model element, we do not need to do anything
            continue;
        }
        TPlan.PlanModelReference planModelReference;
        if ((planModelReference = plan.getPlanModelReference()) != null) {
            String ref = planModelReference.getReference();
            if ((ref == null) || ref.startsWith("../")) {
                // special case (due to errors in the importer): empty PlanModelReference field
                if (plan.getId() == null) {
                    // invalid plan entry: no id.
                    // we remove the entry
                    iterator.remove();
                    continue;
                }
                PlanId planId = new PlanId(plansContainerId, new XmlId(plan.getId(), false));
                if (nestedPlans.contains(planId)) {
                    // everything allright
                    // we do NOT need to add the plan on the HDD to the XML
                    plansToAdd.remove(planId);
                } else {
                    // no local storage for the plan, we remove it from the XML
                    iterator.remove();
                }
            }
        }
    }
    // add all plans locally stored, but not contained in the XML, as plan element to the plans of the service template.
    List<TPlan> thePlans = plans.getPlan();
    for (PlanId planId : plansToAdd) {
        SortedSet<RepositoryFileReference> files = repository.getContainedFiles(planId);
        if (files.size() != 1) {
            throw new IllegalStateException("Currently, only one file per plan is supported.");
        }
        RepositoryFileReference ref = files.iterator().next();
        TPlan plan = new TPlan();
        plan.setId(planId.getXmlId().getDecoded());
        plan.setName(planId.getXmlId().getDecoded());
        plan.setPlanType(org.eclipse.winery.repository.Constants.TOSCA_PLANTYPE_BUILD_PLAN);
        plan.setPlanLanguage(Namespaces.URI_BPEL20_EXECUTABLE);
        // create a PlanModelReferenceElement pointing to that file
        String path = Util.getUrlPath(ref);
        // path is relative from the definitions element
        path = "../" + path;
        TPlan.PlanModelReference pref = new TPlan.PlanModelReference();
        pref.setReference(path);
        plan.setPlanModelReference(pref);
        thePlans.add(plan);
    }
    if (serviceTemplate.getPlans().getPlan().isEmpty()) {
        serviceTemplate.setPlans(null);
    }
    RepositoryFactory.getRepository().setElement(id, serviceTemplate);
}
Also used : TPlans(org.eclipse.winery.model.tosca.TPlans) PlanId(org.eclipse.winery.common.ids.elements.PlanId) PlansId(org.eclipse.winery.common.ids.elements.PlansId) RepositoryFileReference(org.eclipse.winery.common.RepositoryFileReference) TPlan(org.eclipse.winery.model.tosca.TPlan) XmlId(org.eclipse.winery.common.ids.XmlId) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate) HashSet(java.util.HashSet)

Example 3 with TServiceTemplate

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

the class BackendUtils method mergeServiceTemplateAinServiceTemplateB.

public static void mergeServiceTemplateAinServiceTemplateB(ServiceTemplateId serviceTemplateIdA, ServiceTemplateId serviceTemplateIdB) throws IOException {
    IRepository repository = RepositoryFactory.getRepository();
    TTopologyTemplate topologyTemplateA = repository.getElement(serviceTemplateIdA).getTopologyTemplate();
    TServiceTemplate serviceTemplateB = repository.getElement(serviceTemplateIdB);
    TTopologyTemplate topologyTemplateB = serviceTemplateB.getTopologyTemplate();
    Optional<Integer> shiftLeft = topologyTemplateB.getNodeTemplateOrRelationshipTemplate().stream().filter(x -> x instanceof TNodeTemplate).map(x -> (TNodeTemplate) x).max(Comparator.comparingInt(n -> ModelUtilities.getLeft(n).orElse(0))).map(n -> ModelUtilities.getLeft(n).orElse(0));
    if (shiftLeft.isPresent()) {
        Map<String, String> idMapping = new HashMap<>();
        // collect existing node template ids
        topologyTemplateB.getNodeTemplateOrRelationshipTemplate().stream().filter(x -> x instanceof TNodeTemplate).map(x -> (TNodeTemplate) x).forEach(x -> idMapping.put(x.getId(), x.getId()));
        // collect existing relationship template ids
        topologyTemplateB.getNodeTemplateOrRelationshipTemplate().stream().filter(x -> x instanceof TRelationshipTemplate).map(x -> (TRelationshipTemplate) x).forEach(x -> idMapping.put(x.getId(), x.getId()));
        if (topologyTemplateB.getNodeTemplates() != null) {
            // collect existing requirement ids
            topologyTemplateB.getNodeTemplates().stream().filter(nt -> nt.getRequirements() != null).forEach(nt -> nt.getRequirements().getRequirement().stream().forEach(x -> idMapping.put(x.getId(), x.getId())));
            // collect existing capability ids
            topologyTemplateB.getNodeTemplates().stream().filter(nt -> nt.getCapabilities() != null).forEach(nt -> nt.getCapabilities().getCapability().stream().forEach(x -> idMapping.put(x.getId(), x.getId())));
        }
        if (topologyTemplateA.getNodeTemplates() != null) {
            // patch ids of reqs change them if required
            topologyTemplateA.getNodeTemplates().stream().filter(nt -> nt.getRequirements() != null).forEach(nt -> nt.getRequirements().getRequirement().forEach(req -> {
                String oldId = req.getId();
                String newId = req.getId();
                while (idMapping.containsKey(newId)) {
                    newId = newId + "-new";
                }
                idMapping.put(req.getId(), newId);
                req.setId(newId);
                topologyTemplateA.getRelationshipTemplates().stream().filter(rt -> rt.getSourceElement().getRef() instanceof TRequirement).forEach(rt -> {
                    TRequirement sourceElement = (TRequirement) rt.getSourceElement().getRef();
                    if (sourceElement.getId().equalsIgnoreCase(oldId)) {
                        sourceElement.setId(req.getId());
                    }
                });
            }));
            // patch ids of caps change them if required
            topologyTemplateA.getNodeTemplates().stream().filter(nt -> nt.getCapabilities() != null).forEach(nt -> nt.getCapabilities().getCapability().forEach(cap -> {
                String oldId = cap.getId();
                String newId = cap.getId();
                while (idMapping.containsKey(newId)) {
                    newId = newId + "-new";
                }
                idMapping.put(cap.getId(), newId);
                cap.setId(newId);
                topologyTemplateA.getRelationshipTemplates().stream().filter(rt -> rt.getTargetElement().getRef() instanceof TCapability).forEach(rt -> {
                    TCapability targetElement = (TCapability) rt.getTargetElement().getRef();
                    if (targetElement.getId().equalsIgnoreCase(oldId)) {
                        targetElement.setId(cap.getId());
                    }
                });
            }));
        }
        // patch the ids of node templates and add them
        topologyTemplateA.getNodeTemplateOrRelationshipTemplate().stream().filter(x -> x instanceof TNodeTemplate).map(x -> (TNodeTemplate) x).forEach(nt -> {
            String newId = nt.getId();
            while (idMapping.containsKey(newId)) {
                newId = newId + "-new";
            }
            idMapping.put(nt.getId(), newId);
            nt.setId(newId);
            int newLeft = ModelUtilities.getLeft((TNodeTemplate) nt).orElse(0) + shiftLeft.get();
            ((TNodeTemplate) nt).setX(Integer.toString(newLeft));
            topologyTemplateB.getNodeTemplateOrRelationshipTemplate().add(nt);
        });
        // patch the ids of relationship templates and add them
        topologyTemplateA.getNodeTemplateOrRelationshipTemplate().stream().filter(x -> x instanceof TRelationshipTemplate).map(x -> (TRelationshipTemplate) x).forEach(rt -> {
            String newId = rt.getId();
            while (idMapping.containsKey(newId)) {
                newId = newId + "-new";
            }
            idMapping.put(rt.getId(), newId);
            rt.setId(newId);
            topologyTemplateB.getNodeTemplateOrRelationshipTemplate().add(rt);
        });
    } else {
        topologyTemplateB.getNodeTemplateOrRelationshipTemplate().addAll(topologyTemplateA.getNodeTemplateOrRelationshipTemplate());
    }
    repository.setElement(serviceTemplateIdB, serviceTemplateB);
}
Also used : XLogger(org.slf4j.ext.XLogger) BufferedInputStream(java.io.BufferedInputStream) ToscaElementId(org.eclipse.winery.common.ids.elements.ToscaElementId) XSImplementation(org.apache.xerces.xs.XSImplementation) XLoggerFactory(org.slf4j.ext.XLoggerFactory) CapabilityTypeId(org.eclipse.winery.common.ids.definitions.CapabilityTypeId) TRelationshipTypeImplementation(org.eclipse.winery.model.tosca.TRelationshipTypeImplementation) Metadata(org.apache.tika.metadata.Metadata) ErrorHandler(org.xml.sax.ErrorHandler) RelationshipTypeId(org.eclipse.winery.common.ids.definitions.RelationshipTypeId) Constants(org.eclipse.winery.repository.Constants) XSObjectList(org.apache.xerces.xs.XSObjectList) Document(org.w3c.dom.Document) Map(java.util.Map) Path(java.nio.file.Path) TArtifactType(org.eclipse.winery.model.tosca.TArtifactType) TDefinitions(org.eclipse.winery.model.tosca.TDefinitions) TEntityType(org.eclipse.winery.model.tosca.TEntityType) XSTerm(org.apache.xerces.xs.XSTerm) Set(java.util.Set) Reader(java.io.Reader) StandardCharsets(java.nio.charset.StandardCharsets) InvocationTargetException(java.lang.reflect.InvocationTargetException) FileVisitResult(java.nio.file.FileVisitResult) ArtifactTemplateFilesDirectoryId(org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateFilesDirectoryId) TCapability(org.eclipse.winery.model.tosca.TCapability) QName(javax.xml.namespace.QName) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Namespace(org.eclipse.winery.common.ids.Namespace) TRequirementType(org.eclipse.winery.model.tosca.TRequirementType) NonNull(org.eclipse.jdt.annotation.NonNull) NodeTypeId(org.eclipse.winery.common.ids.definitions.NodeTypeId) Definitions(org.eclipse.winery.model.tosca.Definitions) ByteArrayOutputStream(java.io.ByteArrayOutputStream) DirectoryId(org.eclipse.winery.repository.datatypes.ids.elements.DirectoryId) MediaType(org.apache.tika.mime.MediaType) Constructor(java.lang.reflect.Constructor) ArrayList(java.util.ArrayList) ArtifactTemplateId(org.eclipse.winery.common.ids.definitions.ArtifactTemplateId) EntityTypeId(org.eclipse.winery.common.ids.definitions.EntityTypeId) TCapabilityType(org.eclipse.winery.model.tosca.TCapabilityType) TArtifactReference(org.eclipse.winery.model.tosca.TArtifactReference) XsdImportManager(org.eclipse.winery.repository.backend.xsd.XsdImportManager) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) ArtifactTypeId(org.eclipse.winery.common.ids.definitions.ArtifactTypeId) PolicyTemplateId(org.eclipse.winery.common.ids.definitions.PolicyTemplateId) VisualAppearanceId(org.eclipse.winery.repository.datatypes.ids.elements.VisualAppearanceId) XSParticle(org.apache.xerces.xs.XSParticle) Files(java.nio.file.Files) StringWriter(java.io.StringWriter) JAXBElement(javax.xml.bind.JAXBElement) IOException(java.io.IOException) Detector(org.apache.tika.detect.Detector) XSSimpleType(org.apache.xerces.impl.dv.XSSimpleType) InputStreamReader(java.io.InputStreamReader) CONTINUE(java.nio.file.FileVisitResult.CONTINUE) XSDImportId(org.eclipse.winery.common.ids.definitions.imports.XSDImportId) AdminId(org.eclipse.winery.common.ids.admin.AdminId) TArtifactTemplate(org.eclipse.winery.model.tosca.TArtifactTemplate) DateUtils(org.apache.commons.lang3.time.DateUtils) StringReader(java.io.StringReader) XSTypeDefinition(org.apache.xerces.xs.XSTypeDefinition) JAXBSupport(org.eclipse.winery.repository.JAXBSupport) ModelUtilities(org.eclipse.winery.model.tosca.utils.ModelUtilities) XSModel(org.apache.xerces.xs.XSModel) FileSystems(java.nio.file.FileSystems) HasIdInIdOrNameField(org.eclipse.winery.model.tosca.HasIdInIdOrNameField) TNodeTypeImplementation(org.eclipse.winery.model.tosca.TNodeTypeImplementation) RequirementTypeId(org.eclipse.winery.common.ids.definitions.RequirementTypeId) SortedSet(java.util.SortedSet) Date(java.util.Date) HasTargetNamespace(org.eclipse.winery.model.tosca.HasTargetNamespace) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate) TPolicyType(org.eclipse.winery.model.tosca.TPolicyType) ByteArrayInputStream(java.io.ByteArrayInputStream) TPlans(org.eclipse.winery.model.tosca.TPlans) Namespaces(org.eclipse.winery.model.tosca.constants.Namespaces) Locale(java.util.Locale) PathMatcher(java.nio.file.PathMatcher) TRequirement(org.eclipse.winery.model.tosca.TRequirement) XSComplexTypeDefinition(org.apache.xerces.xs.XSComplexTypeDefinition) URI(java.net.URI) ParseException(java.text.ParseException) RepositoryFileReference(org.eclipse.winery.common.RepositoryFileReference) SimpleFileVisitor(java.nio.file.SimpleFileVisitor) Filename(org.eclipse.winery.repository.backend.constants.Filename) Collection(java.util.Collection) GenericId(org.eclipse.winery.common.ids.GenericId) TNodeType(org.eclipse.winery.model.tosca.TNodeType) WinerysPropertiesDefinition(org.eclipse.winery.model.tosca.kvproperties.WinerysPropertiesDefinition) AutoDetectParser(org.apache.tika.parser.AutoDetectParser) JAXBException(javax.xml.bind.JAXBException) Util(org.eclipse.winery.common.Util) PolicyTypeId(org.eclipse.winery.common.ids.definitions.PolicyTypeId) PlanId(org.eclipse.winery.common.ids.elements.PlanId) Objects(java.util.Objects) ImplementationArtifact(org.eclipse.winery.model.tosca.TImplementationArtifacts.ImplementationArtifact) List(java.util.List) TExtensibleElements(org.eclipse.winery.model.tosca.TExtensibleElements) TPlan(org.eclipse.winery.model.tosca.TPlan) RepositoryCorruptException(org.eclipse.winery.repository.exceptions.RepositoryCorruptException) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact) SAXException(org.xml.sax.SAXException) Optional(java.util.Optional) MediaTypes(org.eclipse.winery.repository.backend.constants.MediaTypes) XSElementDeclaration(org.apache.xerces.xs.XSElementDeclaration) UnsupportedEncodingException(java.io.UnsupportedEncodingException) TDeploymentArtifacts(org.eclipse.winery.model.tosca.TDeploymentArtifacts) ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) Marshaller(javax.xml.bind.Marshaller) XSImplementationImpl(org.apache.xerces.impl.xs.XSImplementationImpl) TImplementationArtifacts(org.eclipse.winery.model.tosca.TImplementationArtifacts) TEntityTemplate(org.eclipse.winery.model.tosca.TEntityTemplate) HashMap(java.util.HashMap) XSLoader(org.apache.xerces.xs.XSLoader) XmlId(org.eclipse.winery.common.ids.XmlId) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) HashSet(java.util.HashSet) NodeTypeImplementationId(org.eclipse.winery.common.ids.definitions.NodeTypeImplementationId) XMLConstants(javax.xml.XMLConstants) TImport(org.eclipse.winery.model.tosca.TImport) Unmarshaller(javax.xml.bind.Unmarshaller) ToscaExportUtil(org.eclipse.winery.repository.export.ToscaExportUtil) Iterator(java.util.Iterator) PropertyDefinitionKV(org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKV) PropertiesDefinition(org.eclipse.winery.model.tosca.TEntityType.PropertiesDefinition) XSModelGroup(org.apache.xerces.xs.XSModelGroup) GitInfo(org.eclipse.winery.repository.GitInfo) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes) DefinitionsChildId(org.eclipse.winery.common.ids.definitions.DefinitionsChildId) PropertyDefinitionKVList(org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKVList) SAXParseException(org.xml.sax.SAXParseException) Element(org.w3c.dom.Element) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) RelationshipTypeImplementationId(org.eclipse.winery.common.ids.definitions.RelationshipTypeImplementationId) PlansId(org.eclipse.winery.common.ids.elements.PlansId) TRelationshipType(org.eclipse.winery.model.tosca.TRelationshipType) TRelationshipTemplate(org.eclipse.winery.model.tosca.TRelationshipTemplate) LSInput(org.w3c.dom.ls.LSInput) Comparator(java.util.Comparator) Collections(java.util.Collections) TPolicyTemplate(org.eclipse.winery.model.tosca.TPolicyTemplate) InputStream(java.io.InputStream) HashMap(java.util.HashMap) TCapability(org.eclipse.winery.model.tosca.TCapability) TRequirement(org.eclipse.winery.model.tosca.TRequirement) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) TRelationshipTemplate(org.eclipse.winery.model.tosca.TRelationshipTemplate) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate)

Example 4 with TServiceTemplate

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

the class Showcases method zipTypeTest.

@Test
public void zipTypeTest() throws Exception {
    String name = "Showcase.csar";
    InputStream inputStream = new FileInputStream(path + File.separator + name);
    Converter converter = new Converter();
    converter.convertY2X(inputStream);
    TServiceTemplate serviceTemplate = RepositoryFactory.getRepository().getElement(new ServiceTemplateId(new Namespace(Namespaces.DEFAULT_NS, false), new XmlId("Showcase", false)));
    Assert.assertNotNull(serviceTemplate);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Converter(org.eclipse.winery.yaml.converter.Converter) XmlId(org.eclipse.winery.common.ids.XmlId) ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) FileInputStream(java.io.FileInputStream) Namespace(org.eclipse.winery.common.ids.Namespace) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate) Test(org.junit.Test)

Example 5 with TServiceTemplate

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

the class TOSCAModelHelper method createTServiceTemplate.

public static TServiceTemplate createTServiceTemplate(String id, String namespace) {
    TServiceTemplate serviceTemplate = new TServiceTemplate();
    serviceTemplate.setName(id);
    serviceTemplate.setId(id);
    serviceTemplate.setTargetNamespace(namespace);
    return serviceTemplate;
}
Also used : TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate)

Aggregations

TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)11 NodeTypeId (org.eclipse.winery.common.ids.definitions.NodeTypeId)5 RelationshipTypeId (org.eclipse.winery.common.ids.definitions.RelationshipTypeId)4 TNodeType (org.eclipse.winery.model.tosca.TNodeType)4 HashSet (java.util.HashSet)3 QName (javax.xml.namespace.QName)3 XmlId (org.eclipse.winery.common.ids.XmlId)3 ComplianceRuleId (org.eclipse.winery.common.ids.definitions.ComplianceRuleId)3 DefinitionsChildId (org.eclipse.winery.common.ids.definitions.DefinitionsChildId)3 ServiceTemplateId (org.eclipse.winery.common.ids.definitions.ServiceTemplateId)3 TComplianceRule (org.eclipse.winery.model.tosca.TComplianceRule)3 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)3 InputStream (java.io.InputStream)2 StringWriter (java.io.StringWriter)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBException (javax.xml.bind.JAXBException)2 Marshaller (javax.xml.bind.Marshaller)2