[ONOS-4350] Inter Jar dependency implementation and code restructuring.

Change-Id: Iacac75e4187aed93ce1754c170a9c19707e5b8c3
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java
new file mode 100644
index 0000000..5833de2
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/CopyrightHeader.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2016-present 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 java.util.Calendar;
+
+import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
+
+/**
+ * Represents the license header for the generated files.
+ */
+public final class CopyrightHeader {
+
+    private static final int EOF = -1;
+    private static final String COPYRIGHT_HEADER_FILE = "CopyrightHeader.txt";
+    private static final String COPYRIGHTS_FIRST_LINE = "/*\n * Copyright " + Calendar.getInstance().get(Calendar.YEAR)
+            + "-present Open Networking Laboratory\n";
+    private static final String TEMP_FILE = "temp.txt";
+    private static ClassLoader classLoader = CopyrightHeader.class.getClassLoader();
+
+    private static String copyrightHeader;
+
+    /**
+     * Creates an instance of copyright header.
+     */
+    private CopyrightHeader() {
+    }
+
+    /**
+     * Returns copyright file header.
+     *
+     * @return copyright file header
+     * @throws IOException when fails to parse copyright header
+     */
+    public static String getCopyrightHeader() throws IOException {
+
+        if (copyrightHeader == null) {
+            parseCopyrightHeader();
+        }
+        return copyrightHeader;
+    }
+
+    /**
+     * Sets the copyright header.
+     *
+     * @param header copyright header
+     */
+    private static void setCopyrightHeader(String header) {
+
+        copyrightHeader = header;
+    }
+
+    /**
+     * parses Copyright to the temporary file.
+     *
+     * @throws IOException when fails to get the copyright header
+     */
+    private static void parseCopyrightHeader() throws IOException {
+
+        File temp = new File(TEMP_FILE);
+
+        try {
+            InputStream stream = classLoader.getResourceAsStream(COPYRIGHT_HEADER_FILE);
+            OutputStream out = new FileOutputStream(temp);
+
+            int index;
+            out.write(COPYRIGHTS_FIRST_LINE.getBytes());
+            while ((index = stream.read()) != EOF) {
+                out.write(index);
+            }
+            out.close();
+            stream.close();
+            getStringFileContent(temp);
+            setCopyrightHeader(getStringFileContent(temp));
+        } catch (IOException e) {
+            throw new IOException("failed to parse the Copyright header");
+        } finally {
+            temp.delete();
+        }
+    }
+
+    /**
+     * 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 getStringFileContent(File toAppend) throws IOException {
+
+        FileReader fileReader = new FileReader(toAppend);
+        BufferedReader bufferReader = new BufferedReader(fileReader);
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                stringBuilder.append(line);
+                stringBuilder.append(NEW_LINE);
+                line = bufferReader.readLine();
+            }
+            return stringBuilder.toString();
+        } finally {
+            fileReader.close();
+            bufferReader.close();
+        }
+    }
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
new file mode 100644
index 0000000..7ae17d4
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2016-present 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.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.translator.exception.TranslatorException;
+import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
+import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
+
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getJavaPackageFromPackagePath;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yangutils.utils.UtilConstants.EIGHT_SPACE_INDENTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.MULTIPLE_NEW_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
+import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.addPackageInfo;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.createDirectories;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getAbsolutePackagePath;
+
+/**
+ * Represents utility to handle file system operations.
+ */
+public final class FileSystemUtil {
+
+    /**
+     * Creates an instance of file system util.
+     */
+    private FileSystemUtil() {
+    }
+
+    /**
+     * Checks if the package directory structure created.
+     *
+     * @param pkg Package to check if it is created
+     * @return existence status of package
+     */
+    public static boolean doesPackageExist(String pkg) {
+        File pkgDir = new File(getPackageDirPathFromJavaJPackage(pkg));
+        File pkgWithFile = new File(pkgDir + SLASH + "package-info.java");
+        return pkgDir.exists() && pkgWithFile.isFile();
+    }
+
+    /**
+     * Creates a package structure with package info java file if not present.
+     *
+     * @param yangNode YANG node for which code is being generated
+     * @throws IOException any IO exception
+     */
+    public static void createPackage(YangNode yangNode) throws IOException {
+        if (!(yangNode instanceof JavaFileInfoContainer)) {
+            throw new TranslatorException("current node must have java file info");
+        }
+        String pkgInfo;
+        JavaFileInfo javaFileInfo = ((JavaFileInfoContainer) yangNode).getJavaFileInfo();
+        String pkg = getAbsolutePackagePath(javaFileInfo.getBaseCodeGenPath(), javaFileInfo.getPackageFilePath());
+        if (!doesPackageExist(pkg)) {
+            try {
+                File pack = createDirectories(pkg);
+                YangNode parent = getParentNodeInGenCode(yangNode);
+                if (parent != null) {
+                    pkgInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo().getJavaName();
+                    addPackageInfo(pack, pkgInfo, getJavaPackageFromPackagePath(pkg), true,
+                            ((JavaFileInfoContainer) parent).getJavaFileInfo().getPluginConfig());
+                } else {
+                    pkgInfo = ((JavaFileInfoContainer) yangNode).getJavaFileInfo().getJavaName();
+                    addPackageInfo(pack, pkgInfo, getJavaPackageFromPackagePath(pkg), false,
+                            ((JavaFileInfoContainer) yangNode).getJavaFileInfo().getPluginConfig());
+                }
+            } catch (IOException e) {
+                throw new IOException("failed to create package-info file");
+            }
+        }
+    }
+
+    /**
+     * Reads the contents from source file and append its contents to append
+     * file.
+     *
+     * @param toAppend destination file in which the contents of source file is
+     * appended
+     * @param srcFile source file from which data is read and added to to append
+     * file
+     * @throws IOException any IO errors
+     */
+    public static void appendFileContents(File toAppend, File srcFile)
+            throws IOException {
+        updateFileHandle(srcFile, NEW_LINE + readAppendFile(toAppend.toString(), FOUR_SPACE_INDENTATION), false);
+    }
+
+    /**
+     * Reads file and convert it to string.
+     *
+     * @param toAppend file to be converted
+     * @param spaces spaces to be appended
+     * @return string of file
+     * @throws IOException when fails to convert to string
+     */
+    public static String readAppendFile(String toAppend, String spaces)
+            throws IOException {
+
+        FileReader fileReader = new FileReader(toAppend);
+        BufferedReader bufferReader = new BufferedReader(fileReader);
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                if (line.equals(SPACE) || line.equals(EMPTY_STRING) || line.equals(EIGHT_SPACE_INDENTATION)
+                        || line.equals(MULTIPLE_NEW_LINE)) {
+                    stringBuilder.append(NEW_LINE);
+                } else if (line.equals(FOUR_SPACE_INDENTATION)) {
+                    stringBuilder.append(EMPTY_STRING);
+                } else {
+                    stringBuilder.append(spaces + line);
+                    stringBuilder.append(NEW_LINE);
+                }
+                line = bufferReader.readLine();
+            }
+            return stringBuilder.toString();
+        } finally {
+            fileReader.close();
+            bufferReader.close();
+        }
+    }
+
+    /**
+     * Updates the generated file handle.
+     *
+     * @param inputFile input file
+     * @param contentTobeAdded content to be appended to the file
+     * @param isClose when close of file is called.
+     * @throws IOException if the named file exists but is a directory rather than a regular file,
+     *                     does not exist but cannot be created, or cannot be opened for any other reason
+     */
+    public static void updateFileHandle(File inputFile, String contentTobeAdded, boolean isClose)
+            throws IOException {
+
+        List<FileWriter> fileWriterStore = new ArrayList<>();
+
+        FileWriter fileWriter = new FileWriter(inputFile, true);
+        fileWriterStore.add(fileWriter);
+        PrintWriter outputPrintWriter = new PrintWriter(fileWriter, true);
+        if (!isClose) {
+            outputPrintWriter.write(contentTobeAdded);
+            outputPrintWriter.flush();
+            outputPrintWriter.close();
+        } else {
+            for (FileWriter curWriter : fileWriterStore) {
+                curWriter.flush();
+                curWriter.close();
+                curWriter = null;
+            }
+        }
+    }
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
new file mode 100644
index 0000000..fb8f981
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
@@ -0,0 +1,602 @@
+/*
+ * Copyright 2016-present 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 org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
+import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
+
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCamelCase;
+import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
+import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC;
+import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_INTERFACE_JAVA_DOC;
+import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_OBJECT;
+import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yangutils.utils.UtilConstants.ENUM_ATTRIBUTE_JAVADOC;
+import static org.onosproject.yangutils.utils.UtilConstants.ENUM_CLASS_JAVADOC;
+import static org.onosproject.yangutils.utils.UtilConstants.EVENT_JAVA_DOC;
+import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_JAVA_DOC;
+import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.FROM_STRING_METHOD_NAME;
+import static org.onosproject.yangutils.utils.UtilConstants.FROM_STRING_PARAM_NAME;
+import static org.onosproject.yangutils.utils.UtilConstants.IMPL;
+import static org.onosproject.yangutils.utils.UtilConstants.IMPL_CLASS_JAVA_DOC;
+import static org.onosproject.yangutils.utils.UtilConstants.INPUT;
+import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE_JAVA_DOC;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_BUILD;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_BUILD_RETURN;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_CONSTRUCTOR;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_END_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FIRST_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_GETTERS;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_MANAGER_SETTERS;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_OF;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_PARAM;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_RETURN;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_RPC;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_SETTERS_COMMON;
+import static org.onosproject.yangutils.utils.UtilConstants.LIST;
+import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE_ASTERISK;
+import static org.onosproject.yangutils.utils.UtilConstants.OBJECT;
+import static org.onosproject.yangutils.utils.UtilConstants.OF;
+import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC;
+import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE_INFO_JAVADOC_OF_CHILD;
+import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
+import static org.onosproject.yangutils.utils.UtilConstants.RPC_INPUT_STRING;
+import static org.onosproject.yangutils.utils.UtilConstants.RPC_OUTPUT_STRING;
+import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
+import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
+import static org.onosproject.yangutils.utils.UtilConstants.VALUE;
+import static org.onosproject.yangutils.utils.UtilConstants.VOID;
+
+/**
+ * Represents javadoc for the generated classes.
+ */
+public final class JavaDocGen {
+
+    /**
+     * Creates an instance of java doc gen.
+     */
+    private JavaDocGen() {
+    }
+
+    /**
+     * JavaDocs types.
+     */
+    public enum JavaDocType {
+
+        /**
+         * For class.
+         */
+        IMPL_CLASS,
+
+        /**
+         * For builder class.
+         */
+        BUILDER_CLASS,
+
+        /**
+         * For interface.
+         */
+        INTERFACE,
+
+        /**
+         * For builder interface.
+         */
+        BUILDER_INTERFACE,
+
+        /**
+         * For package-info.
+         */
+        PACKAGE_INFO,
+
+        /**
+         * For getters.
+         */
+        GETTER_METHOD,
+
+        /**
+         * For rpc service.
+         */
+        RPC_INTERFACE,
+
+        /**
+         * For rpc manager.
+         */
+        RPC_MANAGER,
+
+        /**
+         * For event.
+         */
+        EVENT,
+
+        /**
+         * For event listener.
+         */
+        EVENT_LISTENER,
+
+        /**
+         * For setters.
+         */
+        SETTER_METHOD,
+
+        /**
+         * For type def's setters.
+         */
+        TYPE_DEF_SETTER_METHOD,
+
+        /**
+         * For of method.
+         */
+        OF_METHOD,
+
+        /**
+         * For default constructor.
+         */
+        DEFAULT_CONSTRUCTOR,
+
+        /**
+         * For constructor.
+         */
+        CONSTRUCTOR,
+
+        /**
+         * For from method.
+         */
+        FROM_METHOD,
+
+        /**
+         * For type constructor.
+         */
+        TYPE_CONSTRUCTOR,
+
+        /**
+         * For build.
+         */
+        BUILD_METHOD,
+
+        /**
+         * For enum.
+         */
+        ENUM_CLASS,
+
+        /**
+         * For enum's attributes.
+         */
+        ENUM_ATTRIBUTE,
+
+        /**
+         * For manager setters.
+         */
+        MANAGER_SETTER_METHOD,
+
+        /**
+         * For event subject.
+         */
+        EVENT_SUBJECT_CLASS
+    }
+
+    /**
+     * Returns java docs.
+     *
+     * @param type java doc type
+     * @param name name of the YangNode
+     * @param isList is list attribute
+     * @param pluginConfig plugin configurations
+     * @return javadocs.
+     */
+    public static String getJavaDoc(JavaDocType type, String name, boolean isList, YangPluginConfig pluginConfig) {
+
+        name = JavaIdentifierSyntax.getSmallCase(getCamelCase(name, pluginConfig.getConflictResolver()));
+        switch (type) {
+            case IMPL_CLASS: {
+                return generateForClass(name);
+            }
+            case BUILDER_CLASS: {
+                return generateForBuilderClass(name);
+            }
+            case INTERFACE: {
+                return generateForInterface(name);
+            }
+            case BUILDER_INTERFACE: {
+                return generateForBuilderInterface(name);
+            }
+            case PACKAGE_INFO: {
+                return generateForPackage(name, isList);
+            }
+            case GETTER_METHOD: {
+                return generateForGetters(name, isList);
+            }
+            case TYPE_DEF_SETTER_METHOD: {
+                return generateForTypeDefSetter(name);
+            }
+            case SETTER_METHOD: {
+                return generateForSetters(name, isList);
+            }
+            case MANAGER_SETTER_METHOD: {
+                return generateForManagerSetters(name, isList);
+            }
+            case OF_METHOD: {
+                return generateForOf(name);
+            }
+            case DEFAULT_CONSTRUCTOR: {
+                return generateForDefaultConstructors(name);
+            }
+            case BUILD_METHOD: {
+                return generateForBuild(name);
+            }
+            case TYPE_CONSTRUCTOR: {
+                return generateForTypeConstructor(name);
+            }
+            case FROM_METHOD: {
+                return generateForFromString(name);
+            }
+            case ENUM_CLASS: {
+                return generateForEnum(name);
+            }
+            case ENUM_ATTRIBUTE: {
+                return generateForEnumAttr(name);
+            }
+            case RPC_INTERFACE: {
+               return generateForRpcService(name);
+            }
+            case RPC_MANAGER: {
+               return generateForClass(name);
+            }
+            case EVENT: {
+                return generateForEvent(name);
+            }
+            case EVENT_LISTENER: {
+                return generateForEventListener(name);
+            }
+            case EVENT_SUBJECT_CLASS: {
+                return generateForClass(name);
+            }
+            default: {
+                return generateForConstructors(name);
+            }
+        }
+    }
+
+    /**
+     * Generates javaDocs for enum's attributes.
+     *
+     * @param name attribute name
+     * @return javaDocs
+     */
+    private static String generateForEnumAttr(String name) {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + ENUM_ATTRIBUTE_JAVADOC
+                + name + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for rpc method.
+     *
+     * @param rpcName name of the rpc
+     * @param inputName name of input
+     * @param outputName name of output
+     * @param pluginConfig plugin configurations
+     * @return javaDocs of rpc method
+     */
+    public static String generateJavaDocForRpc(String rpcName, String inputName, String outputName,
+            YangPluginConfig pluginConfig) {
+        rpcName = getCamelCase(rpcName, pluginConfig.getConflictResolver());
+
+        String javadoc =
+                NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_RPC
+                        + rpcName + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK;
+        if (!inputName.equals(EMPTY_STRING)) {
+            javadoc = javadoc + getInputString(inputName, rpcName);
+        }
+        if (!outputName.equals(VOID)) {
+            javadoc = javadoc + getOutputString(outputName, rpcName);
+        }
+        return javadoc + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Returns output string of rpc.
+     *
+     * @param outputName name of output
+     * @param rpcName name of rpc
+     * @return javaDocs for output string of rpc
+     */
+    private static String getOutputString(String outputName, String rpcName) {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + outputName + SPACE + RPC_OUTPUT_STRING + rpcName + NEW_LINE;
+    }
+
+    /**
+     * Returns input string of rpc.
+     *
+     * @param inputName name of input
+     * @param rpcName name of rpc
+     * @return javaDocs for input string of rpc
+     */
+    private static String getInputString(String inputName, String rpcName) {
+        if (inputName.equals("")) {
+            return null;
+        } else {
+            return FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + inputName + SPACE + RPC_INPUT_STRING + rpcName + NEW_LINE;
+        }
+    }
+
+    /**
+     * Generates javaDoc for the interface.
+     *
+     * @param interfaceName interface name
+     * @return javaDocs
+     */
+    private static String generateForRpcService(String interfaceName) {
+        return NEW_LINE + JAVA_DOC_FIRST_LINE + INTERFACE_JAVA_DOC + interfaceName + PERIOD + NEW_LINE
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDoc for the event.
+     *
+     * @param eventClassName event class name
+     * @return javaDocs
+     */
+    private static String generateForEvent(String eventClassName) {
+        return NEW_LINE + JAVA_DOC_FIRST_LINE + EVENT_JAVA_DOC + eventClassName + PERIOD + NEW_LINE
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDoc for the event listener.
+     *
+     * @param eventListenerInterfaceName event class name
+     * @return javaDocs
+     */
+    private static String generateForEventListener(String eventListenerInterfaceName) {
+        return NEW_LINE + JAVA_DOC_FIRST_LINE + EVENT_LISTENER_JAVA_DOC + eventListenerInterfaceName
+                + PERIOD + NEW_LINE + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for getter method.
+     *
+     * @param attribute attribute
+     * @param isList is list attribute
+     * @return javaDocs
+     */
+    private static String generateForGetters(String attribute, boolean isList) {
+
+        String getter = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_GETTERS + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN;
+        if (isList) {
+            String listAttribute = LIST.toLowerCase() + SPACE + OF + SPACE;
+            getter = getter + listAttribute;
+        } else {
+            getter = getter + VALUE + SPACE + OF + SPACE;
+        }
+
+        getter = getter + attribute + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+        return getter;
+    }
+
+    /**
+     * Generates javaDocs for setter method.
+     *
+     * @param attribute attribute
+     * @param isList is list attribute
+     * @return javaDocs
+     */
+    private static String generateForSetters(String attribute, boolean isList) {
+
+        String setter = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_SETTERS + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + attribute + SPACE;
+        if (isList) {
+            String listAttribute = LIST.toLowerCase() + SPACE + OF + SPACE;
+            setter = setter + listAttribute;
+        } else {
+            setter = setter + VALUE + SPACE + OF + SPACE;
+        }
+        setter = setter + attribute + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + BUILDER_OBJECT
+                + attribute
+                + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+        return setter;
+    }
+
+    /**
+     * Generates javaDocs for setter method.
+     *
+     * @param attribute attribute
+     * @param isList is list attribute
+     * @return javaDocs
+     */
+    private static String generateForManagerSetters(String attribute, boolean isList) {
+
+        String setter = NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_MANAGER_SETTERS + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + attribute + SPACE;
+        if (isList) {
+            String listAttribute = LIST.toLowerCase() + SPACE + OF + SPACE;
+            setter = setter + listAttribute;
+        } else {
+            setter = setter + VALUE + SPACE + OF + SPACE;
+        }
+        setter = setter + attribute
+                + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+        return setter;
+    }
+
+    /**
+     * Generates javaDocs for of method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    private static String generateForOf(String attribute) {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_OF
+                + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + OBJECT + SPACE + OF + SPACE + attribute + NEW_LINE
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for from method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    private static String generateForFromString(String attribute) {
+
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_OF
+                + attribute + SPACE + FROM_STRING_METHOD_NAME + SPACE + INPUT + SPACE + STRING_DATA_TYPE + PERIOD
+                + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM
+                + FROM_STRING_PARAM_NAME + SPACE + INPUT + SPACE + STRING_DATA_TYPE + NEW_LINE
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_RETURN + OBJECT + SPACE + OF + SPACE + attribute + NEW_LINE
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for typedef setter method.
+     *
+     * @param attribute attribute
+     * @return javaDocs
+     */
+    private static String generateForTypeDefSetter(String attribute) {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_SETTERS_COMMON + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute
+                + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for the impl class.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForClass(String className) {
+        return NEW_LINE + JAVA_DOC_FIRST_LINE + IMPL_CLASS_JAVA_DOC + className + PERIOD + NEW_LINE + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for enum.
+     *
+     * @param className enum class name
+     * @return javaDocs
+     */
+    private static String generateForEnum(String className) {
+        return NEW_LINE + NEW_LINE + JAVA_DOC_FIRST_LINE + ENUM_CLASS_JAVADOC + className + PERIOD + NEW_LINE
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for the builder class.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForBuilderClass(String className) {
+        return NEW_LINE + JAVA_DOC_FIRST_LINE + BUILDER_CLASS_JAVA_DOC + className + PERIOD + NEW_LINE
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDoc for the interface.
+     *
+     * @param interfaceName interface name
+     * @return javaDocs
+     */
+    private static String generateForInterface(String interfaceName) {
+        return NEW_LINE + JAVA_DOC_FIRST_LINE + INTERFACE_JAVA_DOC + interfaceName + PERIOD + NEW_LINE
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDoc for the builder interface.
+     *
+     * @param builderforName builder for name
+     * @return javaDocs
+     */
+    private static String generateForBuilderInterface(String builderforName) {
+        return JAVA_DOC_FIRST_LINE + BUILDER_INTERFACE_JAVA_DOC + builderforName + PERIOD + NEW_LINE
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for package-info.
+     *
+     * @param packageName package name
+     * @param isChildNode is it child node
+     * @return javaDocs
+     */
+    private static String generateForPackage(String packageName, boolean isChildNode) {
+        String javaDoc = JAVA_DOC_FIRST_LINE + PACKAGE_INFO_JAVADOC + packageName;
+        if (isChildNode) {
+            javaDoc = javaDoc + PACKAGE_INFO_JAVADOC_OF_CHILD;
+        }
+        return javaDoc + PERIOD + NEW_LINE + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for default constructor.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForDefaultConstructors(String className) {
+        return FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_CONSTRUCTOR + className
+                + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for constructor with parameters.
+     *
+     * @param className class name
+     * @return javaDocs
+     */
+    private static String generateForConstructors(String className) {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_CONSTRUCTOR
+                + className + IMPL + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_PARAM + BUILDER.toLowerCase() + OBJECT + SPACE + BUILDER_OBJECT
+                + className + NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for build.
+     *
+     * @param buildName builder name
+     * @return javaDocs
+     */
+    private static String generateForBuild(String buildName) {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_BUILD
+                + buildName + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_RETURN + JAVA_DOC_BUILD_RETURN + buildName + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_END_LINE;
+    }
+
+    /**
+     * Generates javaDocs for type constructor.
+     *
+     * @param attribute attribute string
+     * @return javaDocs for type constructor
+     */
+    private static String generateForTypeConstructor(String attribute) {
+        return NEW_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_FIRST_LINE + FOUR_SPACE_INDENTATION + JAVA_DOC_CONSTRUCTOR
+                + attribute + PERIOD + NEW_LINE + FOUR_SPACE_INDENTATION + NEW_LINE_ASTERISK + FOUR_SPACE_INDENTATION
+                + JAVA_DOC_PARAM + VALUE + SPACE + VALUE + SPACE + OF + SPACE + attribute + NEW_LINE
+                + FOUR_SPACE_INDENTATION + JAVA_DOC_END_LINE;
+    }
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
new file mode 100644
index 0000000..ff2e3e7
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2016-present 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.File;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+/**
+ * Represents utility for searching the files in a directory.
+ */
+public final class YangFileScanner {
+
+    private static final String JAVA_FILE_EXTENTION = ".java";
+    private static final String YANG_FILE_EXTENTION = ".yang";
+
+    /**
+     * Creates an instance of YANG file scanner.
+     */
+    private YangFileScanner() {
+    }
+
+    /**
+     * Returns the list of java files.
+     *
+     * @param root specified directory
+     * @return list of java files
+     * @throws NullPointerException when no files are there.
+     * @throws IOException          when files get deleted while performing the
+     *                              operations
+     */
+    public static List<String> getJavaFiles(String root) throws IOException {
+
+        return getFiles(root, JAVA_FILE_EXTENTION);
+    }
+
+    /**
+     * Returns the list of YANG file.
+     *
+     * @param root specified directory
+     * @return list of YANG file information
+     * @throws NullPointerException when no files are there
+     * @throws IOException          when files get deleted while performing the
+     *                              operations
+     */
+    public static List<String> getYangFiles(String root) throws IOException {
+
+        return getFiles(root, YANG_FILE_EXTENTION);
+    }
+
+    /**
+     * Returns the list of required files.
+     *
+     * @param root      specified directory
+     * @param extension file extension
+     * @return list of required files
+     * @throws NullPointerException when no file is there
+     * @throws IOException          when files get deleted while performing the operations
+     */
+    public static List<String> getFiles(String root, String extension) throws IOException {
+
+        List<String> store = new LinkedList<>();
+        Stack<String> stack = new Stack<>();
+        stack.push(root);
+        File file;
+        File[] filelist;
+        try {
+            while (!stack.empty()) {
+                root = stack.pop();
+                file = new File(root);
+                filelist = file.listFiles();
+                if ((filelist == null) || (filelist.length == 0)) {
+                    continue;
+                }
+                for (File current : filelist) {
+                    if (current.isDirectory()) {
+                        stack.push(current.toString());
+                    } else {
+                        String yangFile = current.getCanonicalPath();
+                        if (yangFile.endsWith(extension)) {
+                            store.add(yangFile);
+                        }
+                    }
+                }
+            }
+            return store;
+        } catch (IOException e) {
+            throw new IOException("No File found of " + extension + " extension in " + root + " directory.");
+        }
+    }
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
new file mode 100644
index 0000000..05cd471
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
@@ -0,0 +1,673 @@
+/*
+ * Copyright 2016-present 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.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.Stack;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Pattern;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.plugin.manager.YangFileInfo;
+import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
+import org.slf4j.Logger;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getCamelCase;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getPackageDirPathFromJavaJPackage;
+import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
+import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
+import static org.onosproject.yangutils.utils.UtilConstants.HASH;
+import static org.onosproject.yangutils.utils.UtilConstants.HYPHEN;
+import static org.onosproject.yangutils.utils.UtilConstants.JAR;
+import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.OPEN_PARENTHESIS;
+import static org.onosproject.yangutils.utils.UtilConstants.ORG;
+import static org.onosproject.yangutils.utils.UtilConstants.PACKAGE;
+import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
+import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
+import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
+import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
+import static org.onosproject.yangutils.utils.UtilConstants.TEMP;
+import static org.onosproject.yangutils.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
+import static org.onosproject.yangutils.utils.UtilConstants.YANG_RESOURCES;
+import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.appendFileContents;
+import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.updateFileHandle;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.getJavaDoc;
+import static org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType.PACKAGE_INFO;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Represents common utility functionalities for code generation.
+ */
+public final class YangIoUtils {
+
+    private static final Logger log = getLogger(YangIoUtils.class);
+    private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH + YANG_RESOURCES + SLASH;
+    private static final int LINE_SIZE = 118;
+    private static final int SUB_LINE_SIZE = 112;
+    private static final int ZERO = 0;
+    private static final String SERIALIZED_FILE_EXTENSION = ".ser";
+
+    /**
+     * Creates an instance of YANG io utils.
+     */
+    private YangIoUtils() {
+    }
+
+    /**
+     * Creates the directory structure.
+     *
+     * @param path directory path
+     * @return directory structure
+     */
+    public static File createDirectories(String path) {
+        File generatedDir = new File(path);
+        generatedDir.mkdirs();
+        return generatedDir;
+    }
+
+    /**
+     * Adds package info file for the created directory.
+     *
+     * @param path         directory path
+     * @param classInfo    class info for the package
+     * @param pack         package of the directory
+     * @param isChildNode  is it a child node
+     * @param pluginConfig plugin configurations
+     * @throws IOException when fails to create package info file
+     */
+    public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode,
+            YangPluginConfig pluginConfig)
+            throws IOException {
+
+        pack = parsePkg(pack);
+
+        try {
+
+            File packageInfo = new File(path + SLASH + "package-info.java");
+            packageInfo.createNewFile();
+
+            FileWriter fileWriter = new FileWriter(packageInfo);
+            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+
+            bufferedWriter.write(CopyrightHeader.getCopyrightHeader());
+            bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig));
+            String pkg = PACKAGE + SPACE + pack + SEMI_COLAN;
+            if (pkg.length() > LINE_SIZE) {
+                pkg = whenDelimiterIsPersent(pkg, LINE_SIZE);
+            }
+            bufferedWriter.write(pkg);
+            bufferedWriter.close();
+            fileWriter.close();
+        } catch (IOException e) {
+            throw new IOException("Exception occured while creating package info file.");
+        }
+    }
+
+    /**
+     * Parses package and returns updated package.
+     *
+     * @param pack package needs to be updated
+     * @return updated package
+     */
+    public static String parsePkg(String pack) {
+
+        if (pack.contains(ORG)) {
+            String[] strArray = pack.split(ORG);
+            if (strArray.length >= 3) {
+                for (int i = 1; i < strArray.length; i++) {
+                    if (i == 1) {
+                        pack = ORG + strArray[1];
+                    } else {
+                        pack = pack + ORG + strArray[i];
+                    }
+                }
+            } else {
+                pack = ORG + strArray[1];
+            }
+        }
+
+        return pack;
+    }
+
+    /**
+     * Cleans the generated directory if already exist in source folder.
+     *
+     * @param dir generated directory in previous build
+     * @throws IOException when failed to delete directory
+     */
+    public static void deleteDirectory(String dir)
+            throws IOException {
+        File generatedDirectory = new File(dir);
+        if (generatedDirectory.exists()) {
+            try {
+                FileUtils.deleteDirectory(generatedDirectory);
+            } catch (IOException e) {
+                throw new IOException(
+                        "Failed to delete the generated files in " + generatedDirectory + " directory");
+            }
+        }
+    }
+
+    /**
+     * Searches and deletes generated temporary directories.
+     *
+     * @param root root directory
+     * @throws IOException when fails to do IO operations.
+     */
+    public static void searchAndDeleteTempDir(String root)
+            throws IOException {
+        List<File> store = new LinkedList<>();
+        Stack<String> stack = new Stack<>();
+        stack.push(root);
+
+        while (!stack.empty()) {
+            root = stack.pop();
+            File file = new File(root);
+            File[] filelist = file.listFiles();
+            if (filelist == null || filelist.length == 0) {
+                continue;
+            }
+            for (File current : filelist) {
+                if (current.isDirectory()) {
+                    stack.push(current.toString());
+                    if (current.getName().endsWith("-Temp")) {
+                        store.add(current);
+                    }
+                }
+            }
+        }
+
+        for (File dir : store) {
+            FileUtils.deleteDirectory(dir);
+        }
+    }
+
+    /**
+     * Adds generated source directory to the compilation root.
+     *
+     * @param source  directory
+     * @param project current maven project
+     * @param context current build context
+     */
+    public static void addToCompilationRoot(String source, MavenProject project, BuildContext context) {
+        project.addCompileSourceRoot(source);
+        context.refresh(project.getBasedir());
+        log.info("Source directory added to compilation root: " + source);
+    }
+
+    /**
+     * Removes extra char from the string.
+     *
+     * @param valueString    string to be trimmed
+     * @param removealStirng extra chars
+     * @return new string
+     */
+    public static String trimAtLast(String valueString, String removealStirng) {
+        StringBuilder stringBuilder = new StringBuilder(valueString);
+        int index = valueString.lastIndexOf(removealStirng);
+        stringBuilder.deleteCharAt(index);
+        return stringBuilder.toString();
+    }
+
+    /**
+     * Returns new parted string.
+     *
+     * @param partString string to be parted
+     * @return parted string
+     */
+    public static String partString(String partString) {
+        String[] strArray = partString.split(COMMA);
+        String newString = EMPTY_STRING;
+        for (int i = 0; i < strArray.length; i++) {
+            if (i % 4 != 0 || i == 0) {
+                newString = newString + strArray[i] + COMMA;
+            } else {
+                newString = newString + NEW_LINE + TWELVE_SPACE_INDENTATION
+                        + strArray[i] + COMMA;
+            }
+        }
+        return trimAtLast(newString, COMMA);
+    }
+
+    /**
+     * Returns the directory path of the package in canonical form.
+     *
+     * @param baseCodeGenPath base path where the generated files needs to be
+     *                        put
+     * @param pathOfJavaPkg   java package of the file being generated
+     * @return absolute path of the package in canonical form
+     */
+    public static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg) {
+
+        if (pathOfJavaPkg.charAt(pathOfJavaPkg.length() - 1) == File.separatorChar) {
+            pathOfJavaPkg = trimAtLast(pathOfJavaPkg, SLASH);
+        }
+        String[] strArray = pathOfJavaPkg.split(SLASH);
+        if (strArray[0].equals(EMPTY_STRING)) {
+            return pathOfJavaPkg;
+        } else {
+            return baseCodeGenPath + SLASH + pathOfJavaPkg;
+        }
+    }
+
+    /**
+     * Returns the absolute path of the package in canonical form.
+     *
+     * @param baseCodeGenPath base path where the generated files needs to be
+     *                        put
+     * @param pathOfJavaPkg   java package of the file being generated
+     * @return absolute path of the package in canonical form
+     */
+    public static String getAbsolutePackagePath(String baseCodeGenPath, String pathOfJavaPkg) {
+        return baseCodeGenPath + pathOfJavaPkg;
+    }
+
+    /**
+     * Copies YANG files to the current project's output directory.
+     *
+     * @param yangFileInfo list of YANG files
+     * @param outputDir    project's output directory
+     * @param project      maven project
+     * @throws IOException when fails to copy files to destination resource directory
+     */
+    public static void copyYangFilesToTarget(Set<YangFileInfo> yangFileInfo, String outputDir, MavenProject project)
+            throws IOException {
+
+        List<File> files = getListOfFile(yangFileInfo);
+
+        String path = outputDir + TARGET_RESOURCE_PATH;
+        File targetDir = new File(path);
+        targetDir.mkdirs();
+
+        for (File file : files) {
+            Files.copy(file.toPath(),
+                    new File(path + file.getName()).toPath(),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
+        addToProjectResource(outputDir + SLASH + TEMP + SLASH, project);
+    }
+
+    /**
+     * Provides a list of files from list of strings.
+     *
+     * @param yangFileInfo set of yang file information
+     * @return list of files
+     */
+    private static List<File> getListOfFile(Set<YangFileInfo> yangFileInfo) {
+        List<File> files = new ArrayList<>();
+        Iterator<YangFileInfo> yangFileIterator = yangFileInfo.iterator();
+        while (yangFileIterator.hasNext()) {
+            YangFileInfo yangFile = yangFileIterator.next();
+            if (yangFile.isForTranslator()) {
+                files.add(new File(yangFile.getYangFileName()));
+            }
+        }
+        return files;
+    }
+
+    /**
+     * Merges the temp java files to main java files.
+     *
+     * @param appendFile temp file
+     * @param srcFile    main file
+     * @throws IOException when fails to append contents
+     */
+    public static void mergeJavaFiles(File appendFile, File srcFile)
+            throws IOException {
+        try {
+            appendFileContents(appendFile, srcFile);
+        } catch (IOException e) {
+            throw new IOException("Failed to append " + appendFile + " in " + srcFile);
+        }
+    }
+
+    /**
+     * Inserts data in the generated file.
+     *
+     * @param file file in which need to be inserted
+     * @param data data which need to be inserted
+     * @throws IOException when fails to insert into file
+     */
+    public static void insertDataIntoJavaFile(File file, String data)
+            throws IOException {
+        try {
+            updateFileHandle(file, data, false);
+        } catch (IOException e) {
+            throw new IOException("Failed to insert in " + file + "file");
+        }
+    }
+
+    /**
+     * Validates a line size in given file whether it is having more then 120 characters.
+     * If yes it will update and give a new file.
+     *
+     * @param dataFile file in which need to verify all lines.
+     * @return updated file
+     * @throws IOException when fails to do IO operations.
+     */
+    public static File validateLineLength(File dataFile)
+            throws IOException {
+        File tempFile = dataFile;
+        FileReader fileReader = new FileReader(dataFile);
+        BufferedReader bufferReader = new BufferedReader(fileReader);
+        try {
+            StringBuilder stringBuilder = new StringBuilder();
+            String line = bufferReader.readLine();
+
+            while (line != null) {
+                if (line.length() > LINE_SIZE) {
+                    if (line.contains(PERIOD)) {
+                        line = whenDelimiterIsPersent(line, LINE_SIZE);
+                    } else if (line.contains(SPACE)) {
+                        line = whenSpaceIsPresent(line, LINE_SIZE);
+                    }
+                    stringBuilder.append(line);
+                } else {
+                    stringBuilder.append(line + NEW_LINE);
+                }
+                line = bufferReader.readLine();
+            }
+            FileWriter writer = new FileWriter(tempFile);
+            writer.write(stringBuilder.toString());
+            writer.close();
+            return tempFile;
+        } finally {
+            fileReader.close();
+            bufferReader.close();
+        }
+    }
+
+    /* When delimiters are present in the given line. */
+    private static String whenDelimiterIsPersent(String line, int lineSize) {
+        StringBuilder stringBuilder = new StringBuilder();
+
+        if (line.length() > lineSize) {
+            String[] strArray = line.split(Pattern.quote(PERIOD));
+            stringBuilder = updateString(strArray, stringBuilder, PERIOD, lineSize);
+        } else {
+            stringBuilder.append(line + NEW_LINE);
+        }
+        String[] strArray = stringBuilder.toString().split(NEW_LINE);
+        StringBuilder tempBuilder = new StringBuilder();
+        for (String str : strArray) {
+            if (str.length() > SUB_LINE_SIZE) {
+                if (line.contains(PERIOD) && !line.contains(PERIOD + HASH + OPEN_PARENTHESIS)) {
+                    String[] strArr = str.split(Pattern.quote(PERIOD));
+                    tempBuilder = updateString(strArr, tempBuilder, PERIOD, SUB_LINE_SIZE);
+                } else if (str.contains(SPACE)) {
+                    tempBuilder.append(whenSpaceIsPresent(str, SUB_LINE_SIZE));
+                }
+            } else {
+                tempBuilder.append(str + NEW_LINE);
+            }
+        }
+        return tempBuilder.toString();
+
+    }
+
+    /* When spaces are present in the given line. */
+    private static String whenSpaceIsPresent(String line, int lineSize) {
+        StringBuilder stringBuilder = new StringBuilder();
+        if (line.length() > lineSize) {
+            String[] strArray = line.split(SPACE);
+            stringBuilder = updateString(strArray, stringBuilder, SPACE, lineSize);
+        } else {
+            stringBuilder.append(line + NEW_LINE);
+        }
+
+        String[] strArray = stringBuilder.toString().split(NEW_LINE);
+        StringBuilder tempBuilder = new StringBuilder();
+        for (String str : strArray) {
+            if (str.length() > SUB_LINE_SIZE) {
+                if (str.contains(SPACE)) {
+                    String[] strArr = str.split(SPACE);
+                    tempBuilder = updateString(strArr, tempBuilder, SPACE, SUB_LINE_SIZE);
+                }
+            } else {
+                tempBuilder.append(str + NEW_LINE);
+            }
+        }
+        return tempBuilder.toString();
+    }
+
+    /* Updates the given line with the given size conditions. */
+    private static StringBuilder updateString(String[] strArray, StringBuilder stringBuilder, String string,
+            int lineSize) {
+
+        StringBuilder tempBuilder = new StringBuilder();
+        for (String str : strArray) {
+            tempBuilder.append(str + string);
+            if (tempBuilder.length() > lineSize) {
+                String tempString = stringBuilder.toString();
+                stringBuilder.delete(ZERO, stringBuilder.length());
+                tempString = trimAtLast(tempString, string);
+                stringBuilder.append(tempString);
+                if (string.equals(PERIOD)) {
+                    stringBuilder.append(NEW_LINE + TWELVE_SPACE_INDENTATION + PERIOD + str + string);
+                } else {
+                    stringBuilder.append(NEW_LINE + TWELVE_SPACE_INDENTATION + str + string);
+                }
+                tempBuilder.delete(ZERO, tempBuilder.length());
+                tempBuilder.append(TWELVE_SPACE_INDENTATION);
+            } else {
+                stringBuilder.append(str + string);
+            }
+        }
+        String tempString = stringBuilder.toString();
+        tempString = trimAtLast(tempString, string);
+        stringBuilder.delete(ZERO, stringBuilder.length());
+        stringBuilder.append(tempString + NEW_LINE);
+        return stringBuilder;
+    }
+
+    /**
+     * Serializes data-model.
+     *
+     * @param directory base directory for serialized files
+     * @param fileInfoSet YANG file info set
+     * @param project maven project
+     * @param operation true if need to add to resource
+     * @throws IOException when fails to do IO operations
+     */
+    public static void serializeDataModel(String directory, Set<YangFileInfo> fileInfoSet,
+            MavenProject project, boolean operation) throws IOException {
+
+        String serFileDirPath = directory + TARGET_RESOURCE_PATH;
+        File dir = new File(serFileDirPath);
+        dir.mkdirs();
+
+        if (operation) {
+            addToProjectResource(directory + SLASH + TEMP + SLASH, project);
+        }
+
+        for (YangFileInfo fileInfo : fileInfoSet) {
+
+            String serFileName = serFileDirPath + getCamelCase(fileInfo.getRootNode().getName(), null)
+                    + SERIALIZED_FILE_EXTENSION;
+            fileInfo.setSerializedFile(serFileName);
+            FileOutputStream fileOutputStream = new FileOutputStream(serFileName);
+            ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
+            objectOutputStream.writeObject(fileInfo.getRootNode());
+            objectOutputStream.close();
+            fileOutputStream.close();
+        }
+    }
+
+    /* Adds directory to resources of project */
+    private static void addToProjectResource(String dir, MavenProject project) {
+        Resource rsc = new Resource();
+        rsc.setDirectory(dir);
+        project.addResource(rsc);
+    }
+
+    /**
+     * Returns de-serializes YANG data-model nodes.
+     *
+     * @param serailizedfileInfoSet YANG file info set
+     * @return de-serializes YANG data-model nodes
+     * @throws IOException when fails do IO operations
+     */
+    public static List<YangNode> deSerializeDataModel(List<String> serailizedfileInfoSet) throws IOException {
+
+        List<YangNode> nodes = new ArrayList<>();
+        for (String fileInfo : serailizedfileInfoSet) {
+            YangNode node = null;
+            try {
+                FileInputStream fileInputStream = new FileInputStream(fileInfo);
+                ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
+                node = (YangNode) objectInputStream.readObject();
+                nodes.add(node);
+                objectInputStream.close();
+                fileInputStream.close();
+            } catch (IOException | ClassNotFoundException e) {
+                throw new IOException(fileInfo + " not found.");
+            }
+        }
+        return nodes;
+    }
+
+    /**
+     * Resolves inter jar dependencies.
+     *
+     * @param project current maven project
+     * @param localRepository local maven repository
+     * @param remoteRepos list of remote repository
+     * @param directory directory for serialized files
+     * @return list of resolved datamodel nodes
+     * @throws IOException when fails to do IO operations
+     */
+    public static List<YangNode> resolveInterJarDependencies(MavenProject project, ArtifactRepository localRepository,
+            List<ArtifactRepository> remoteRepos, String directory) throws IOException {
+
+        List<String> dependeciesJarPaths = resolveDependecyJarPath(project, localRepository, remoteRepos);
+        List<YangNode> resolvedDataModelNodes = new ArrayList<>();
+        for (String dependecy : dependeciesJarPaths) {
+            resolvedDataModelNodes.addAll(deSerializeDataModel(parseJarFile(dependecy, directory)));
+        }
+        return resolvedDataModelNodes;
+    }
+
+    /**
+     * Returns list of jar path.
+     *
+     * @return list of jar paths
+     */
+    private static List<String> resolveDependecyJarPath(MavenProject project, ArtifactRepository localRepository,
+            List<ArtifactRepository> remoteRepos) {
+
+        StringBuilder path = new StringBuilder();
+        List<String> jarPaths = new ArrayList<>();
+        for (Dependency dependency : project.getDependencies()) {
+
+            path.append(localRepository.getBasedir());
+            path.append(SLASH);
+            path.append(getPackageDirPathFromJavaJPackage(dependency.getGroupId()));
+            path.append(SLASH);
+            path.append(dependency.getArtifactId());
+            path.append(SLASH);
+            path.append(dependency.getVersion());
+            path.append(SLASH);
+            path.append(dependency.getArtifactId() + HYPHEN + dependency.getVersion() + PERIOD + JAR);
+            File jarFile = new File(path.toString());
+            if (jarFile.exists()) {
+                jarPaths.add(path.toString());
+            }
+            path.delete(0, path.length());
+        }
+
+        for (ArtifactRepository repo : remoteRepos) {
+            // TODO: add resolver for remote repo.
+        }
+        return jarPaths;
+    }
+
+    /**
+     * Parses jar file and returns list of serialized file names.
+     *
+     * @param jarFile jar file to be parsed
+     * @param directory directory for keeping the searized files
+     * @return list of serialized files
+     * @throws IOException when fails to do IO operations
+     */
+    public static List<String> parseJarFile(String jarFile, String directory)
+            throws IOException {
+
+        List<String> serailizedFiles = new ArrayList<>();
+        JarFile jar = new JarFile(jarFile);
+        Enumeration<?> enumEntries = jar.entries();
+
+        File serializedFileDir = new File(directory);
+        serializedFileDir.mkdirs();
+        while (enumEntries.hasMoreElements()) {
+            JarEntry file = (JarEntry) enumEntries.nextElement();
+            if (file.getName().endsWith(SERIALIZED_FILE_EXTENSION)) {
+                if (file.getName().contains(SLASH)) {
+                    String[] strArray = file.getName().split(SLASH);
+                    String tempPath = "";
+                    for (int i = 0; i < strArray.length - 1; i++) {
+                        tempPath = SLASH + tempPath + SLASH + strArray[i];
+                    }
+                    File dir = new File(directory + tempPath);
+                    dir.mkdirs();
+                }
+                File serailizedFile = new File(directory + SLASH + file.getName());
+                if (file.isDirectory()) {
+                    serailizedFile.mkdirs();
+                    continue;
+                }
+                InputStream inputStream = jar.getInputStream(file);
+
+                FileOutputStream fileOutputStream = new FileOutputStream(serailizedFile);
+                while (inputStream.available() > 0) {
+                    fileOutputStream.write(inputStream.read());
+                }
+                fileOutputStream.close();
+                inputStream.close();
+                serailizedFiles.add(serailizedFile.toString());
+            }
+        }
+        jar.close();
+        return serailizedFiles;
+    }
+
+}
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java
new file mode 100644
index 0000000..a128fa2
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * File system utilities implementation.
+ */
+package org.onosproject.yangutils.utils.io.impl;
diff --git a/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/package-info.java b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/package-info.java
new file mode 100644
index 0000000..856653e
--- /dev/null
+++ b/utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/utils/io/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present 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.
+ */
+
+/**
+ * File system utilities.
+ */
+package org.onosproject.yangutils.utils.io;