Search in sources :

Example 66 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class UniverseManager method visit.

private static void visit(UniverseVisitor visitor, Universe<?> universe, UniverseSpec universeSpec, boolean allBuilds) throws ProvisioningException {
    for (Producer<?> producer : universe.getProducers()) {
        for (Channel channel : producer.getChannels()) {
            if (allBuilds) {
                List<String> builds = getAllBuilds(universeSpec, producer, channel);
                if (builds != null && !builds.isEmpty()) {
                    for (String build : builds) {
                        visitor.visit(producer, new FeaturePackLocation(universeSpec, producer.getName(), channel.getName(), null, build));
                    }
                }
            }
            for (String freq : producer.getFrequencies()) {
                String build = getBuild(universeSpec, producer, channel, freq);
                // We have a latest build for the frequency.
                if (build != null) {
                    FeaturePackLocation loc = new FeaturePackLocation(universeSpec, producer.getName(), channel.getName(), freq, build);
                    visitor.visit(producer, loc);
                }
            }
        }
    }
}
Also used : Channel(org.jboss.galleon.universe.Channel) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 67 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class BasicTransitiveDepCustomizationTestCase method createFeaturePacks.

@Override
protected void createFeaturePacks(FeaturePackCreator creator) throws ProvisioningException {
    fp1Fpl = newFpl("producer1", "1", "1.0.0.Final");
    fp2Fpl = newFpl("producer2", "1", "1.0.0.Final");
    fp3fpl = newFpl("producer3", "1", "1.0.0.Final");
    creator.newFeaturePack().setFPID(fp1Fpl.getFPID()).addDependency(fp2Fpl).addDependency(FeaturePackConfig.transitiveBuilder(new FeaturePackLocation(fp3fpl.getUniverse(), fp3fpl.getProducerName(), null, null, null)).excludePackage("p2").includePackage("p3").build()).addFeatureSpec(FeatureSpec.builder("specA").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specA").setParam("p1", "1")).build()).newPackage("p1", true).writeContent("fp1/p1.txt", "fp1");
    creator.newFeaturePack().setFPID(fp2Fpl.getFPID()).addDependency(FeaturePackConfig.builder(fp3fpl).excludePackage("p4").build()).addFeatureSpec(FeatureSpec.builder("specB").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specB").setParam("p1", "1")).build()).newPackage("p1", true).writeContent("fp2/p1.txt", "fp2");
    creator.newFeaturePack().setFPID(fp3fpl.getFPID()).addFeatureSpec(FeatureSpec.builder("specC").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder("model1", "name1").addFeature(new FeatureConfig("specC").setParam("p1", "1")).build()).newPackage("p1", true).addDependency("p2", true).addDependency("p4", true).writeContent("fp3/p1.txt", "fp3 100 p1").getFeaturePack().newPackage("p2").writeContent("fp3/p2.txt", "fp3 100 p2").getFeaturePack().newPackage("p3").writeContent("fp3/p3.txt", "fp3 100 p3").getFeaturePack().newPackage("p4").writeContent("fp3/p4.txt", "fp3 100 p4");
}
Also used : FeatureConfig(org.jboss.galleon.config.FeatureConfig) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 68 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class StateInfoUtil method buildDependencies.

private static String buildDependencies(PmCommandInvocation invoc, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException {
    Map<FPID, FeaturePackConfig> configs = new HashMap<>();
    List<FeaturePackLocation> dependencies = new ArrayList<>();
    for (FeaturePackLayout fpLayout : layout.getOrderedFeaturePacks()) {
        boolean isProduct = true;
        for (FeaturePackLayout fpLayout2 : layout.getOrderedFeaturePacks()) {
            if (fpLayout2.getSpec().hasTransitiveDep(fpLayout.getFPID().getProducer()) || fpLayout2.getSpec().getFeaturePackDep(fpLayout.getFPID().getProducer()) != null) {
                isProduct = false;
                break;
            }
        }
        if (!isProduct) {
            FeaturePackLocation loc = invoc.getPmSession().getExposedLocation(null, fpLayout.getFPID().getLocation());
            dependencies.add(loc);
            FeaturePackConfig transitiveConfig = layout.getConfig().getTransitiveDep(fpLayout.getFPID().getProducer());
            configs.put(loc.getFPID(), transitiveConfig);
        }
    }
    return buildDependencies(dependencies, configs);
}
Also used : FeaturePackLayout(org.jboss.galleon.layout.FeaturePackLayout) FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) FeaturePackConfig(org.jboss.galleon.config.FeaturePackConfig)

Example 69 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class StateInfoUtil method buildPatches.

public static String buildPatches(PmCommandInvocation invoc, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException {
    if (!layout.hasPatches()) {
        return null;
    }
    Table table = new Table(Headers.PATCH, Headers.PATCH_FOR, Headers.UPDATE_CHANNEL);
    for (FeaturePackLayout fpLayout : layout.getOrderedFeaturePacks()) {
        List<FeaturePackLayout> patches = layout.getPatches(fpLayout.getFPID());
        for (FeaturePackLayout patch : patches) {
            FeaturePackLocation loc = invoc.getPmSession().getExposedLocation(null, patch.getFPID().getLocation());
            FPID patchFor = patch.getSpec().getPatchFor();
            table.addLine(patch.getFPID().getBuild(), patchFor.getProducer().getName() + FeaturePackLocation.BUILD_START + patchFor.getBuild(), formatChannel(loc));
        }
    }
    if (!table.isEmpty()) {
        table.sort(Table.SortType.ASCENDANT);
        return table.build();
    }
    return null;
}
Also used : Table(org.jboss.galleon.cli.cmd.Table) FeaturePackLayout(org.jboss.galleon.layout.FeaturePackLayout) FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 70 with FeaturePackLocation

use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.

the class AbstractPluginsCommand method runCommand.

@Override
protected void runCommand(PmCommandInvocation session, Map<String, String> options) throws CommandExecutionException {
    if (isVerbose()) {
        session.getPmSession().enableMavenTrace(true);
    }
    try {
        final String id = getId(pmSession);
        final FeaturePackLocation loc = id == null ? null : pmSession.getResolvedLocation(getInstallationDirectory(session.getConfiguration().getAeshContext()), id);
        runCommand(session, options, loc);
    } catch (ProvisioningException ex) {
        throw new CommandExecutionException(session.getPmSession(), CliErrors.resolveLocationFailed(), ex);
    } finally {
        session.getPmSession().enableMavenTrace(false);
    }
}
Also used : ProvisioningException(org.jboss.galleon.ProvisioningException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) CommandExecutionException(org.jboss.galleon.cli.CommandExecutionException)

Aggregations

FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)111 Test (org.junit.Test)46 Path (java.nio.file.Path)23 ProvisioningException (org.jboss.galleon.ProvisioningException)18 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)18 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)16 ArrayList (java.util.ArrayList)13 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)13 FeaturePackCreator (org.jboss.galleon.creator.FeaturePackCreator)12 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)9 XMLStreamException (javax.xml.stream.XMLStreamException)8 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)8 IOException (java.io.IOException)7 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)7 HashMap (java.util.HashMap)6 CommandException (org.aesh.command.CommandException)6 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)6 FeatureConfig (org.jboss.galleon.config.FeatureConfig)6 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)6 Set (java.util.Set)5