import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
+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;
private Collection<Observer> observers = new Vector<>();
private Map<String, RicConfig> ricConfigs = new HashMap<>();
+ @Getter
+ private Properties dmaapPublisherConfig;
+ @Getter
+ private Properties dmaapConsumerConfig;
@Autowired
public ApplicationConfig() {
return this.filepath;
}
+ /*
+ * Do not remove, used by framework!
+ */
public synchronized void setFilepath(String filepath) {
this.filepath = filepath;
}
return this.ricConfigs.values();
}
- public synchronized Optional<RicConfig> lookupRicConfigForManagedElement(String managedElementId) {
- for (RicConfig ricConfig : getRicConfigs()) {
- if (ricConfig.managedElementIds().contains(managedElementId)) {
- return Optional.of(ricConfig);
- }
- }
- return Optional.empty();
- }
-
public RicConfig getRic(String ricName) throws ServiceException {
for (RicConfig ricConfig : getRicConfigs()) {
if (ricConfig.name().equals(ricName)) {
}
}
- 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<>();
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());
this.ricConfigs = newRicConfigs;
}
notifyObservers(notifications);
+
+ this.dmaapPublisherConfig = dmaapPublisherConfig;
+ this.dmaapConsumerConfig = dmaapConsumerConfig;
}
private void notifyObservers(Collection<Notification> notifications) {