[ONOS-7683] Add default implementation of telemetry config managers
Change-Id: Iac3681ceff2b343746d2d0b1043300044043b63a
diff --git a/apps/openstacktelemetry/app/src/main/java/org/onosproject/openstacktelemetry/util/OpenstackTelemetryUtil.java b/apps/openstacktelemetry/app/src/main/java/org/onosproject/openstacktelemetry/util/OpenstackTelemetryUtil.java
new file mode 100644
index 0000000..86f3772
--- /dev/null
+++ b/apps/openstacktelemetry/app/src/main/java/org/onosproject/openstacktelemetry/util/OpenstackTelemetryUtil.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.openstacktelemetry.util;
+
+import com.google.common.base.Strings;
+
+import java.util.Dictionary;
+
+import static org.onlab.util.Tools.get;
+
+/**
+ * An utility that used in openstack telemetry app.
+ */
+public final class OpenstackTelemetryUtil {
+
+ /**
+ * Prevents object instantiation from external.
+ */
+ private OpenstackTelemetryUtil() {
+ }
+
+ /**
+ * Gets Boolean property from the propertyName
+ * Return null if propertyName is not found.
+ *
+ * @param properties properties to be looked up
+ * @param propertyName the name of the property to look up
+ * @return value when the propertyName is defined or return null
+ */
+ public static Boolean getBooleanProperty(Dictionary<?, ?> properties,
+ String propertyName) {
+ Boolean value;
+ try {
+ String s = get(properties, propertyName);
+ value = Strings.isNullOrEmpty(s) ? null : Boolean.valueOf(s);
+ } catch (ClassCastException e) {
+ value = null;
+ }
+ return value;
+ }
+}