Search in sources :

Example 11 with FeaturePackLayout

use of org.jboss.galleon.layout.FeaturePackLayout in project galleon by wildfly.

the class UninstallCommand method getDynamicOptions.

@Override
protected List<DynamicOption> getDynamicOptions(State state) throws Exception {
    String fpid = getFPID();
    Path dir = getAbsolutePath(getUninstallDir(), pmSession.getAeshContext());
    // Build layout from this directory.
    ProvisioningConfig config = ProvisioningXmlParser.parse(PathsUtils.getProvisioningXml(dir));
    if (config != null) {
        // Silent resolution.
        pmSession.unregisterTrackers();
        try {
            try (ProvisioningLayout<FeaturePackLayout> layout = pmSession.getLayoutFactory().newConfigLayout(config)) {
                layout.uninstall(pmSession.getResolvedLocation(getInstallationDirectory(pmSession.getAeshContext()), fpid).getFPID());
                Set<ProvisioningOption> opts = PluginResolver.newResolver(pmSession, layout).resolve().getInstall();
                List<DynamicOption> options = new ArrayList<>();
                for (ProvisioningOption opt : opts) {
                    DynamicOption dynOption = new DynamicOption(opt.getName(), opt.isRequired());
                    options.add(dynOption);
                }
                return options;
            }
        } finally {
            pmSession.registerTrackers();
        }
    } else {
        return Collections.emptyList();
    }
}
Also used : Path(java.nio.file.Path) ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) FeaturePackLayout(org.jboss.galleon.layout.FeaturePackLayout) ProvisioningOption(org.jboss.galleon.ProvisioningOption) ArrayList(java.util.ArrayList)

Example 12 with FeaturePackLayout

use of org.jboss.galleon.layout.FeaturePackLayout in project galleon by wildfly.

the class BasicPatchLayoutTestCase method assertLayout.

@Override
protected void assertLayout(ProvisioningLayout<FeaturePackLayout> layout) throws Exception {
    final List<FeaturePackLayout> featurePacks = layout.getOrderedFeaturePacks();
    assertEquals(3, featurePacks.size());
    FeaturePackLayout fp = featurePacks.get(0);
    assertEquals(fp1.getFPID(), fp.getFPID());
    assertTrue(fp.isTransitiveDep());
    fp = featurePacks.get(1);
    assertEquals(fp2.getFPID(), fp.getFPID());
    assertTrue(fp.isDirectDep());
    fp = featurePacks.get(2);
    assertEquals(fp3.getFPID(), fp.getFPID());
    assertTrue(fp.isDirectDep());
    List<FeaturePackLayout> patches = layout.getPatches(fp1.getFPID());
    assertEquals(2, patches.size());
    fp = patches.get(0);
    assertEquals(fp1Patch1.getFPID(), fp.getFPID());
    assertTrue(fp.isPatch());
    fp = patches.get(1);
    assertEquals(fp1Patch2.getFPID(), fp.getFPID());
    assertTrue(fp.isPatch());
    patches = layout.getPatches(fp2.getFPID());
    assertEquals(2, patches.size());
    assertEquals(fp2Patch1.getFPID(), patches.get(0).getFPID());
    assertEquals(fp2Patch2.getFPID(), patches.get(1).getFPID());
    patches = layout.getPatches(fp3.getFPID());
    assertEquals(0, patches.size());
}
Also used : FeaturePackLayout(org.jboss.galleon.layout.FeaturePackLayout)

Aggregations

FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)12 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)6 ArrayList (java.util.ArrayList)5 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)5 IOException (java.io.IOException)4 ProvisioningException (org.jboss.galleon.ProvisioningException)4 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)4 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)4 HashMap (java.util.HashMap)3 FeatureContainer (org.jboss.galleon.cli.model.FeatureContainer)3 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)3 Path (java.nio.file.Path)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 TreeSet (java.util.TreeSet)2 Function (java.util.function.Function)2 ProvisioningManager (org.jboss.galleon.ProvisioningManager)2 ConfigId (org.jboss.galleon.config.ConfigId)2 ProvisioningLayout (org.jboss.galleon.layout.ProvisioningLayout)2 Comparator (java.util.Comparator)1