use of org.jboss.galleon.diff.ProvisioningDiffProvider 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.diff.ProvisioningDiffProvider 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;
}
}
Aggregations