public Builder setConfigDep(String depName, ConfigId configId) { configDeps = CollectionUtils.putLinked(configDeps, depName, configId); return this; }
void includeFeature(ResolvedFeatureId id, FeatureConfig fc) { includedFeatures = CollectionUtils.putLinked(includedFeatures, id, fc); }
public void addDependency(ResolvedFeatureId id, FeatureDependencySpec depSpec) throws ProvisioningDescriptionException { if(deps.containsKey(id)) { throw new ProvisioningDescriptionException("Duplicate dependency on " + id + " from " + this.id); // TODO } deps = CollectionUtils.putLinked(deps, id, depSpec); }
public Builder addAnnotation(FeatureAnnotation annotation) { annotations = CollectionUtils.putLinked(annotations, annotation.getName(), annotation); return this; }
private FeatureGroup.Builder getExternalFgConfig(String origin) { FeatureGroup.Builder fgBuilder = externalFgConfigs.get(origin); if(fgBuilder != null) { return fgBuilder; } fgBuilder = FeatureGroup.builder(inheritFeatures); externalFgConfigs = CollectionUtils.putLinked(externalFgConfigs, origin, fgBuilder); return fgBuilder; } }
public Builder addFeatureRef(FeatureReferenceSpec ref) throws ProvisioningDescriptionException { if(refs.containsKey(ref.name)) { throw new ProvisioningDescriptionException("Duplicate reference " + ref.name + " in feature spec " + name); } refs = CollectionUtils.putLinked(refs, ref.name, ref); return this; }
public Builder addPackage(ProvisionedPackage provisionedPkg) { packages = CollectionUtils.putLinked(packages, provisionedPkg.getName(), provisionedPkg); return this; }
public Builder addLayerDep(String layerName, boolean optional) { layerDeps = CollectionUtils.putLinked(layerDeps, layerName, ConfigLayerDependency.forLayer(layerName, optional)); return this; }
public ProvisioningPlan update(FeaturePackUpdatePlan fpPlan) throws ProvisioningDescriptionException { final ProducerSpec producer = fpPlan.getInstalledLocation().getProducer(); if(install.containsKey(producer) || uninstall.contains(producer)) { throw new ProvisioningDescriptionException(producer + " has already been added to the plan"); } updates = CollectionUtils.putLinked(updates, producer, fpPlan); return this; }
public ProvisioningPlan install(FeaturePackConfig fpConfig) throws ProvisioningDescriptionException { final ProducerSpec producer = fpConfig.getLocation().getProducer(); if(uninstall.contains(producer) || updates.containsKey(producer)) { throw new ProvisioningDescriptionException(producer + " has already been added to the plan"); } install = CollectionUtils.putLinked(install, producer, fpConfig); return this; }
@SuppressWarnings("unchecked") public T addPackageDep(PackageDependencySpec dep) { localPkgDeps = CollectionUtils.putLinked(localPkgDeps, dep.getName(), dep); if(!dep.isOptional()) { ++requiredDeps; } return (T) this; }
public Builder addFeaturePack(ProvisionedFeaturePack fp) { featurePacks = CollectionUtils.putLinked(featurePacks, fp.getFPID().getProducer(), fp); return this; }
@SuppressWarnings("unchecked") public B addConfig(ConfigModel config) throws ProvisioningDescriptionException { final ConfigId id = config.getId(); if(id.isAnonymous()) { throw new ProvisioningDescriptionException("Anonymous configs are not supported in " + getClass().getName()); } definedConfigs = CollectionUtils.putLinked(definedConfigs, id, config); this.hasModelOnlyConfigs |= config.id.isModelOnly(); return (B) this; }
void addLayerDep(ConfigLayerDependency layerDep) { if(layerDeps == null) { layerDeps = Collections.singletonMap(layerDep.getName(), layerDep); } else { final ConfigLayerDependency existing = layerDeps.get(layerDep.getName()); if(existing == null || existing.isOptional() && !layerDep.isOptional()) { layerDeps = CollectionUtils.putLinked(layerDeps, layerDep.getName(), layerDep); } } }
public FeatureConfig addFeatureDep(FeatureDependencySpec dep) throws ProvisioningDescriptionException { if(deps.containsKey(dep.getFeatureId())) { throw new ProvisioningDescriptionException("Duplicate dependency on " + dep.getFeatureId()); } deps = CollectionUtils.putLinked(deps, dep.getFeatureId(), dep); return this; }
public Builder addFeatureDep(FeatureDependencySpec dep) throws ProvisioningDescriptionException { if(featureDeps.containsKey(dep.getFeatureId())) { throw new ProvisioningDescriptionException("Duplicate dependency on " + dep.getFeatureId() + " from feature spec " + name); } featureDeps = CollectionUtils.putLinked(featureDeps, dep.getFeatureId(), dep); return this; }
protected FeatureGroupBuilderSupport(FeatureGroupSupport fg) { super(fg); this.name = fg.name; this.origin = fg.origin; this.inheritFeatures = fg.inheritFeatures; this.includedSpecs = CollectionUtils.clone(fg.includedSpecs); this.includedFeatures = CollectionUtils.clone(fg.includedFeatures); this.excludedSpecs = CollectionUtils.clone(fg.excludedSpecs); this.excludedFeatures = CollectionUtils.clone(fg.excludedFeatures); if(!fg.externalFgConfigs.isEmpty()) { for(Map.Entry<String, FeatureGroup> entry : fg.externalFgConfigs.entrySet()) { externalFgConfigs = CollectionUtils.putLinked(externalFgConfigs, entry.getKey(), FeatureGroup.builder(entry.getValue())); } } this.items = CollectionUtils.clone(fg.items); }
@SuppressWarnings("unchecked") public B includeFeature(FeatureId featureId, FeatureConfig feature) throws ProvisioningDescriptionException { if(feature != null && feature.getOrigin() != null) { final String origin = feature.getOrigin(); feature.setOrigin(null); getExternalFgConfig(origin).includeFeature(featureId, feature); return (B) this; } if(excludedFeatures.containsKey(featureId)) { throw new ProvisioningDescriptionException(featureId + " has been explicitly excluded"); } if(feature == null) { feature = new FeatureConfig(featureId.getSpec()); } else if(feature.specId == null) { feature.specId = featureId.getSpec(); } for (Map.Entry<String, String> idEntry : featureId.getParams().entrySet()) { final String prevValue = feature.putParam(idEntry.getKey(), idEntry.getValue()); if (prevValue != null && !prevValue.equals(idEntry.getValue())) { throw new ProvisioningDescriptionException("Parameter " + idEntry.getKey() + " has value '" + idEntry.getValue() + "' in feature ID and value '" + prevValue + "' in the feature body"); } } includedFeatures = CollectionUtils.putLinked(includedFeatures, featureId, feature); return (B) this; }
@Override public void addChild(FormatContentHandler childHandler) throws FormatParsingException { if(!childHandler.getFormat().getName().equals(KeyValueParsingFormat.NAME)) { throw new FormatParsingException(FormatErrors.unexpectedChildFormat(format, childHandler.getFormat())); } final KeyValueContentHandler entry = (KeyValueContentHandler) childHandler; final MapParsingFormat objectFormat = (MapParsingFormat)format; if(objectFormat.isAcceptsKey(entry.key)) { map = CollectionUtils.putLinked(map, entry.key, entry.value); } else { throw new FormatParsingException(FormatErrors.unexpectedCompositeFormatElement(format, entry.key)); } }
public void addConfig(ProvisionedFeatureDiffCallback featureDiffCallback, ProvisionedConfig config, String... relativePaths) throws ProvisioningException { if(featureDiff == null) { featureDiff = new FeatureDiff(log); } featureDiff.reset(); featureDiff.model = config.getModel(); featureDiff.name = config.getName(); featureDiff.diff(featureDiffCallback, config); final ConfigModel mergedConfig = featureDiff.getMergedConfig(layout); if (mergedConfig == null) { log.verbose("%s is meaningless", config.getName()); } else { addedConfigs = CollectionUtils.putLinked(addedConfigs, new ConfigId(config.getModel(), config.getName()), mergedConfig); } featureDiff.reset(); suppressPaths(relativePaths); }