public String getType() { return spec.getName(); }
public FeaturePackBuilder addFeatureSpec(FeatureSpec spec) throws ProvisioningDescriptionException { if (specs.isEmpty()) { specs = new HashMap<>(); } if (specs.put(spec.getName(), spec) != null) { throw new ProvisioningDescriptionException("Feature-pack " + fpBuilder.getFPID() + ": duplicate spec name " + spec.getName()); } return this; }
public ResolvedFeatureSpec getFeatureSpec(String name) throws ProvisioningException { if(featureSpecs != null) { final ResolvedFeatureSpec resolvedSpec = featureSpecs.get(name); if(resolvedSpec != null) { return resolvedSpec; } } final Path specXml = dir.resolve(Constants.FEATURES).resolve(name).resolve(Constants.SPEC_XML); if (!Files.exists(specXml)) { return null; } try (BufferedReader reader = Files.newBufferedReader(specXml)) { final FeatureSpec xmlSpec = FeatureSpecXmlParser.getInstance().parse(reader); if(!xmlSpec.getName().equals(name)) { throw new ProvisioningDescriptionException("Feature-pack " + getFPID() + " feature spec " + xmlSpec.getName() + " does not match the requested feature spec name " + name); } final ResolvedFeatureSpec resolvedSpec = new ResolvedFeatureSpec(new ResolvedSpecId(producer, xmlSpec.getName()), featureParamTypeProvider, xmlSpec); if (featureSpecs == null) { featureSpecs = new HashMap<>(); } featureSpecs.put(name, resolvedSpec); return resolvedSpec; } catch (Exception e) { throw new ProvisioningDescriptionException(Errors.parseXml(specXml), e); } }
featId = new FeatureId(spec.getSpec().getName(), ids); FeatureConfig fc = FeatureConfig.newConfig(featId);
final FeatureSpecXmlWriter specWriter = FeatureSpecXmlWriter.getInstance(); for(FeatureSpec spec : specs.values()) { final Path featureDir = featuresDir.resolve(spec.getName()); ensureDir(featureDir); specWriter.write(spec, featureDir.resolve(Constants.SPEC_XML));
final ProvisionedFeature actual = feature[1]; final FeatureSpec fSpec = layout.getFeaturePack(actual.getSpecId().getProducer()).getFeatureSpec(actual.getSpecId().getName()).getSpec(); final FeatureConfig config = new FeatureConfig(fSpec.getName()); config.setOrigin(provisionedConfig.originOf(actual.getSpecId().getProducer()));
protected ElementNode toElement(FeatureSpec featureSpec) { addAttribute(specE, Attribute.NAME, featureSpec.getName());