[ONOS-3906] Utils for translator implementation.

Change-Id: I1d3617e81c332b6f0194a4b4b9e373c4297a6c67
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
new file mode 100644
index 0000000..336b87e
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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.yangutils.utils;
+
+/**
+ * Provides utility constants while generating java files.
+ */
+public final class UtilConstants {
+
+    /**
+     * Default constructor.
+     */
+    private UtilConstants() {
+    }
+
+    /**
+     * For java-docs.
+     */
+    public static final String IMPL_CLASS_JAVA_DOC = " * Provides the implementation of ";
+    public static final String BUILDER_CLASS_JAVA_DOC = " * Provides the builder implementation of ";
+    public static final String INTERFACE_JAVA_DOC = " * Abstraction of an entity which provides functionalities of ";
+    public static final String BUILDER_INTERFACE_JAVA_DOC = " * Builder for ";
+    public static final String PACKAGE_INFO_JAVADOC = " * Generated java code for the YANG file ";
+    public static final String JAVA_DOC_FIRST_LINE = "/**\n";
+    public static final String JAVA_DOC_END_LINE = " */\n";
+    public static final String JAVA_DOC_PARAM = " * @param ";
+    public static final String JAVA_DOC_RETURN = " * @return ";
+    public static final String JAVA_DOC_THROWS = " * @throws ";
+    public static final String JAVA_DOC_SETTERS = " * Returns the builder object of ";
+    public static final String JAVA_DOC_GETTERS = " * Returns the attribute ";
+    public static final String JAVA_DOC_DEFAULT_CONSTRUCTOR = " * Default Constructor.\n";
+    public static final String JAVA_DOC_CONSTRUCTOR = " * Construct the object of ";
+    public static final String JAVA_DOC_BUILD = " * Builds object of ";
+    public static final String JAVA_DOC_BUILD_RETURN = "object of ";
+
+    /**
+     * Basic requirements.
+     */
+    public static final String NEW_LINE = "\n";
+    public static final String NEW_LINE_ESTRIC = " *\n";
+    public static final String PERIOD = ".";
+    public static final String COLAN = ":";
+    public static final String SEMI_COLAN = ";";
+    public static final String HYPHEN = "-";
+    public static final String SPACE = " ";
+    public static final String TAB = "\t";
+    public static final String EQUAL = "=";
+    public static final String SLASH = "/";
+    public static final String ADD = "+";
+    public static final String ASTERISK = "*";
+    public static final String AT = "@";
+
+    /**
+     * For brackets.
+     */
+    public static final String DIAMOND_OPEN_BRACKET = "<";
+    public static final String DIAMOND_CLOSE_BRACKET = ">";
+    public static final String SQUARE_OPEN_BRACKET = "[";
+    public static final String SQUARE_CLOSE_BRACKET = "]";
+    public static final String OPEN_PARENTHESIS = "(";
+    public static final String CLOSE_PARENTHESIS = ")";
+    public static final String OPEN_CURLY_BRACKET = "{";
+    public static final String CLOSE_CURLY_BRACKET = "}";
+
+    /**
+     * For methods.
+     */
+    public static final String GET_METHOD_PREFIX = "get";
+    public static final String SET_METHOD_PREFIX = "set";
+
+    /**
+     * For indentation.
+     */
+    public static final String FOUR_SPACE_INDENTATION = "    ";
+    public static final String EIGHT_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
+    public static final String TWELVE_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION;
+    public static final String SIXTEEN_SPACE_INDENTATION = EIGHT_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION;
+
+    /**
+     * For directories.
+     */
+    public static final String YANG_GEN_DIR = "src/main/yangmodal/";
+    public static final String DEFAULT_BASE_PKG = "org.onosproject.yang.gen";
+    public static final String REVISION_PREFIX = "rev";
+    public static final String VERSION_PREFIX = "v";
+
+    /**
+     * For class modifiers.
+     */
+    public static final String PRIVATE = "private";
+    public static final String PUBLIC = "public";
+    public static final String PROTECTED = "protected";
+
+    /**
+     * For data types.
+     */
+    public static final String INT = "int";
+    public static final String VOID = "void";
+    public static final String SHORT = "short";
+    public static final String LONG = "long";
+    public static final String BOOLEAN = "boolean";
+    public static final String STRING = "String";
+    public static final String FLOAT = "float";
+    public static final String BYTE = "byte";
+    public static final String DOUBLE = "double";
+
+    /**
+     * For idenifiers.
+     */
+    public static final String CLASS = "class";
+    public static final String BUILDER = "Builder";
+    public static final String BUILDER_OBJECT = "builder object of ";
+    public static final String INTERFACE = "interface";
+    public static final String ENUM = "enum";
+    public static final String STATIC = "static";
+    public static final String FINAL = "final";
+    public static final String PACKAGE = "package";
+    public static final String IMPORT = "import";
+    public static final String NULL = "null";
+    public static final String RETURN = "return";
+    public static final String NEW = "new";
+    public static final String THIS = "this";
+    public static final String IMPLEMENTS = "implements";
+    public static final String EXTEND = "extends";
+    public static final String IMPL = "Impl";
+    public static final String BUILD = "build";
+    public static final String OBJECT = "Object";
+    public static final String OVERRIDE = "@Override";
+
+    /**
+     * For collections.
+     */
+    public static final String ABSTRACT_COLLECTION = "AbstractCollection";
+
+    public static final String LIST = "List";
+    public static final String LINKED_LIST = "LinkedList";
+    public static final String ARRAY_LIST = "ArrayList";
+    public static final String ABSTRACT_LIST = "AbstractList";
+    public static final String ABSTRACT_SEQUENTAIL_LIST = "AbstractSequentialList";
+
+    public static final String SET = "Set";
+    public static final String HASH_SET = "HashSet";
+    public static final String ABSTRACT_SET = "AbstractSet";
+    public static final String LINKED_HASH_SET = "LinkedHashSet";
+    public static final String TREE_SET = "TreeSet";
+
+    public static final String MAP = "Map";
+    public static final String ABSTRACT_MAP = "AbstractMap";
+    public static final String HASH_MAP = "HashMap";
+    public static final String TREE_MAP = "TreeMap";
+    public static final String CONCURRENT_MAP = "ConcurrentMap";
+    public static final String EVENTUALLY_CONSISTENT_MAP = "EventuallyConsitentMap";
+    public static final String STACK = "stack";
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java
new file mode 100644
index 0000000..8b7e732
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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.yangutils.utils.io.impl;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.slf4j.Logger;
+
+/**
+ * Provides the license header for the generated files.
+ */
+public final class CopyrightHeader {
+
+    private static final Logger log = getLogger(CopyrightHeader.class);
+    private static final int NULL = -1;
+    private static ClassLoader classLoader = CopyrightHeader.class.getClassLoader();
+
+    /**
+     * Default constructor.
+     */
+    private CopyrightHeader() {
+    }
+
+    /**
+     * Returns Copyright file header.
+     *
+     * @return Copyright file header
+     */
+    public static String getCopyrightHeader() {
+        return parseOnosHeader();
+    }
+
+    /**
+     * parse Copyright to the temporary file.
+     *
+     * @param file generated file
+     * @param stream input stream
+     */
+    private static String parseOnosHeader() {
+
+        File temp = new File("temp.txt");
+
+        try {
+            InputStream stream = classLoader.getResourceAsStream("CopyrightHeader.txt");
+            OutputStream out = new FileOutputStream(temp);
+            int index;
+            while ((index = stream.read()) != NULL) {
+                out.write(index);
+            }
+            out.close();
+            return convertToString(temp.toString());
+        } catch (IOException e) {
+            log.info("Failed to insert onos header in files.");
+        } finally {
+            temp.delete();
+        }
+        return "";
+    }
+
+    /**
+     * Converts it to string.
+     *
+     * @param toAppend file to be converted.
+     * @return string of file.
+     * @throws IOException when fails to convert to string
+     */
+    private static String convertToString(String toAppend) throws IOException {
+        BufferedReader bufferReader = new BufferedReader(new FileReader(toAppend));
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                stringBuilder.append(line);
+                stringBuilder.append("\n");
+                line = bufferReader.readLine();
+            }
+            return stringBuilder.toString();
+        } finally {
+            bufferReader.close();
+        }
+    }
+}
diff --git a/utils/yangutils/src/main/resources/CopyrightHeader.txt b/utils/yangutils/src/main/resources/CopyrightHeader.txt
new file mode 100644
index 0000000..ca214a2
--- /dev/null
+++ b/utils/yangutils/src/main/resources/CopyrightHeader.txt
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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.
+ */
+