X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fconfiguration%2FApplicationConfig.java;h=6c2c91b22dde7dd32ab8d40e7ac2a32002c79429;hb=6d503afd38bdf9823bda3dfe3d307adaeb6f7eee;hp=5d7d5d98a982e61372ff248af2a8f081554a935f;hpb=254eab2d525ad00ac092d6859d21cbab8e42746a;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfig.java b/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfig.java index 5d7d5d98..6c2c91b2 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfig.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfig.java @@ -31,15 +31,27 @@ import javax.validation.constraints.NotEmpty; import lombok.Getter; import org.oransc.policyagent.exceptions.ServiceException; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import reactor.core.publisher.Flux; @EnableConfigurationProperties -@ConfigurationProperties("app") +@ConfigurationProperties() public class ApplicationConfig { @NotEmpty - private String filepath; + @Getter + @Value("${app.filepath}") + private String localConfigurationFilePath; + + @Value("${app.webclient.trust-store-used}") + private boolean sslTrustStoreUsed = false; + + @Value("${app.webclient.trust-store-password}") + private String sslTrustStorePassword = ""; + + @Value("${app.webclient.trust-store}") + private String sslTrustStore = ""; private Map ricConfigs = new HashMap<>(); @Getter @@ -49,21 +61,18 @@ public class ApplicationConfig { private Map controllerConfigs = new HashMap<>(); - public String getLocalConfigurationFilePath() { - return this.filepath; - } - - /* - * Do not remove, used by framework! - */ - public synchronized void setFilepath(String filepath) { - this.filepath = filepath; - } - public synchronized Collection getRicConfigs() { return this.ricConfigs.values(); } + public WebClientConfig getWebClientConfig() { + return ImmutableWebClientConfig.builder() // + .isTrustStoreUsed(this.sslTrustStoreUsed) // + .trustStore(this.sslTrustStore) // + .trustStorePassword(this.sslTrustStorePassword) // + .build(); + } + public synchronized ControllerConfig getControllerConfig(String name) throws ServiceException { ControllerConfig controllerConfig = this.controllerConfigs.get(name); if (controllerConfig == null) { @@ -107,14 +116,13 @@ public class ApplicationConfig { Map newRicConfigs = new HashMap<>(); for (RicConfig newConfig : parserResult.ricConfigs()) { RicConfig oldConfig = this.ricConfigs.get(newConfig.name()); + this.ricConfigs.remove(newConfig.name()); if (oldConfig == null) { newRicConfigs.put(newConfig.name(), newConfig); modifications.add(new RicConfigUpdate(newConfig, RicConfigUpdate.Type.ADDED)); - this.ricConfigs.remove(newConfig.name()); } else if (!newConfig.equals(oldConfig)) { modifications.add(new RicConfigUpdate(newConfig, RicConfigUpdate.Type.CHANGED)); newRicConfigs.put(newConfig.name(), newConfig); - this.ricConfigs.remove(newConfig.name()); } else { newRicConfigs.put(oldConfig.name(), oldConfig); }