Search in sources :

Example 1 with FeaturePackInstallException

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;
}
Also used : Path(java.nio.file.Path) InstallPlugin(org.jboss.galleon.plugin.InstallPlugin) FeaturePackInstallException(org.jboss.galleon.util.FeaturePackInstallException) XMLStreamException(javax.xml.stream.XMLStreamException) ProvisioningException(org.jboss.galleon.ProvisioningException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 Path (java.nio.file.Path)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ProvisioningException (org.jboss.galleon.ProvisioningException)1 InstallPlugin (org.jboss.galleon.plugin.InstallPlugin)1 FeaturePackInstallException (org.jboss.galleon.util.FeaturePackInstallException)1