use of org.jboss.galleon.UnsatisfiedPackageDependencyException in project galleon by wildfly.
the class FeaturePackRuntimeBuilder method resolvePackage.
boolean resolvePackage(String pkgName, ProvisioningRuntimeBuilder rt, PackageRuntime.Builder parent, int type) throws ProvisioningException {
PackageRuntime.Builder pkgBuilder = pkgBuilders.get(pkgName);
if (pkgBuilder == null) {
final Path pkgDir = LayoutUtils.getPackageDir(dir, pkgName, false);
if (!Files.exists(pkgDir)) {
return false;
}
final Path pkgXml = pkgDir.resolve(Constants.PACKAGE_XML);
if (!Files.exists(pkgXml)) {
throw new ProvisioningDescriptionException(Errors.pathDoesNotExist(pkgXml));
}
try (BufferedReader reader = Files.newBufferedReader(pkgXml)) {
pkgBuilder = PackageRuntime.builder(this, PackageXmlParser.getInstance().parse(reader), pkgDir, ++rt.pkgsTotal);
} catch (IOException | XMLStreamException e) {
throw new ProvisioningException(Errors.parseXml(pkgXml), e);
}
if (!pkgBuilder.spec.getName().equals(pkgName)) {
throw new ProvisioningDescriptionException("Feature-pack " + getFPID() + " package spec name " + pkgBuilder.spec.getName() + " does not match the requested package name " + pkgName);
}
pkgBuilders = CollectionUtils.put(pkgBuilders, pkgName, pkgBuilder);
}
pkgBuilder.referencedAs(type);
if (parent == null) {
pkgBuilder.setFlag(PackageRuntime.ROOT);
if (type == PackageDependencySpec.REQUIRED) {
pkgBuilder.include();
}
} else if (!parent.isFlagOn(PackageRuntime.SCHEDULED)) {
parent.addPackageDep(pkgBuilder, type, rt.includedPkgDeps);
}
if (!rt.addToPkgDepBranch(pkgBuilder)) {
// to avoid stack overflow processing circular dependencies
return true;
}
if (pkgBuilder.spec.hasPackageDeps()) {
final FeaturePackRuntimeBuilder currentOrigin = rt.setOrigin(this);
try {
rt.processPackageDeps(pkgBuilder.spec, pkgBuilder);
} catch (UnsatisfiedPackageDependencyException e) {
throw new UnsatisfiedPackageDependencyException(getFPID(), pkgName, e);
} catch (ProvisioningException e) {
throw new ProvisioningException(Errors.resolvePackage(getFPID(), pkgName), e);
} finally {
rt.setOrigin(currentOrigin);
}
}
return true;
}
Aggregations