Search in sources :

Example 6 with PaaSTopology

use of alien4cloud.paas.model.PaaSTopology in project yorc-a4c-plugin by ystia.

the class MappingTosca method quoteProperties.

public static void quoteProperties(final PaaSTopologyDeploymentContext ctx) {
    PaaSTopology ptopo = ctx.getPaaSTopology();
    for (PaaSNodeTemplate node : ptopo.getAllNodes().values()) {
        NodeTemplate nt = node.getTemplate();
        Map<String, AbstractPropertyValue> ntProperties = nt.getProperties();
        for (String prop : ntProperties.keySet()) {
            AbstractPropertyValue absval = ntProperties.get(prop);
            if (absval instanceof ScalarPropertyValue) {
                ScalarPropertyValue scaval = (ScalarPropertyValue) absval;
                if (scaval.getValue().contains("\"")) {
                    scaval.setValue(scaval.getValue().replace("\"", "\\\""));
                }
                log.debug("Property: " + prop + "=" + ((ScalarPropertyValue) nt.getProperties().get(prop)).getValue());
            }
        }
    }
}
Also used : PaaSTopology(alien4cloud.paas.model.PaaSTopology) PaaSNodeTemplate(alien4cloud.paas.model.PaaSNodeTemplate) NodeTemplate(org.alien4cloud.tosca.model.templates.NodeTemplate) PaaSNodeTemplate(alien4cloud.paas.model.PaaSNodeTemplate) ScalarPropertyValue(org.alien4cloud.tosca.model.definitions.ScalarPropertyValue) AbstractPropertyValue(org.alien4cloud.tosca.model.definitions.AbstractPropertyValue)

Aggregations

PaaSTopology (alien4cloud.paas.model.PaaSTopology)6 PaaSNodeTemplate (alien4cloud.paas.model.PaaSNodeTemplate)4 DeploymentTopology (alien4cloud.model.deployment.DeploymentTopology)2 Location (alien4cloud.model.orchestrators.locations.Location)1 PaaSTopologyDeploymentContext (alien4cloud.paas.model.PaaSTopologyDeploymentContext)1 TopologyDTO (alien4cloud.topology.TopologyDTO)1 ToscaContextual (alien4cloud.tosca.context.ToscaContextual)1 ParsingException (alien4cloud.tosca.parser.ParsingException)1 Closeable (java.io.Closeable)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ZipException (java.util.zip.ZipException)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 CSARDependency (org.alien4cloud.tosca.model.CSARDependency)1 Csar (org.alien4cloud.tosca.model.Csar)1 AbstractPropertyValue (org.alien4cloud.tosca.model.definitions.AbstractPropertyValue)1