Separating renderers into features.
[groupbasedpolicy.git] / renderers / oc / src / main / java / org / opendaylight / groupbasedpolicy / renderer / oc / Utils.java
similarity index 96%
rename from groupbasedpolicy/src/main/java/org/opendaylight/groupbasedpolicy/renderer/oc/Utils.java
rename to renderers/oc/src/main/java/org/opendaylight/groupbasedpolicy/renderer/oc/Utils.java
index 74da664b800ecb003e3ec1762ad4c5b0fde185f8..76b8f6d8f811156d8c2a24dffb5970ba85953032 100644 (file)
@@ -1,80 +1,80 @@
-/*\r
- * Copyright (c) 2015 Juniper Networks, Inc.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.groupbasedpolicy.renderer.oc;\r
-\r
-import java.util.regex.Pattern;\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public class Utils {\r
-\r
-    static final Logger LOGGER = LoggerFactory.getLogger(Utils.class);\r
-\r
-    /**\r
-     * Invoked to format the UUID if UUID is not in correct format.\r
-     *\r
-     * @param String\r
-     *            An instance of UUID string.\r
-     *\r
-     * @return Correctly formated UUID string.\r
-     */\r
-    public static String uuidFormater(String uuid) {\r
-        String uuidPattern = null;\r
-        String id1 = uuid.substring(0, 8);\r
-        String id2 = uuid.substring(8, 12);\r
-        String id3 = uuid.substring(12, 16);\r
-        String id4 = uuid.substring(16, 20);\r
-        String id5 = uuid.substring(20, 32);\r
-        uuidPattern = (id1 + "-" + id2 + "-" + id3 + "-" + id4 + "-" + id5);\r
-        return uuidPattern;\r
-    }\r
-\r
-    /**\r
-     * Invoked to check the UUID if UUID is not a valid hexa-decimal number.\r
-     *\r
-     * @param String\r
-     *            An instance of UUID string.\r
-     *\r
-     * @return boolean value.\r
-     */\r
-    public static boolean isValidHexNumber(String uuid) {\r
-        try {\r
-            Pattern hex = Pattern.compile("^[0-9a-f]+$");\r
-            uuid = uuid.replaceAll("-", "");\r
-            boolean valid = hex.matcher(uuid).matches();\r
-            if (uuid.length() != 32) {\r
-                return false;\r
-            }\r
-            if (valid) {\r
-                return true;\r
-            } else {\r
-                return false;\r
-            }\r
-        } catch (NumberFormatException ex) {\r
-            LOGGER.error("Exception :  " + ex);\r
-            return false;\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Invoked to format the UUID/Name in correct format.\r
-     *\r
-     * @param String\r
-     *            An instance of UUID/Name string.\r
-     *\r
-     * @return Correctly formated UUID/name string.\r
-     */\r
-\r
-    public static String uuidNameFormat(String value){\r
-       String[] pattern = value.split("=");\r
-       value = pattern[1].replace("]", "");\r
-       return value;\r
-    }\r
+/*
+ * Copyright (c) 2015 Juniper Networks, Inc.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.groupbasedpolicy.renderer.oc;
+
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Utils {
+
+    static final Logger LOGGER = LoggerFactory.getLogger(Utils.class);
+
+    /**
+     * Invoked to format the UUID if UUID is not in correct format.
+     *
+     * @param String
+     *            An instance of UUID string.
+     *
+     * @return Correctly formated UUID string.
+     */
+    public static String uuidFormater(String uuid) {
+        String uuidPattern = null;
+        String id1 = uuid.substring(0, 8);
+        String id2 = uuid.substring(8, 12);
+        String id3 = uuid.substring(12, 16);
+        String id4 = uuid.substring(16, 20);
+        String id5 = uuid.substring(20, 32);
+        uuidPattern = (id1 + "-" + id2 + "-" + id3 + "-" + id4 + "-" + id5);
+        return uuidPattern;
+    }
+
+    /**
+     * Invoked to check the UUID if UUID is not a valid hexa-decimal number.
+     *
+     * @param String
+     *            An instance of UUID string.
+     *
+     * @return boolean value.
+     */
+    public static boolean isValidHexNumber(String uuid) {
+        try {
+            Pattern hex = Pattern.compile("^[0-9a-f]+$");
+            uuid = uuid.replaceAll("-", "");
+            boolean valid = hex.matcher(uuid).matches();
+            if (uuid.length() != 32) {
+                return false;
+            }
+            if (valid) {
+                return true;
+            } else {
+                return false;
+            }
+        } catch (NumberFormatException ex) {
+            LOGGER.error("Exception :  " + ex);
+            return false;
+        }
+    }
+
+    /**
+     * Invoked to format the UUID/Name in correct format.
+     *
+     * @param String
+     *            An instance of UUID/Name string.
+     *
+     * @return Correctly formated UUID/name string.
+     */
+
+    public static String uuidNameFormat(String value){
+       String[] pattern = value.split("=");
+       value = pattern[1].replace("]", "");
+       return value;
+    }
 }
\ No newline at end of file