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=a2533733553201f2c615b1053bea8d3b562483fb;hb=4e7db50d7fb3fd2c7101520f00f0f0b4baf9bddc;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..a2533733 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 @@ -24,46 +24,56 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import java.util.Properties; 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 - private Properties dmaapPublisherConfig; + private String dmaapConsumerTopicUrl; + @Getter - private Properties dmaapConsumerConfig; + private String dmaapProducerTopicUrl; 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) { @@ -100,21 +110,21 @@ public class ApplicationConfig { ApplicationConfigParser.ConfigParserResult parserResult) { Collection modifications = new ArrayList<>(); - this.dmaapPublisherConfig = parserResult.dmaapPublisherConfig(); - this.dmaapConsumerConfig = parserResult.dmaapConsumerConfig(); this.controllerConfigs = parserResult.controllerConfigs(); + this.dmaapConsumerTopicUrl = parserResult.dmaapConsumerTopicUrl(); + this.dmaapProducerTopicUrl = parserResult.dmaapProducerTopicUrl(); + 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); }