use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class InstalledProducerCompleter method getItems.
@Override
protected List<String> getItems(PmCompleterInvocation completerInvocation) {
CommandWithInstallationDirectory cmd = (CommandWithInstallationDirectory) completerInvocation.getCommand();
Path installation = cmd.getInstallationDirectory(completerInvocation.getAeshContext());
List<FeaturePackLocation> locations = getInstallationLocations(installation, completerInvocation.getPmSession(), true, false);
List<String> items = new ArrayList<>();
String trimed = completerInvocation.getGivenCompleteValue().trim();
List<String> lst = trimed.isEmpty() ? Collections.emptyList() : Arrays.asList(completerInvocation.getGivenCompleteValue().split(",+"));
boolean ended = trimed.endsWith(",");
int lastIndex = ended ? lst.size() : Math.max(0, lst.size() - 1);
List<FeaturePackLocation> specified = new ArrayList<>();
try {
// List of specified locations.
for (String s : lst) {
specified.add(completerInvocation.getPmSession().getResolvedLocation(installation, s));
}
for (FeaturePackLocation loc : locations) {
boolean found = false;
for (int i = 0; i < lastIndex; i++) {
FeaturePackLocation s = specified.get(i);
if (s.getProducer().equals(loc.getProducer())) {
found = true;
break;
}
}
if (!found) {
items.add(completerInvocation.getPmSession().getExposedLocation(installation, loc).getProducer().toString());
}
}
} catch (Exception ex) {
CliLogging.completionException(ex);
return Collections.emptyList();
}
return items;
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateTestCase method installWithDependency.
public static void installWithDependency(String version) throws ProvisioningException {
FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, PRODUCER3, "1", null, version);
creator.newFeaturePack(fp1.getFPID()).addFeatureSpec(FeatureSpec.builder("specA").addPackageDep("p1", true).addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder().setModel("model1").setName("name1").addFeature(new FeatureConfig("specA").setParam("p1", "1")).build(), true).newPackage("p1", false).writeContent("fp1/p1.txt", "fp1 p1").getFeaturePack().newPackage("p2", true).writeContent("fp2/p2.txt", "fp1 p2");
FeaturePackLocation fp2 = new FeaturePackLocation(universeSpec, PRODUCER4, "1", null, version);
FeaturePackConfig dep = FeaturePackConfig.builder(fp1).setInheritConfigs(false).setInheritPackages(false).build();
creator.newFeaturePack(fp2.getFPID()).addDependency(dep).addFeatureSpec(FeatureSpec.builder("specB").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder().setModel("model1").setName("name1").addFeature(new FeatureConfig("specB").setParam("p1", "1")).addFeature(new FeatureConfig("specA").setParam("p1", "1")).build(), true);
creator.install();
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateTestCase method installLayers.
public static void installLayers(String version) throws ProvisioningException {
FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, PRODUCER2, "1", null, version);
creator.newFeaturePack(fp1.getFPID()).addFeatureSpec(FeatureSpec.builder(PRODUCER2 + "-FeatureA").addParam(FeatureParameterSpec.createId("id")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("base").addFeature(new FeatureConfig(PRODUCER2 + "-FeatureA").setParam("id", "base")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layer1").addLayerDep("base").addFeature(new FeatureConfig(PRODUCER2 + "-FeatureA").setParam("id", "layer1")).build()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("layer2").addFeature(new FeatureConfig(PRODUCER2 + "-FeatureA").setParam("id", "layer2")).build()).newPackage("p1", true).writeContent("fp1/p1.txt", "fp1 p1").getFeaturePack().addConfig(ConfigModel.builder().setModel("testmodel").setName("testmodel1").includeLayer("layer1").build());
creator.install();
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateTestCase method installNoFeatures.
public static void installNoFeatures(String version) throws ProvisioningException {
FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, PRODUCER5, "1", null, version);
creator.newFeaturePack(fp1.getFPID()).addConfigLayer(ConfigLayerSpec.builder().setModel("testmodel").setName("base-" + PRODUCER5).addPackageDep("p1").build()).newPackage("p1", true).writeContent("fp1/p1.txt", "fp1 p1").getFeaturePack().addConfig(ConfigModel.builder().setModel("testmodel").setName("name1").includeLayer("base-" + PRODUCER5).build());
creator.install();
}
use of org.jboss.galleon.universe.FeaturePackLocation in project galleon by wildfly.
the class StateTestCase method install.
public static void install(String version) throws ProvisioningException {
FeaturePackCreator creator = FeaturePackCreator.getInstance().addArtifactResolver(cli.getSession().getMavenRepoManager());
FeaturePackLocation fp1 = new FeaturePackLocation(universeSpec, PRODUCER1, "1", null, version);
creator.newFeaturePack(fp1.getFPID()).newPackage("p1", true).writeContent("fp1/p1.txt", "fp1 p1").getFeaturePack().addFeatureSpec(FeatureSpec.builder("specA").addParam(FeatureParameterSpec.createId("p1")).build()).addConfig(ConfigModel.builder().setModel("model1").setName("name1").addFeature(new FeatureConfig("specA").setParam("p1", "1")).build());
creator.install();
}
Aggregations