Skip to content

Commit

Permalink
Fix API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Sep 9, 2024
1 parent 8f59e41 commit d8175ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ public enum Toggle {
DEFAULT, DISABLE, ENABLE;

public void applyTo(Properties properties, CharSequence key) {
applyTo(properties, key, "false", "true");
}

public void applyTo(Properties properties, CharSequence key, String disableValue, String enableValue) {
switch (this) {
case DEFAULT:
properties.remove(key.toString());
break;
case DISABLE:
properties.setProperty(key.toString(), Boolean.toString(false));
properties.setProperty(key.toString(), disableValue);
break;
case ENABLE:
properties.setProperty(key.toString(), Boolean.toString(true));
properties.setProperty(key.toString(), enableValue);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
import sdmxdl.web.SdmxWebManager;
import sdmxdl.web.WebSource;
import standalone_sdmxdl.sdmxdl.provider.ri.caching.RiCaching;
import standalone_sdmxdl.sdmxdl.provider.ri.drivers.SourceProperties;
import standalone_sdmxdl.sdmxdl.provider.ri.networking.RiNetworking;

import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Properties;

Expand Down Expand Up @@ -81,7 +78,7 @@ public static SdmxWebConfiguration copyOf(SdmxWebConfiguration bean) {
public SdmxWebManager toSdmxWebManager() {
Properties properties = System.getProperties();

curlBackend.applyTo(properties, RiNetworking.CURL_BACKEND_PROPERTY);
curlBackend.applyTo(properties, RiNetworking.URL_BACKEND_PROPERTY, "JDK", "CURL");
noCache.applyTo(properties, RiCaching.NO_CACHE_PROPERTY);
autoProxy.applyTo(properties, RiNetworking.AUTO_PROXY_PROPERTY);
noDefaultSSL.applyTo(properties, RiNetworking.NO_DEFAULT_SSL_PROPERTY);
Expand All @@ -91,18 +88,9 @@ public SdmxWebManager toSdmxWebManager() {
.toBuilder()
.onEvent(this::reportEvent)
.onError(this::reportError)
.customSources(getCustomSources())
.build();
}

private static List<WebSource> getCustomSources() {
try {
return SourceProperties.loadCustomSources();
} catch (IOException e) {
return Collections.emptyList();
}
}

public Languages toLanguages() {
return Parser.of(Languages::parse)
.parseValue(languages)
Expand Down

0 comments on commit d8175ce

Please sign in to comment.