private ProvisioningConfig(Builder builder) throws ProvisioningDescriptionException { super(builder); this.options = CollectionUtils.unmodifiable(builder.options); this.builder = builder; }
protected FeaturePackDepsConfig(FeaturePackDepsConfigBuilder<?> builder) throws ProvisioningDescriptionException { super(builder); this.fpDeps = CollectionUtils.unmodifiable(builder.fpDeps); this.fpDepsByOrigin = CollectionUtils.unmodifiable(builder.fpDepsByOrigin); this.producerOrigins = builder.producerOrigins; this.transitiveDeps = CollectionUtils.unmodifiable(builder.transitiveDeps); this.defaultUniverse = builder.defaultUniverse; this.universeSpecs = CollectionUtils.unmodifiable(builder.universeSpecs); }
private FeatureSpec(Builder builder) { super(builder); this.name = builder.name; this.annotations = CollectionUtils.unmodifiable(builder.annotations); this.featureDeps = CollectionUtils.unmodifiable(builder.featureDeps); this.featureRefs = CollectionUtils.unmodifiable(builder.refs); this.params = CollectionUtils.unmodifiable(builder.params); this.idParams = CollectionUtils.unmodifiable(builder.idParams); this.providedCaps = CollectionUtils.unmodifiable(builder.providedCaps); this.requiredCaps = CollectionUtils.unmodifiable(builder.requiredCaps); }
public ProvisionedConfig build() { props = CollectionUtils.unmodifiable(props); layers = CollectionUtils.unmodifiable(layers); features = CollectionUtils.unmodifiable(features); return this; }
protected FeaturePackSpec(Builder builder) throws ProvisioningDescriptionException { super(builder); this.fpid = builder.fpid; this.defPackages = CollectionUtils.unmodifiable(builder.defPackages); this.patchFor = builder.patchFor; }
public FeaturePackUpdatePlan buildPlan() { newPatches = CollectionUtils.unmodifiable(newPatches); return FeaturePackUpdatePlan.this; } }
protected ConfigCustomizations(ConfigCustomizationsBuilder<?> builder) { this.inheritConfigs = builder.inheritConfigs; this.inheritModelOnlyConfigs = builder.inheritModelOnlyConfigs; this.includedModels = CollectionUtils.unmodifiable(builder.includedModels); this.excludedModels = CollectionUtils.unmodifiable(builder.excludedModels); this.includedConfigs = CollectionUtils.unmodifiable(builder.includedConfigs); this.excludedConfigs = CollectionUtils.unmodifiable(builder.excludedConfigs); this.definedConfigs = CollectionUtils.unmodifiable(builder.definedConfigs); this.hasModelOnlyConfigs = builder.hasModelOnlyConfigs; }
ProvisionedState(Builder builder) { this.featurePacks = CollectionUtils.unmodifiable(builder.featurePacks); this.configs = CollectionUtils.unmodifiable(builder.configs); }
protected ConfigModel(Builder builder) throws ProvisioningDescriptionException { super(builder); this.id = new ConfigId(builder.model, builder.name); this.props = CollectionUtils.unmodifiable(builder.props); this.configDeps = CollectionUtils.unmodifiable(builder.configDeps); this.inheritLayers = builder.inheritLayers; this.includedLayers = CollectionUtils.unmodifiable(builder.includedLayers); this.excludedLayers = CollectionUtils.unmodifiable(builder.excludedLayers); this.builder = builder; }
private ResolvedConfig(ConfigModelStack configStack) throws ProvisioningException { this.id = configStack.id; this.props = CollectionUtils.unmodifiable(configStack.props); this.configDeps = CollectionUtils.unmodifiable(configStack.configDeps); this.features = CollectionUtils.unmodifiable(configStack.orderFeatures(true)); layers = Collections.unmodifiableList(configStack.getIncludedLayers()); }
private FeatureReferenceSpec(String origin, String name, String featureSpec, boolean nillable, boolean include, Map<String, String> paramMapping) throws ProvisioningDescriptionException { this.origin = origin; this.name = name; this.feature = SpecId.fromString(featureSpec); this.nillable = nillable; this.include = include; this.mappedParams = CollectionUtils.unmodifiable(paramMapping); }
public ProvisionedFeaturePack build() { return new ProvisionedFeaturePack(fpid, CollectionUtils.unmodifiable(packages)); } }
protected FeatureGroupSupport(FeatureGroupBuilderSupport<?> builder) throws ProvisioningDescriptionException { super(builder); this.origin = builder.origin; this.name = builder.name; this.inheritFeatures = builder.inheritFeatures; this.includedSpecs = CollectionUtils.unmodifiable(builder.includedSpecs); this.excludedSpecs = CollectionUtils.unmodifiable(builder.excludedSpecs); this.includedFeatures = CollectionUtils.unmodifiable(builder.includedFeatures); this.excludedFeatures = CollectionUtils.unmodifiable(builder.excludedFeatures); if(builder.externalFgConfigs.isEmpty()) { this.externalFgConfigs = Collections.emptyMap(); } else if(builder.externalFgConfigs.size() == 1) { final Map.Entry<String, FeatureGroup.Builder> entry = builder.externalFgConfigs.entrySet().iterator().next(); this.externalFgConfigs = Collections.singletonMap(entry.getKey(), entry.getValue().build()); } else { final Map<String, FeatureGroup> tmp = new LinkedHashMap<>(builder.externalFgConfigs.size()); for(Map.Entry<String, FeatureGroup.Builder> entry : builder.externalFgConfigs.entrySet()) { tmp.put(entry.getKey(), entry.getValue().build()); } this.externalFgConfigs = Collections.unmodifiableMap(tmp); } this.items = CollectionUtils.unmodifiable(builder.items); }
protected Map<String, List<PackageDependencySpec>> buildExternalPackageDeps() { if(externalPkgDeps.isEmpty()) { return Collections.emptyMap(); } if(externalPkgDeps.size() == 1) { final Map.Entry<String, Map<String, PackageDependencySpec>> first = externalPkgDeps.entrySet().iterator().next(); return Collections.singletonMap(first.getKey(), getValueList(first.getValue())); } final Map<String, List<PackageDependencySpec>> tmp = new HashMap<>(externalPkgDeps.size()); for (Map.Entry<String, Map<String, PackageDependencySpec>> externalEntry : externalPkgDeps.entrySet()) { tmp.put(externalEntry.getKey(), getValueList(externalEntry.getValue())); } return CollectionUtils.unmodifiable(tmp); }
public FeatureId(String specName, Map<String, String> params) throws ProvisioningDescriptionException { if(params.isEmpty()) { throw new ProvisioningDescriptionException("ID paramaters are missing"); } this.specId = SpecId.fromString(specName); this.params = CollectionUtils.unmodifiable(params); }
protected ProvisioningOption(Builder builder) { this.name = builder.name; this.required = builder.required; this.persistent = builder.persistent; this.defaultValue = builder.defaultValue; if(builder.valueSet.isEmpty()) { if(defaultValue == null || getBooleanValueSet().contains(defaultValue)) { this.valueSet = getBooleanValueSet(); } else { valueSet = Collections.emptySet(); } } else { if(defaultValue != null && !builder.valueSet.contains(defaultValue)) { throw new IllegalArgumentException("The default value " + defaultValue + " of provisioning option " + name + " is not in the allowed value set " + builder.valueSet); } this.valueSet = CollectionUtils.unmodifiable(builder.valueSet); } }
ResolvedFeatureId(ResolvedSpecId specId, Map<String, Object> params, Boolean child) { this.specId = specId; Map<String, Object> filtered = Collections.emptyMap(); // TODO for(Map.Entry<String, Object> entry : params.entrySet()) { if(!Constants.GLN_UNDEFINED.equals(entry.getValue())) { filtered = CollectionUtils.put(filtered, entry.getKey(), entry.getValue()); } } if(filtered.isEmpty()) { filtered = params; } this.params = CollectionUtils.unmodifiable(filtered); this.child = child; final int prime = 31; int hash = 1; hash = prime * hash + this.params.hashCode(); hash = prime * hash + this.specId.hashCode(); this.hash = hash; }
protected ConfigLayerSpec(Builder builder) throws ProvisioningDescriptionException { super(builder); this.id = new ConfigId(builder.model, builder.getName()); layerDeps = CollectionUtils.unmodifiable(builder.layerDeps); }
static Map<String, UniverseFeaturePackInstaller> load() throws ProvisioningException { final ServiceLoader<UniverseFeaturePackInstaller> loader = ServiceLoader.load(UniverseFeaturePackInstaller.class); Map<String, UniverseFeaturePackInstaller> universeInstallers = Collections.emptyMap(); for(UniverseFeaturePackInstaller uCreator : loader) { if(universeInstallers.isEmpty()) { universeInstallers = Collections.singletonMap(uCreator.getUniverseFactoryId(), uCreator); continue; } if(universeInstallers.containsKey(uCreator.getUniverseFactoryId())) { throw new IllegalStateException("Only one universe feature-pack installer is allowed per repository type " + uCreator.getUniverseFactoryId() + " but found " + uCreator + " and " + universeInstallers.get(uCreator.getUniverseFactoryId())); } if(universeInstallers.size() == 1) { final HashMap<String, UniverseFeaturePackInstaller> tmp = new HashMap<>(2); tmp.putAll(universeInstallers); universeInstallers = tmp; } universeInstallers.put(uCreator.getUniverseFactoryId(), uCreator); } return CollectionUtils.unmodifiable(universeInstallers); }
private UniverseFactoryLoader() { final ServiceLoader<UniverseFactory> loader = ServiceLoader.load(UniverseFactory.class); Map<String, UniverseFactory> factories = Collections.emptyMap(); for(UniverseFactory factory : loader) { if(factories.isEmpty()) { factories = Collections.singletonMap(factory.getFactoryId(), factory); continue; } if(factories.containsKey(factory.getFactoryId())) { throw new IllegalStateException("Only one universe factory is allowed per repository type " + factory.getFactoryId() + " but found " + factory + " and " + factories.get(factory.getFactoryId())); } if(factories.size() == 1) { final HashMap<String, UniverseFactory> tmp = new HashMap<>(2); tmp.putAll(factories); factories = tmp; } factories.put(factory.getFactoryId(), factory); } this.factories = CollectionUtils.unmodifiable(factories); }