Merge "Adapt A1 controller to latest A1 spec"
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / configuration / ApplicationConfig.java
index d4f7261..1ed3fdb 100644 (file)
@@ -23,6 +23,7 @@ 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;
@@ -41,6 +42,8 @@ public class ApplicationConfig {
 
     private Collection<Observer> observers = new Vector<>();
     private Map<String, RicConfig> ricConfigs = new HashMap<>();
+    private Properties dmaapPublisherConfig;
+    private Properties dmaapConsumerConfig;
 
     @Autowired
     public ApplicationConfig() {
@@ -50,6 +53,13 @@ public class ApplicationConfig {
         return this.filepath;
     }
 
+    /*
+     * Do not remove, used by framework!
+     */
+    public synchronized void setFilepath(String filepath) {
+        this.filepath = filepath;
+    }
+
     public synchronized Collection<RicConfig> getRicConfigs() {
         return this.ricConfigs.values();
     }
@@ -63,6 +73,14 @@ public class ApplicationConfig {
         throw new ServiceException("Could not find ric: " + ricName);
     }
 
+    public Properties getDmaapPublisherConfig() {
+        return dmaapConsumerConfig;
+    }
+
+    public Properties getDmaapConsumerConfig() {
+        return dmaapConsumerConfig;
+    }
+
     public static enum RicConfigUpdate {
         ADDED, CHANGED, REMOVED
     }
@@ -85,7 +103,8 @@ public class ApplicationConfig {
         }
     }
 
-    public void setConfiguration(@NotNull Collection<RicConfig> ricConfigs) {
+    public void setConfiguration(@NotNull Collection<RicConfig> ricConfigs, Properties dmaapPublisherConfig,
+        Properties dmaapConsumerConfig) {
         Collection<Notification> notifications = new Vector<>();
         synchronized (this) {
             Map<String, RicConfig> newRicConfigs = new HashMap<>();
@@ -109,6 +128,9 @@ public class ApplicationConfig {
             this.ricConfigs = newRicConfigs;
         }
         notifyObservers(notifications);
+
+        this.dmaapPublisherConfig = dmaapPublisherConfig;
+        this.dmaapConsumerConfig = dmaapConsumerConfig;
     }
 
     private void notifyObservers(Collection<Notification> notifications) {