summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager/provider')
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorClient.java21
-rw-r--r--sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java10
2 files changed, 31 insertions, 0 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorClient.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorClient.java
index 3b1f71215..70ff86009 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorClient.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorClient.java
@@ -22,13 +22,17 @@
package org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPClient;
import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPResponse;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorConfigChangeListener;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.vescollectorconnector.impl.config.VESCollectorCfgImpl;
import org.slf4j.Logger;
@@ -40,8 +44,10 @@ public class VESCollectorClient implements VESCollectorService, IConfigChangedLi
private final ConfigurationFileRepresentation cfg;
private BaseHTTPClient httpClient;
private final Map<String, String> headerMap;
+ private List<VESCollectorConfigChangeListener> registeredObjects;
public VESCollectorClient(ConfigurationFileRepresentation config) {
+ registeredObjects = new ArrayList<VESCollectorConfigChangeListener>();
this.vesConfig = new VESCollectorCfgImpl(config);
this.cfg = config;
this.cfg.registerConfigChangedListener(this);
@@ -105,6 +111,21 @@ public class VESCollectorClient implements VESCollectorService, IConfigChangedLi
public void onConfigChanged() {
httpClient.setBaseUrl(getBaseUrl());
setAuthorization(getConfig().getUsername(), getConfig().getPassword());
+ Iterator<VESCollectorConfigChangeListener> it = registeredObjects.iterator();
+ while (it.hasNext()) {
+ VESCollectorConfigChangeListener o = it.next();
+ o.notify(getConfig());
+ }
+ }
+
+ @Override
+ public void registerForChanges(VESCollectorConfigChangeListener o) {
+ registeredObjects.add(o);
+ }
+
+ @Override
+ public void deregister(VESCollectorConfigChangeListener o) {
+ registeredObjects.remove(o);
}
}
diff --git a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java
index 1924a6759..c3bddc9b1 100644
--- a/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java
+++ b/sdnr/wt/devicemanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/config/VESCollectorCfgImpl.java
@@ -29,6 +29,10 @@ public class VESCollectorCfgImpl implements VESCollectorCfgService, Configuratio
private static final String SECTION_MARKER = "VESCollector";
+ /** set to true if VES Collector is installed and configured */
+ private static final String PROPERTY_KEY_VES_COLLECTOR_ENABLED = "VES_COLLECTOR_ENABLED";
+ private static final boolean DEFAULT_VALUE_VES_COLLECTOR_ENABLED = false;
+
private static final String PROPERTY_KEY_VES_COLLECTOR_IP = "VES_COLLECTOR_IP";
private static final String DEFAULT_VALUE_VES_COLLECTOR_IP = "127.0.0.1";
@@ -76,6 +80,11 @@ public class VESCollectorCfgImpl implements VESCollectorCfgService, Configuratio
return configuration != null ?configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_EVENTLOG_DETAIL) : DEFAULT_VALUE_EVENTLOG_DETAIL;
}
+ @Override
+ public boolean isVESCollectorEnabled() {
+ return configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_ENABLED);
+ }
+
public boolean getTLSEnabled() {
return configuration.getPropertyBoolean(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_TLS_ENABLED);
}
@@ -102,6 +111,7 @@ public class VESCollectorCfgImpl implements VESCollectorCfgService, Configuratio
@Override
public synchronized void defaults() {
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_ENABLED, DEFAULT_VALUE_VES_COLLECTOR_ENABLED);
configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_TLS_ENABLED, Boolean.FALSE);
configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_VES_COLLECTOR_USERNAME,
DEFAULT_VALUE_VES_COLLECTOR_USERNAME);