Search in sources :

Example 6 with FeatureReferenceSpec

use of org.jboss.galleon.spec.FeatureReferenceSpec in project galleon by wildfly.

the class ResolvedFeatureSpec method resolveNonIdParams.

Map<String, Object> resolveNonIdParams(ResolvedFeatureId parentId, String parentRef, Map<String, String> params) throws ProvisioningException {
    Map<String, Object> resolvedParams = Collections.emptyMap();
    if (!params.isEmpty()) {
        for (Map.Entry<String, String> param : params.entrySet()) {
            if (xmlSpec.getParam(param.getKey()).isFeatureId()) {
                continue;
            }
            resolvedParams = CollectionUtils.put(resolvedParams, param.getKey(), paramFromString(param.getKey(), param.getValue()));
        }
    }
    if (parentId == null) {
        return resolvedParams;
    }
    if (parentRef == null) {
        parentRef = parentId.specId.name;
    }
    final FeatureReferenceSpec refSpec = xmlSpec.getFeatureRef(parentRef);
    if (refSpec.hasMappedParams()) {
        for (Map.Entry<String, String> mapping : refSpec.getMappedParams().entrySet()) {
            if (xmlSpec.getParam(mapping.getKey()).isFeatureId()) {
                continue;
            }
            final Object idValue = parentId.params.get(mapping.getValue());
            if (idValue != null) {
                resolvedParams = CollectionUtils.put(resolvedParams, mapping.getKey(), idValue);
            }
        }
    } else {
        for (Map.Entry<String, Object> parentEntry : parentId.params.entrySet()) {
            if (xmlSpec.getParam(parentEntry.getKey()).isFeatureId()) {
                continue;
            }
            resolvedParams = CollectionUtils.put(resolvedParams, parentEntry.getKey(), parentEntry.getValue());
        }
    }
    return resolvedParams;
}
Also used : FeatureReferenceSpec(org.jboss.galleon.spec.FeatureReferenceSpec) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

FeatureReferenceSpec (org.jboss.galleon.spec.FeatureReferenceSpec)6 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 FeatureParameterSpec (org.jboss.galleon.spec.FeatureParameterSpec)3 FeatureAnnotation (org.jboss.galleon.spec.FeatureAnnotation)2 FeatureDependencySpec (org.jboss.galleon.spec.FeatureDependencySpec)2 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)1 ProvisioningException (org.jboss.galleon.ProvisioningException)1 FeatureSpecInfo (org.jboss.galleon.cli.model.FeatureSpecInfo)1 Identity (org.jboss.galleon.cli.model.Identity)1 PackageInfo (org.jboss.galleon.cli.model.PackageInfo)1 CapabilitySpec (org.jboss.galleon.spec.CapabilitySpec)1 ElementNode (org.jboss.galleon.xml.util.ElementNode)1