summaryrefslogtreecommitdiffstats
path: root/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java
diff options
context:
space:
mode:
authoramitjai <amitjai@amdocs.com>2018-04-27 13:28:57 +0530
committerOren Kleks <orenkle@amdocs.com>2018-04-30 06:05:27 +0000
commit42c920baf4dbb9fe8775843a6d4c9f70fa29f064 (patch)
treeac2aff977e2b129e61d2166c4832842676e4f5c3 /common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java
parentf487427a32f410ab5c97a4092865d32beb88ee27 (diff)
Rename packages from openecomp to onap.
This task is all about package name space change also make changes to pom for common module Change-Id: Ie9bda0f958a9a05826c0374830cc9cb7d6d196b6 Issue-ID: SDC-1272 Signed-off-by: amitjai <amitjai@amdocs.com>
Diffstat (limited to 'common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java')
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java146
1 files changed, 0 insertions, 146 deletions
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
deleted file mode 100644
index 3b64fe71a9..0000000000
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-api/src/main/java/org/openecomp/config/api/DynamicConfiguration.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.openecomp.config.api;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * The type Dynamic configuration.
- *
- * @param <T> the type parameter
- */
-public class DynamicConfiguration<T> {
-
- /**
- * The Tenant.
- */
- String tenant;
- /**
- * The Namespace.
- */
- String namespace;
- /**
- * The Key.
- */
- String key;
- /**
- * The Configuration.
- */
- Configuration configuration;
- /**
- * The Clazz.
- */
- Class clazz;
- /**
- * The Default value.
- */
- T defaultValue;
-
- /**
- * Gets dynamic configuration.
- *
- * @param <T> the type parameter
- * @param tenant the tenant
- * @param namespace the namespace
- * @param key the key
- * @param clazz the clazz
- * @param defaultValue the default value
- * @param configuration the configuration
- * @return the dynamic configuration
- */
- public static <T> DynamicConfiguration<T> getDynamicConfiguration(String tenant, String namespace,
- String key, Class<T> clazz,
- T defaultValue,
- Configuration configuration) {
- DynamicConfiguration<T> dynamicConfiguration = new DynamicConfiguration<>();
- dynamicConfiguration.tenant = tenant;
- dynamicConfiguration.namespace = namespace;
- dynamicConfiguration.key = key;
- dynamicConfiguration.clazz = clazz;
- dynamicConfiguration.defaultValue = defaultValue;
- dynamicConfiguration.configuration = configuration;
- return dynamicConfiguration;
- }
-
- /**
- * Gets dyn configuration.
- *
- * @param <K> the type parameter
- * @param tenant the tenant
- * @param namespace the namespace
- * @param key the key
- * @param clazz the clazz
- * @param defaultValue the default value
- * @param configuration the configuration
- * @return the dyn configuration
- */
- public static <K> DynamicConfiguration<List<K>> getDynConfiguration(String tenant,
- String namespace, String key,
- Class<K> clazz,
- K defaultValue,
- Configuration configuration) {
- if (clazz.isPrimitive()) {
- throw new RuntimeException(
- "Only Wrapper classes like Integer, Long, Double, "
- + "Boolean etc including String are supported.");
- }
- return getDynamicConfiguration(tenant, namespace, key, getArrayClass(clazz),
- Arrays.asList(defaultValue), configuration);
- }
-
- /**
- * Gets array class.
- *
- * @param clazz the clazz
- * @return the array class
- */
- public static Class getArrayClass(Class clazz) {
- Class arrayClass = null;
- switch (clazz.getName()) {
- case "java.lang.Byte":
- arrayClass = Byte[].class;
- break;
- case "java.lang.Short":
- arrayClass = Short[].class;
- break;
- case "java.lang.Integer":
- arrayClass = Integer[].class;
- break;
- case "java.lang.Long":
- arrayClass = Long[].class;
- break;
- case "java.lang.Float":
- arrayClass = Float[].class;
- break;
- case "java.lang.Double":
- arrayClass = Double[].class;
- break;
- case "java.lang.Boolean":
- arrayClass = Boolean[].class;
- break;
- case "java.lang.Character":
- arrayClass = Character[].class;
- break;
- case "java.lang.String":
- arrayClass = String[].class;
- break;
- default:
- }
- return arrayClass;
- }
-
- /**
- * Get t.
- *
- * @return the t
- */
- public T get() {
- Object toReturn = configuration
- .get(tenant, namespace, key, clazz, Hint.LATEST_LOOKUP, Hint.EXTERNAL_LOOKUP,
- Hint.NODE_SPECIFIC);
- if (toReturn != null && toReturn.getClass().isArray()) {
- toReturn = Arrays.asList((Object[]) toReturn);
- }
- return toReturn == null ? defaultValue : (T) toReturn;
- }
-
-}