use of org.jboss.galleon.universe.FeaturePackLocation.FPID in project galleon by wildfly.
the class FeaturePackXmlParser20 method parsePatchFor.
private void parsePatchFor(final XMLExtendedStreamReader reader, FeaturePackSpec.Builder builder) throws XMLStreamException {
final int count = reader.getAttributeCount();
FPID patchFor = null;
for (int i = 0; i < count; i++) {
final Attribute attribute = Attribute.of(reader.getAttributeName(i).getLocalPart());
switch(attribute) {
case FOR:
final FeaturePackLocation location;
try {
location = FeaturePackLocation.fromString(reader.getAttributeValue(i));
} catch (IllegalArgumentException e) {
throw new XMLStreamException("Failed to parse patch for FPID '" + reader.getAttributeValue(i) + "'", e);
}
patchFor = ProvisioningXmlParser30.resolveUniverse(builder, location).getFPID();
break;
default:
throw ParsingUtils.unexpectedContent(reader);
}
}
if (patchFor == null) {
throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.FOR));
}
ParsingUtils.parseNoContent(reader);
if (patchFor.getBuild() == null) {
throw new XMLStreamException("Build number is missing for the version the patch is applied to: " + patchFor);
}
builder.setPatchFor(patchFor);
}
use of org.jboss.galleon.universe.FeaturePackLocation.FPID in project galleon by wildfly.
the class Errors method featurePackVersionConflict.
static String featurePackVersionConflict(Collection<FeaturePackLocation.FPID> fpids) {
final Iterator<FeaturePackLocation.FPID> i = fpids.iterator();
FeaturePackLocation.FPID fpid = i.next();
final StringBuilder buf = new StringBuilder("Please pick the desired channel and/or build for ").append(fpid.getProducer()).append(" explicitly in the provisioning config. Current configuration includes ").append(fpid);
while (i.hasNext()) {
fpid = i.next();
buf.append(", ").append(fpid);
}
return buf.toString();
}
use of org.jboss.galleon.universe.FeaturePackLocation.FPID in project galleon by wildfly.
the class Errors method fpVersionCheckFailed.
static String fpVersionCheckFailed(Collection<Set<FPID>> versionConflicts) throws ProvisioningException {
final StringWriter strWriter = new StringWriter();
try (BufferedWriter writer = new BufferedWriter(strWriter)) {
writer.write("Feature-pack versions check failed with the following errors:");
writer.newLine();
if (!versionConflicts.isEmpty()) {
for (Collection<FPID> entry : versionConflicts) {
writer.write(" * ");
writer.write(Errors.featurePackVersionConflict(entry));
writer.write(';');
writer.newLine();
}
}
} catch (IOException e) {
throw new ProvisioningException("Failed to report version check errors", e);
}
return strWriter.toString();
}
Aggregations