X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fconfiguration%2FApplicationConfig.java;h=1e8c6d472cf6f37b7c92c576388ba73395f7e0fe;hb=10811110a23cf9fcf464575bba609b8c65d19aec;hp=d4f726106134b2ea9204932df567a44f1f4646f9;hpb=95db19e2820102db0255ca57407faa333cbb4085;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 d4f72610..1e8c6d47 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 @@ -23,11 +23,14 @@ package org.oransc.policyagent.configuration; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import java.util.Vector; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import lombok.Getter; + import org.oransc.policyagent.exceptions.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -39,8 +42,21 @@ public class ApplicationConfig { @NotEmpty private String filepath; + @NotEmpty + private String a1ControllerBaseUrl; + + @NotEmpty + private String a1ControllerUsername; + + @NotEmpty + private String a1ControllerPassword; + private Collection observers = new Vector<>(); private Map ricConfigs = new HashMap<>(); + @Getter + private Properties dmaapPublisherConfig; + @Getter + private Properties dmaapConsumerConfig; @Autowired public ApplicationConfig() { @@ -50,6 +66,37 @@ public class ApplicationConfig { return this.filepath; } + public String getA1ControllerBaseUrl() { + return this.a1ControllerBaseUrl; + } + + public String getA1ControllerUsername() { + return this.a1ControllerUsername; + } + + public String getA1ControllerPassword() { + return this.a1ControllerPassword; + } + + /* + * Do not remove, used by framework! + */ + public synchronized void setFilepath(String filepath) { + this.filepath = filepath; + } + + public synchronized void setA1ControllerBaseUrl(String a1ControllerBaseUrl) { + this.a1ControllerBaseUrl = a1ControllerBaseUrl; + } + + public synchronized void setA1ControllerUsername(String a1ControllerUsername) { + this.a1ControllerUsername = a1ControllerUsername; + } + + public synchronized void setA1ControllerPassword(String a1ControllerPassword) { + this.a1ControllerPassword = a1ControllerPassword; + } + public synchronized Collection getRicConfigs() { return this.ricConfigs.values(); } @@ -85,7 +132,8 @@ public class ApplicationConfig { } } - public void setConfiguration(@NotNull Collection ricConfigs) { + public void setConfiguration(@NotNull Collection ricConfigs, Properties dmaapPublisherConfig, + Properties dmaapConsumerConfig) { Collection notifications = new Vector<>(); synchronized (this) { Map newRicConfigs = new HashMap<>(); @@ -95,7 +143,7 @@ public class ApplicationConfig { newRicConfigs.put(newConfig.name(), newConfig); notifications.add(new Notification(newConfig, RicConfigUpdate.ADDED)); this.ricConfigs.remove(newConfig.name()); - } else if (!newConfig.equals(newConfig)) { + } else if (!newConfig.equals(oldConfig)) { notifications.add(new Notification(newConfig, RicConfigUpdate.CHANGED)); newRicConfigs.put(newConfig.name(), newConfig); this.ricConfigs.remove(newConfig.name()); @@ -109,6 +157,9 @@ public class ApplicationConfig { this.ricConfigs = newRicConfigs; } notifyObservers(notifications); + + this.dmaapPublisherConfig = dmaapPublisherConfig; + this.dmaapConsumerConfig = dmaapConsumerConfig; } private void notifyObservers(Collection notifications) {