use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class AbstractFPProvisionedCommand method runCommand.
@Override
protected void runCommand(PmCommandInvocation invoc, State session) throws IOException, ProvisioningException, CommandExecutionException {
FeaturePackConfig cf = getProvisionedFP(invoc.getPmSession());
runCommand(invoc, session, cf);
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class AbstractFPProvisionedDependentCompleter method getItems.
@Override
protected List<String> getItems(PmCompleterInvocation completerInvocation) {
try {
AbstractFPProvisionedCommand cmd = (AbstractFPProvisionedCommand) completerInvocation.getCommand();
FeaturePackConfig fp = cmd.getProvisionedFP(completerInvocation.getPmSession());
if (fp == null) {
return Collections.emptyList();
}
return getItems(completerInvocation, fp);
} catch (Exception ex) {
CliLogging.completionException(ex);
return Collections.emptyList();
}
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class AbstractProvisionedPackageCommand method getPackage.
protected String getPackage(PmSession session) throws CommandExecutionException {
FeaturePackConfig cf = getProvisionedFP(session);
Set<String> ids = getTargetedPackages(cf);
if (ids.contains(pkg)) {
return pkg;
}
return null;
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class AbstractPackageCommand method getProvisionedFP.
@Override
public FeaturePackConfig getProvisionedFP(PmSession session) throws CommandExecutionException {
FeaturePackConfig config = super.getProvisionedFP(session);
if (config == null) {
// Problem, the package is not directly part of the added FP. Must retrieve it in the packages of
// its internal dependencies.
int i = getPackage().indexOf("/");
String orig = getPackage().substring(0, i);
String name = getPackage().substring(i + 1);
FeaturePackLocation.FPID fpid = null;
FeatureContainer container = session.getContainer().getFullDependencies().get(orig);
if (container != null) {
if (container.getAllPackages().containsKey(Identity.fromString(orig, name))) {
fpid = container.getFPID();
}
}
if (fpid == null) {
throw new CommandExecutionException("No package found for " + getPackage());
}
for (FeaturePackConfig c : session.getState().getConfig().getFeaturePackDeps()) {
if (c.getLocation().getFPID().equals(fpid)) {
config = c;
break;
}
}
if (config == null) {
// reset buildID
FeaturePackLocation noBuildLocation = new FeaturePackLocation(fpid.getUniverse(), fpid.getProducer().getName(), null, null, null);
for (FeaturePackConfig c : session.getState().getConfig().getTransitiveDeps()) {
if (c.getLocation().equals(c.getLocation().hasBuild() ? fpid.getLocation() : noBuildLocation)) {
config = c;
break;
}
}
}
}
return config;
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class FeaturePackXmlWriter method toElement.
protected ElementNode toElement(FeaturePackSpec fpSpec) {
final ElementNode fp = addElement(null, Element.FEATURE_PACK);
addAttribute(fp, Attribute.LOCATION, fpSpec.getFPID().toString());
ProvisioningXmlWriter.writeUniverseSpecs(fpSpec, fp);
if (fpSpec.isPatch()) {
final ElementNode patchFor = addElement(fp, Element.PATCH);
addAttribute(patchFor, Attribute.FOR, fpSpec.getPatchFor().toString());
}
if (fpSpec.hasTransitiveDeps()) {
final ElementNode transitives = addElement(fp, Element.TRANSITIVE);
for (FeaturePackConfig dep : fpSpec.getTransitiveDeps()) {
final ElementNode depElement = addElement(transitives, Element.DEPENDENCY);
ProvisioningXmlWriter.writeFeaturePackConfig(depElement, fpSpec.getUserConfiguredLocation(dep.getLocation()), dep, fpSpec.originOf(dep.getLocation().getProducer()));
}
}
if (fpSpec.hasFeaturePackDeps()) {
final ElementNode deps = addElement(fp, Element.DEPENDENCIES);
for (FeaturePackConfig dep : fpSpec.getFeaturePackDeps()) {
final ElementNode depElement = addElement(deps, Element.DEPENDENCY);
ProvisioningXmlWriter.writeFeaturePackConfig(depElement, fpSpec.getUserConfiguredLocation(dep.getLocation()), dep, fpSpec.originOf(dep.getLocation().getProducer()));
}
}
ProvisioningXmlWriter.writeConfigCustomizations(fp, Element.FEATURE_PACK.getNamespace(), fpSpec);
if (fpSpec.hasDefaultPackages()) {
final ElementNode pkgs = addElement(fp, Element.DEFAULT_PACKAGES);
final String[] pkgNames = fpSpec.getDefaultPackageNames().toArray(new String[0]);
Arrays.sort(pkgNames);
for (String name : pkgNames) {
addAttribute(addElement(pkgs, Element.PACKAGE), Attribute.NAME, name);
}
}
if (fpSpec.hasPlugins()) {
final ElementNode plugins = addElement(fp, Element.PLUGINS);
for (FeaturePackPlugin plugin : fpSpec.getPlugins().values()) {
final ElementNode pluginE = addElement(plugins, Element.PLUGIN);
addAttribute(pluginE, Attribute.ID, plugin.getId());
addAttribute(pluginE, Attribute.LOCATION, plugin.getLocation());
}
}
return fp;
}
Aggregations