use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class FeatureGroupXml method readFeatureDependency.
private static void readFeatureDependency(XMLExtendedStreamReader reader, FeatureConfig config) throws XMLStreamException {
String id = null;
String origin = null;
boolean include = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final Attribute attribute = Attribute.of(reader.getAttributeName(i));
switch(attribute) {
case FEATURE_ID:
id = reader.getAttributeValue(i);
break;
case ORIGIN:
origin = reader.getAttributeValue(i);
break;
case INCLUDE:
include = Boolean.parseBoolean(reader.getAttributeValue(i));
break;
default:
throw ParsingUtils.unexpectedAttribute(reader, i);
}
}
if (id == null) {
throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.FEATURE_ID));
}
ParsingUtils.parseNoContent(reader);
try {
config.addFeatureDep(FeatureDependencySpec.create(parseFeatureId(id), origin, include));
} catch (ProvisioningDescriptionException e) {
throw new XMLStreamException(e);
}
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class FeatureSpecXmlParser10 method parseCapabilityName.
private CapabilitySpec parseCapabilityName(XMLExtendedStreamReader reader) throws XMLStreamException {
String name = null;
boolean optional = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final Attribute attribute = Attribute.of(reader.getAttributeName(i));
switch(attribute) {
case NAME:
name = reader.getAttributeValue(i);
break;
case OPTIONAL:
optional = Boolean.parseBoolean(reader.getAttributeValue(i));
break;
default:
throw ParsingUtils.unexpectedAttribute(reader, i);
}
}
if (name == null) {
throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.NAME));
}
ParsingUtils.parseNoContent(reader);
try {
return CapabilitySpec.fromString(name, optional);
} catch (ProvisioningDescriptionException e) {
throw new XMLStreamException("Failed to parse capability '" + name + "'", reader.getLocation(), e);
}
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class FeatureSpecXmlParser10 method parseDependency.
private FeatureDependencySpec parseDependency(XMLExtendedStreamReader reader) throws XMLStreamException {
String dependency = null;
boolean include = false;
String featureId = null;
for (int i = 0; i < reader.getAttributeCount(); i++) {
final Attribute attribute = Attribute.of(reader.getAttributeName(i));
switch(attribute) {
case DEPENDENCY:
dependency = reader.getAttributeValue(i);
break;
case FEATURE_ID:
featureId = reader.getAttributeValue(i);
break;
case INCLUDE:
include = Boolean.parseBoolean(reader.getAttributeValue(i));
break;
default:
throw ParsingUtils.unexpectedAttribute(reader, i);
}
}
if (featureId == null) {
throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.FEATURE_ID));
}
ParsingUtils.parseNoContent(reader);
try {
return FeatureDependencySpec.create(FeatureId.fromString(featureId), dependency, include);
} catch (ProvisioningDescriptionException e) {
throw new XMLStreamException("Failed to parse feature dependency", reader.getLocation(), e);
}
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class FeatureGroupBuilderSupport method excludeSpec.
@SuppressWarnings("unchecked")
public B excludeSpec(String spec) throws ProvisioningDescriptionException {
final SpecId specId = SpecId.fromString(spec);
if (includedSpecs.contains(specId)) {
throw new ProvisioningDescriptionException(specId + " spec has been inplicitly excluded");
}
excludedSpecs = CollectionUtils.add(excludedSpecs, specId);
return (B) this;
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class FeatureGroupBuilderSupport method includeSpec.
@SuppressWarnings("unchecked")
public B includeSpec(String spec) throws ProvisioningDescriptionException {
final SpecId specId = SpecId.fromString(spec);
if (excludedSpecs.contains(specId)) {
throw new ProvisioningDescriptionException(specId + " spec has been explicitly excluded");
}
includedSpecs = CollectionUtils.addLinked(includedSpecs, specId);
return (B) this;
}
Aggregations