aboutsummaryrefslogtreecommitdiffstats
path: root/common/openecomp-common-configuration-management/openecomp-configuration-management-api
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2017-12-27 14:42:51 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-27 11:45:34 +0000
commitf00a3cc3452f6d15ac107d7e2c199b02e6338329 (patch)
tree9bd4b9ffa25bf83ed35c793ad6021c43fcf1363a /common/openecomp-common-configuration-management/openecomp-configuration-management-api
parent53c101d783b944da0323faeea46f13477cb5acff (diff)
Sonar fixes for module - Configuration mgmt api
1. Fixed major sonar violations configuration management api module Change-Id: I83863213e35cf092ffd1c1ff84f408318d5ce8e9 Issue-ID: SDC-343 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'common/openecomp-common-configuration-management/openecomp-configuration-management-api')
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java2
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java1
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java40
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java6
4 files changed, 26 insertions, 23 deletions
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java
index 4d82dad965..07db4ab3aa 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Configuration.java
@@ -11,7 +11,7 @@ public interface Configuration {
/**
* The constant tenant.
*/
- public static ThreadLocal<String> tenant = new ThreadLocal<String>();
+ public static ThreadLocal<String> tenant = new ThreadLocal<>();
/**
* Sets tenant id.
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java
index 57814bba44..f7510aef0a 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/ConfigurationChangeListener.java
@@ -7,7 +7,6 @@ public interface ConfigurationChangeListener {
}
public default void notify(String component, String key, Object oldValue, Object newValue) {
- System.out.println("HIT");
}
public default void notify(String key, Object oldValue, Object newValue) {
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java
index 428d9ee233..3b64fe71a9 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java
@@ -83,14 +83,8 @@ public class DynamicConfiguration<T> {
"Only Wrapper classes like Integer, Long, Double, "
+ "Boolean etc including String are supported.");
}
- DynamicConfiguration<List<K>> dynamicConfiguration = new DynamicConfiguration<>();
- dynamicConfiguration.tenant = tenant;
- dynamicConfiguration.namespace = namespace;
- dynamicConfiguration.key = key;
- dynamicConfiguration.clazz = getArrayClass(clazz);
- dynamicConfiguration.defaultValue = Arrays.asList(defaultValue);
- dynamicConfiguration.configuration = configuration;
- return dynamicConfiguration;
+ return getDynamicConfiguration(tenant, namespace, key, getArrayClass(clazz),
+ Arrays.asList(defaultValue), configuration);
}
/**
@@ -100,28 +94,38 @@ public class DynamicConfiguration<T> {
* @return the array class
*/
public static Class getArrayClass(Class clazz) {
+ Class arrayClass = null;
switch (clazz.getName()) {
case "java.lang.Byte":
- return Byte[].class;
+ arrayClass = Byte[].class;
+ break;
case "java.lang.Short":
- return Short[].class;
+ arrayClass = Short[].class;
+ break;
case "java.lang.Integer":
- return Integer[].class;
+ arrayClass = Integer[].class;
+ break;
case "java.lang.Long":
- return Long[].class;
+ arrayClass = Long[].class;
+ break;
case "java.lang.Float":
- return Float[].class;
+ arrayClass = Float[].class;
+ break;
case "java.lang.Double":
- return Double[].class;
+ arrayClass = Double[].class;
+ break;
case "java.lang.Boolean":
- return Boolean[].class;
+ arrayClass = Boolean[].class;
+ break;
case "java.lang.Character":
- return Character[].class;
+ arrayClass = Character[].class;
+ break;
case "java.lang.String":
- return String[].class;
+ arrayClass = String[].class;
+ break;
default:
}
- return null;
+ return arrayClass;
}
/**
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java
index c3f54bd183..600c76df52 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/Hint.java
@@ -4,14 +4,14 @@ public enum Hint {
DEFAULT(0b0), LATEST_LOOKUP(0b1), EXTERNAL_LOOKUP(0b10), NODE_SPECIFIC(0b100);
- private final int hint;
+ private final int lookupHint;
private Hint(int hnt) {
- hint = hnt;
+ lookupHint = hnt;
}
public int value() {
- return hint;
+ return lookupHint;
}