Skip to content

Commit

Permalink
Rename GlobalPersistService.persistConfigurations() (#31033)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Apr 27, 2024
1 parent 1a0b731 commit f5b9f24
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public interface GlobalPersistService<T> {
/**
* Persist configurations.
*
* @param globalRuleConfigs configurations
* @param globalRuleConfigs global configurations
* @return meta data versions
*/
Collection<MetaDataVersion> persistConfig(T globalRuleConfigs);
Collection<MetaDataVersion> persistConfigurations(T globalRuleConfigs);

/**
* Load configurations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void persist(final Collection<RuleConfiguration> globalRuleConfigs) {

@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Collection<MetaDataVersion> persistConfig(final Collection<RuleConfiguration> globalRuleConfigs) {
public Collection<MetaDataVersion> persistConfigurations(final Collection<RuleConfiguration> globalRuleConfigs) {
Collection<MetaDataVersion> result = new LinkedList<>();
Map<RuleConfiguration, YamlDataNodeGlobalRuleConfigurationSwapper> yamlConfigs = new YamlDataNodeGlobalRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(globalRuleConfigs);
for (Entry<RuleConfiguration, YamlDataNodeGlobalRuleConfigurationSwapper> entry : yamlConfigs.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void persist(final Properties props) {
}

@Override
public Collection<MetaDataVersion> persistConfig(final Properties props) {
public Collection<MetaDataVersion> persistConfigurations(final Properties props) {
List<String> versions = repository.getChildrenKeys(GlobalNode.getPropsVersionsNode());
String nextActiveVersion = versions.isEmpty() ? DEFAULT_VERSION : String.valueOf(Integer.parseInt(versions.get(0)) + 1);
String persistKey = GlobalNode.getPropsVersionNode(nextActiveVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ public void removeRuleConfiguration(final String databaseName, final String rule
@Override
public void alterGlobalRuleConfiguration(final RuleConfiguration toBeAlteredRuleConfig) {
GlobalPersistService<Collection<RuleConfiguration>> globalRuleService = contextManager.getMetaDataContexts().getPersistService().getGlobalRuleService();
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService().switchActiveVersion(globalRuleService.persistConfig(Collections.singleton(toBeAlteredRuleConfig)));
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService()
.switchActiveVersion(globalRuleService.persistConfigurations(Collections.singleton(toBeAlteredRuleConfig)));
}

@Override
public void alterProperties(final Properties props) {
Collection<MetaDataVersion> versions = contextManager.getMetaDataContexts().getPersistService().getPropsService().persistConfig(props);
Collection<MetaDataVersion> versions = contextManager.getMetaDataContexts().getPersistService().getPropsService().persistConfigurations(props);
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService().switchActiveVersion(versions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,16 @@ public void removeRuleConfiguration(final String databaseName, final String rule
public void alterGlobalRuleConfiguration(final RuleConfiguration toBeAlteredRuleConfig) {
contextManager.getConfigurationContextManager().alterGlobalRuleConfiguration(toBeAlteredRuleConfig);
GlobalPersistService<Collection<RuleConfiguration>> globalRuleService = contextManager.getMetaDataContexts().getPersistService().getGlobalRuleService();
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService().switchActiveVersion(globalRuleService.persistConfig(Collections.singleton(toBeAlteredRuleConfig)));
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService()
.switchActiveVersion(globalRuleService.persistConfigurations(Collections.singleton(toBeAlteredRuleConfig)));
clearServiceCache();
}

@Override
public void alterProperties(final Properties props) {
contextManager.getConfigurationContextManager().alterProperties(props);
if (null != contextManager.getMetaDataContexts().getPersistService().getPropsService()) {
Collection<MetaDataVersion> versions = contextManager.getMetaDataContexts().getPersistService().getPropsService().persistConfig(props);
Collection<MetaDataVersion> versions = contextManager.getMetaDataContexts().getPersistService().getPropsService().persistConfigurations(props);
contextManager.getMetaDataContexts().getPersistService().getMetaDataVersionPersistService().switchActiveVersion(versions);
}
clearServiceCache();
Expand Down

0 comments on commit f5b9f24

Please sign in to comment.