Search in sources :

Example 21 with FPID

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);
}
Also used : FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) XMLStreamException(javax.xml.stream.XMLStreamException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 22 with FPID

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();
}
Also used : FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 23 with FPID

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();
}
Also used : StringWriter(java.io.StringWriter) FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) IOException(java.io.IOException) BufferedWriter(java.io.BufferedWriter)

Aggregations

FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)23 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)14 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)11 ArrayList (java.util.ArrayList)8 ProvisioningException (org.jboss.galleon.ProvisioningException)8 IOException (java.io.IOException)5 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)5 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)4 Table (org.jboss.galleon.cli.cmd.Table)4 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)4 FeaturePackSpec (org.jboss.galleon.spec.FeaturePackSpec)4 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)4 HashSet (java.util.HashSet)3 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)3 Cell (org.jboss.galleon.cli.cmd.Table.Cell)3 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 Set (java.util.Set)2