Search in sources :

Example 11 with ProvisioningConfig

use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.

the class ProvisioningManager method apply.

/**
 * Apply provisioning plan to the currently provisioned installation
 *
 * @param plan  provisioning plan
 * @param options  provisioning plugin options
 * @throws ProvisioningException  in case of a failure
 */
public void apply(ProvisioningPlan plan, Map<String, String> options) throws ProvisioningException {
    ProvisioningConfig config = getProvisioningConfig();
    if (config == null) {
        config = ProvisioningConfig.builder().build();
    }
    try (ProvisioningLayout<FeaturePackRuntimeBuilder> layout = getLayoutFactory().newConfigLayout(config, ProvisioningRuntimeBuilder.FP_RT_FACTORY, false)) {
        layout.apply(plan, options);
        doProvision(layout, getFsDiff(), false);
    }
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) FeaturePackRuntimeBuilder(org.jboss.galleon.runtime.FeaturePackRuntimeBuilder)

Example 12 with ProvisioningConfig

use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.

the class ProvisioningManager method getUpdates.

/**
 * Query for available updates and patches for specific producers.
 * If no producer is passed as an argument, the method will return
 * the update plan for only the feature-packs installed directly by the user.
 *
 * @param producers  producers to include into the update plan
 * @return  update plan
 * @throws ProvisioningException in case of a failure
 */
public ProvisioningPlan getUpdates(ProducerSpec... producers) throws ProvisioningException {
    final ProvisioningConfig config = getProvisioningConfig();
    ProvisioningPlan plan;
    if (config == null) {
        plan = ProvisioningPlan.builder();
    } else {
        try (ProvisioningLayout<?> layout = getLayoutFactory().newConfigLayout(config)) {
            plan = layout.getUpdates(producers);
        }
    }
    return plan;
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) ProvisioningPlan(org.jboss.galleon.layout.ProvisioningPlan)

Example 13 with ProvisioningConfig

use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.

the class ProvisioningManager method addUniverse.

/**
 * Add named universe spec to the provisioning configuration
 *
 * @param name  universe name
 * @param universeSpec  universe spec
 * @throws ProvisioningException  in case of an error
 */
public void addUniverse(String name, UniverseSpec universeSpec) throws ProvisioningException {
    final ProvisioningConfig config = ProvisioningConfig.builder(getProvisioningConfig()).addUniverse(name, universeSpec).build();
    try {
        ProvisioningXmlWriter.getInstance().write(config, PathsUtils.getProvisioningXml(home));
    } catch (Exception e) {
        throw new ProvisioningException(Errors.writeFile(PathsUtils.getProvisioningXml(home)), e);
    }
    this.provisioningConfig = config;
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) IOException(java.io.IOException)

Example 14 with ProvisioningConfig

use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.

the class ProvisioningManager method getUpdates.

/**
 * Query for available updates and patches for feature-packs in this layout.
 *
 * @param includeTransitive  whether to include transitive dependencies into the result
 * @return  available updates
 * @throws ProvisioningException in case of a failure
 */
public ProvisioningPlan getUpdates(boolean includeTransitive) throws ProvisioningException {
    final ProvisioningConfig config = getProvisioningConfig();
    ProvisioningPlan plan;
    if (config == null) {
        plan = ProvisioningPlan.builder();
    } else {
        try (ProvisioningLayout<?> layout = getLayoutFactory().newConfigLayout(config)) {
            plan = layout.getUpdates(includeTransitive);
        }
    }
    return plan;
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) ProvisioningPlan(org.jboss.galleon.layout.ProvisioningPlan)

Example 15 with ProvisioningConfig

use of org.jboss.galleon.config.ProvisioningConfig in project galleon by wildfly.

the class ProvisioningManager method removeUniverse.

/**
 * Removes universe spec associated with the name from the provisioning configuration
 * @param name  name of the universe spec or null for the default universe spec
 * @throws ProvisioningException  in case of an error
 */
public void removeUniverse(String name) throws ProvisioningException {
    ProvisioningConfig config = getProvisioningConfig();
    if (config == null || !config.hasUniverse(name)) {
        return;
    }
    config = ProvisioningConfig.builder(config).removeUniverse(name).build();
    try {
        ProvisioningXmlWriter.getInstance().write(config, PathsUtils.getProvisioningXml(home));
    } catch (Exception e) {
        throw new ProvisioningException(Errors.writeFile(PathsUtils.getProvisioningXml(home)), e);
    }
    this.provisioningConfig = config;
}
Also used : ProvisioningConfig(org.jboss.galleon.config.ProvisioningConfig) IOException(java.io.IOException)

Aggregations

ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)47 Test (org.junit.Test)16 Path (java.nio.file.Path)15 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)12 ProvisioningException (org.jboss.galleon.ProvisioningException)10 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)6 ProvisioningManager (org.jboss.galleon.ProvisioningManager)6 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)6 ConfigId (org.jboss.galleon.config.ConfigId)6 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)6 CommandException (org.aesh.command.CommandException)5 ConfigModel (org.jboss.galleon.config.ConfigModel)5 HashMap (java.util.HashMap)4 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)4 FeaturePackRuntimeBuilder (org.jboss.galleon.runtime.FeaturePackRuntimeBuilder)4 ProvisioningRuntime (org.jboss.galleon.runtime.ProvisioningRuntime)4 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)4 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)4 HashSet (java.util.HashSet)3