Source:
public void apply(EntitySpec<?> entitySpec, NodeTemplate nodeTemplate, Topology topology) { Map<String, Object> propertiesAndTypedValues = Collections.emptyMap(); for (String requirementId : nodeTemplate.getRequirements().keySet()) { RelationshipTemplate relationshipTemplate = findRelationshipRequirement(nodeTemplate, requirementId); if (relationshipTemplate != null && relationshipTemplate.getType().equals("brooklyn.relationships.Configure")) { Map<String, PaaSNodeTemplate> builtPaaSNodeTemplates = treeBuilder.buildPaaSTopology(topology).getAllNodes(); String computeName = (nodeTemplate.getName() != null) ? nodeTemplate.getName() : (String) entitySpec.getFlags().get("tosca.template.id"); PaaSNodeTemplate paasNodeTemplate = builtPaaSNodeTemplates.get(computeName); Map<String, Object> relationProperties = getTemplatePropertyObjects(relationshipTemplate, paasNodeTemplate, builtPaaSNodeTemplates); String target = relationshipTemplate.getTarget(); String propName = relationProperties.get("prop.name").toString(); String propCollection = relationProperties.get("prop.collection").toString(); String propValue = relationProperties.get("prop.value").toString(); if (Strings.isBlank(propCollection) && (Strings.isBlank(propName))) { throw new IllegalStateException("Relationship for Requirement " + relationshipTemplate.getRequirementName() + " on NodeTemplate " + nodeTemplate.getName() + ". Collection Name or Property Name should" + " be defined for RelationsType " + relationshipTemplate.getType()); } Map<String, String> simpleProperty = null; if (!Strings.isBlank(propName)) { simpleProperty = ImmutableMap.of(propName, propValue); } if (simpleProperty == null) { propertiesAndTypedValues = ImmutableMap.<String, Object>of( propCollection, ImmutableList.of(propValue)); } else { propertiesAndTypedValues = ImmutableMap.<String, Object>of( propCollection, simpleProperty); } } } configureConfigKeysSpec(entitySpec, ConfigBag.newInstance(propertiesAndTypedValues)); }

Target:
public void apply(EntitySpec<?> entitySpec, NodeTemplate nodeTemplate, Topology topology) { Map<String, Object> propertiesAndTypedValues = Collections.emptyMap(); for (String requirementId : nodeTemplate.getRequirements().keySet()) { RelationshipTemplate relationshipTemplate = findRelationshipRequirement(nodeTemplate, requirementId); if (relationshipTemplate != null && relationshipTemplate.getType().equals("brooklyn.relationships.Configure")) { Map<String, PaaSNodeTemplate> builtPaaSNodeTemplates = treeBuilder.buildPaaSTopology(topology).getAllNodes(); String computeName = (nodeTemplate.getName() != null) ? nodeTemplate.getName() : (String) entitySpec.getFlags().get(ApplicationSpecsBuilder.TOSCA_TEMPLATE_ID); PaaSNodeTemplate paasNodeTemplate = builtPaaSNodeTemplates.get(computeName); Map<String, Object> relationProperties = getTemplatePropertyObjects(relationshipTemplate, paasNodeTemplate, builtPaaSNodeTemplates); String target = relationshipTemplate.getTarget(); String propName = relationProperties.get("prop.name").toString(); String propCollection = relationProperties.get("prop.collection").toString(); String propValue = relationProperties.get("prop.value").toString(); if (Strings.isBlank(propCollection) && (Strings.isBlank(propName))) { throw new IllegalStateException("Relationship for Requirement " + relationshipTemplate.getRequirementName() + " on NodeTemplate " + nodeTemplate.getName() + ". Collection Name or Property Name should" + " be defined for RelationsType " + relationshipTemplate.getType()); } Map<String, String> simpleProperty = null; if (!Strings.isBlank(propName)) { simpleProperty = ImmutableMap.of(propName, propValue); } if (simpleProperty == null) { propertiesAndTypedValues = ImmutableMap.<String, Object>of( propCollection, ImmutableList.of(propValue)); } else { propertiesAndTypedValues = ImmutableMap.<String, Object>of( propCollection, simpleProperty); } } } configureConfigKeysSpec(entitySpec, ConfigBag.newInstance(propertiesAndTypedValues)); }