use of org.jboss.galleon.runtime.FeaturePackRuntimeBuilder in project galleon by wildfly.
the class ProvisioningManager method install.
public void install(FeaturePackConfig fpConfig, 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)) {
final UniverseSpec configuredUniverse = getConfiguredUniverse(fpConfig.getLocation());
layout.install(configuredUniverse == null ? fpConfig : FeaturePackConfig.builder(fpConfig.getLocation().replaceUniverse(configuredUniverse)).init(fpConfig).build(), options);
doProvision(layout, getFsDiff(), false);
}
}
use of org.jboss.galleon.runtime.FeaturePackRuntimeBuilder 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);
}
}
use of org.jboss.galleon.runtime.FeaturePackRuntimeBuilder in project galleon by wildfly.
the class ProvisioningManager method persistChanges.
/**
* Merge user changes recognized by the provisioning plug-ins (such as
* changes to the configuration files) into the provisioning configuration
* file describing the state of the installation).
*
* @return true if some changes have been persisted, false otherwise.
* @throws ProvisioningException in case the merge fails
*/
public boolean persistChanges() throws ProvisioningException {
final ProvisioningDiffProvider diffProvider = getDiffMergedConfig();
if (diffProvider == null) {
return false;
}
final ProvisioningConfig mergedConfig = diffProvider.getMergedConfig();
if (mergedConfig.equals(getProvisioningConfig())) {
return false;
}
try (ProvisioningLayout<FeaturePackRuntimeBuilder> layout = getLayoutFactory().newConfigLayout(mergedConfig, ProvisioningRuntimeBuilder.FP_RT_FACTORY, false)) {
doProvision(layout, diffProvider.getFsDiff(), false);
}
return true;
}
use of org.jboss.galleon.runtime.FeaturePackRuntimeBuilder in project galleon by wildfly.
the class ProvisioningManager method getDiffMergedConfig.
private ProvisioningDiffProvider getDiffMergedConfig() throws ProvisioningException {
final FsDiff diff = getFsDiff();
if (diff == null || diff.isEmpty()) {
return null;
}
try (ProvisioningLayout<FeaturePackRuntimeBuilder> layout = layoutFactory.newConfigLayout(getProvisioningConfig(), ProvisioningRuntimeBuilder.FP_RT_FACTORY, false)) {
final ProvisioningDiffProvider diffProvider = ProvisioningDiffProvider.newInstance(layout, getProvisionedState(), diff, log);
layout.visitPlugins(new FeaturePackPluginVisitor<StateDiffPlugin>() {
@Override
public void visitPlugin(StateDiffPlugin plugin) throws ProvisioningException {
plugin.diff(diffProvider);
}
}, StateDiffPlugin.class);
return diffProvider;
}
}
use of org.jboss.galleon.runtime.FeaturePackRuntimeBuilder in project galleon by wildfly.
the class ProvisioningManager method uninstall.
/**
* Uninstalls the specified feature-pack.
*
* @param fpid feature-pack ID
* @param pluginOptions provisioning plugin options
* @throws ProvisioningException in case of a failure
*/
public void uninstall(FeaturePackLocation.FPID fpid, Map<String, String> pluginOptions) throws ProvisioningException {
ProvisioningConfig config = getProvisioningConfig();
if (config == null || !config.hasFeaturePackDeps()) {
throw new ProvisioningException(Errors.unknownFeaturePack(fpid));
}
try (ProvisioningLayout<FeaturePackRuntimeBuilder> layout = getLayoutFactory().newConfigLayout(config, ProvisioningRuntimeBuilder.FP_RT_FACTORY, false)) {
layout.uninstall(resolveUniverseSpec(fpid.getLocation()).getFPID(), pluginOptions);
doProvision(layout, getFsDiff(), false);
}
}
Aggregations