use of org.jboss.galleon.util.FeaturePackInstallException in project galleon by wildfly.
the class ProvisioningRuntime method provision.
public void provision() throws ProvisioningException {
layout.visitPlugins(new FeaturePackPluginVisitor<InstallPlugin>() {
@Override
public void visitPlugin(InstallPlugin plugin) throws ProvisioningException {
plugin.preInstall(ProvisioningRuntime.this);
}
}, InstallPlugin.class);
// copy package content
for (FeaturePackRuntime fp : layout.getOrderedFeaturePacks()) {
messageWriter.verbose("Installing %s", fp.getFPID());
for (PackageRuntime pkg : fp.getPackages()) {
final Path pkgSrcDir = pkg.getContentDir();
if (Files.exists(pkgSrcDir)) {
try {
IoUtils.copy(pkgSrcDir, stagedDir);
} catch (IOException e) {
throw new FeaturePackInstallException(Errors.packageContentCopyFailed(pkg.getName()), e);
}
}
}
}
layout.visitPlugins(new FeaturePackPluginVisitor<InstallPlugin>() {
@Override
public void visitPlugin(InstallPlugin plugin) throws ProvisioningException {
plugin.postInstall(ProvisioningRuntime.this);
}
}, InstallPlugin.class);
if (recordState) {
// save the config
try {
ProvisioningXmlWriter.getInstance().write(config, PathsUtils.getProvisioningXml(stagedDir));
} catch (XMLStreamException | IOException e) {
throw new FeaturePackInstallException(Errors.writeFile(PathsUtils.getProvisioningXml(stagedDir)), e);
}
// save the provisioned state
try {
ProvisionedStateXmlWriter.getInstance().write(this, PathsUtils.getProvisionedStateXml(stagedDir));
} catch (XMLStreamException | IOException e) {
throw new FeaturePackInstallException(Errors.writeFile(PathsUtils.getProvisionedStateXml(stagedDir)), e);
}
}
emptyStagedDir = null;
}
Aggregations