Search in sources :

Example 36 with ArtifactTemplateId

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

the class DriverInjection method setDriverProperty.

public static void setDriverProperty(TRelationshipTemplate relationshipTemplate, TDeploymentArtifact driverDeploymentArtifact) throws Exception {
    QName DAArtifactTemplateQName = driverDeploymentArtifact.getArtifactRef();
    ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId(DAArtifactTemplateQName);
    TArtifactTemplate artifactTemplate = RepositoryFactory.getRepository().getElement(artifactTemplateId);
    Map<String, String> artifactProperties = ModelUtilities.getPropertiesKV(artifactTemplate);
    LinkedHashMap<String, String> relationshipProperties = ModelUtilities.getPropertiesKV(relationshipTemplate);
    if ((artifactProperties != null) && (relationshipProperties != null) && artifactProperties.containsKey("Driver") && relationshipProperties.containsKey("Driver")) {
        relationshipProperties.put("Driver", artifactProperties.get("Driver"));
        ModelUtilities.setPropertiesKV(relationshipTemplate, relationshipProperties);
    } else {
        throw new WineryRepositoryException("No Property found to set to the driver classname");
    }
}
Also used : QName(javax.xml.namespace.QName) TArtifactTemplate(org.eclipse.winery.model.tosca.TArtifactTemplate) ArtifactTemplateId(org.eclipse.winery.model.ids.definitions.ArtifactTemplateId) WineryRepositoryException(org.eclipse.winery.repository.exceptions.WineryRepositoryException)

Aggregations

ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)36 QName (javax.xml.namespace.QName)20 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)13 IOException (java.io.IOException)10 NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)10 ArtifactTypeId (org.eclipse.winery.model.ids.definitions.ArtifactTypeId)9 TDeploymentArtifact (org.eclipse.winery.model.tosca.TDeploymentArtifact)9 RepositoryFileReference (org.eclipse.winery.repository.common.RepositoryFileReference)9 Test (org.junit.jupiter.api.Test)9 RelationshipTypeId (org.eclipse.winery.model.ids.definitions.RelationshipTypeId)8 ArtifactTemplateFilesDirectoryId (org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateFilesDirectoryId)8 ArrayList (java.util.ArrayList)7 NodeTypeImplementationId (org.eclipse.winery.model.ids.definitions.NodeTypeImplementationId)7 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)7 Path (java.nio.file.Path)6 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)6 PolicyTypeId (org.eclipse.winery.model.ids.definitions.PolicyTypeId)6 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)6 InputStream (java.io.InputStream)5 RelationshipTypeImplementationId (org.eclipse.winery.model.ids.definitions.RelationshipTypeImplementationId)5