Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix suggestion finder installation #4209

Merged
merged 2 commits into from
May 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public AddonSuggestionService(final @Reference ConfigurationAdmin configurationA
this.configurationAdmin = configurationAdmin;
this.localeProvider = localeProvider;

SUGGESTION_FINDERS.forEach(f -> baseFinderConfig.put(f, true));
SUGGESTION_FINDERS.forEach(f -> baseFinderConfig.put(f, false));
modified(config);

// Changes to the configuration are expected to call the {@link modified} method. This works well when running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question: Is this job still needed after #4188?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. The reason is that it refers to a configuration from a different component (to avoid proliferation of component configurations all separated out in the UI) and in Karaf that does not get synchronized reliably.

Expand Down Expand Up @@ -115,13 +115,13 @@ public void modified(@Nullable final Map<String, Object> config) {
String cfgParam = SUGGESTION_FINDER_CONFIGS.get(finder);
if (cfgParam != null) {
boolean enabled = (config != null)
? ConfigParser.valueAsOrElse(config.get(cfgParam), Boolean.class, cfg)
? ConfigParser.valueAsOrElse(config.get(cfgParam), Boolean.class, true)
: cfg;
if (cfg != enabled) {
baseFinderConfig.put(finder, enabled);
String type = SUGGESTION_FINDER_TYPES.get(finder);
AddonFinderService finderService = addonFinderService;
if (type != null && finderService != null) {
baseFinderConfig.put(finder, enabled);
if (enabled) {
finderService.install(type);
} else {
Expand Down