ST defect fixes and review comments fixes

Change-Id: Ib8c56a88c19cd9aa23918d0f9e37c89e74cb0d13
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index 30d4978..e094602 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -340,9 +340,11 @@
     /**
      * Prepare the information for java code generation corresponding to YANG
      * grouping info.
+     *
+     * @param codeGenDir code generation directory
      */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
 
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index b9da3c2..c49074a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -337,9 +337,11 @@
 
     /**
      * Generate the code corresponding to YANG case info.
+     *
+     * @param codeGenDir code generation directory
      */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
 
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index 440ca57..e9d7085 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -140,22 +140,11 @@
         super(YangNodeType.CHOICE_NODE);
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.onosproject.yangutils.datamodel.YangNode#getName()
-     */
     @Override
     public String getName() {
         return name;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
-     */
     @Override
     public void setName(String name) {
         this.name = name;
@@ -305,48 +294,24 @@
         // TODO auto-generated method stub, to be implemented by parser
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
-     */
     @Override
     public String getPackage() {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
-     */
     @Override
     public void setPackage(String pkg) {
         // TODO Auto-generated method stub
 
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry(
-     * )
-     */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
 
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
-     */
     @Override
     public void generateJavaCodeExit() {
         // TODO Auto-generated method stub
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index edd23b7..3a97571 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -16,18 +16,19 @@
 
 package org.onosproject.yangutils.datamodel;
 
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
 import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
 import org.onosproject.yangutils.parser.Parsable;
-import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 import org.onosproject.yangutils.translator.GeneratedFileType;
 import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
 import org.onosproject.yangutils.utils.UtilConstants;
+import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.utils.io.impl.FileSystemUtil;
 /*-
  * Reference RFC 6020.
@@ -476,20 +477,24 @@
     /**
      * Generate the java code corresponding to YANG container.
      *
-     * @throws IOException when fails to generate the source files
+     * @param codeGenDir code generation directory
+     * @throws IOException when fails to generate the source files.
      */
     @Override
-    public void generateJavaCodeEntry() throws IOException {
+    public void generateJavaCodeEntry(String codeGenDir) throws IOException {
         YangNode parent = getParent();
         String contPkg = JavaIdentifierSyntax.getPackageFromParent(parent.getPackage(), parent.getName());
+
+        contPkg = JavaIdentifierSyntax.getCamelCase(contPkg).toLowerCase();
         setPackage(contPkg);
 
         CachedFileHandle handle = null;
         try {
-            FileSystemUtil.createPackage(UtilConstants.YANG_GEN_DIR + getPackage(), getName());
+            FileSystemUtil.createPackage(codeGenDir + getPackage(), parent.getName() + UtilConstants.CHILDREN);
             handle = FileSystemUtil.createSourceFiles(getPackage(), getName(),
                     GeneratedFileType.GENERATE_INTERFACE_WITH_BUILDER);
-            handle.setRelativeFilePath(UtilConstants.YANG_GEN_DIR + getPackage().replace(".", "/"));
+            handle.setRelativeFilePath(getPackage().replace(".", "/"));
+            handle.setCodeGenFilePath(codeGenDir);
         } catch (IOException e) {
             throw new IOException("Failed to create the source files.");
         }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
index 9d87ee4..7574817 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -299,9 +299,11 @@
 
     /**
      * Generate the code for YANG grouping.
+     *
+     * @param codeGenDir code generated directory.
      */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
 
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index 4903034..9f0fabd 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -622,9 +622,11 @@
     /**
      * Populate the cached handle with information about the list attributes to
      * generate java code.
+     *
+     * @param codeGenDir code generated directory
      */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
 
     }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index 95bee5f..69b0376 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -15,21 +15,21 @@
  */
 package org.onosproject.yangutils.datamodel;
 
-import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.translator.CachedFileHandle;
 import org.onosproject.yangutils.translator.CodeGenerator;
 import org.onosproject.yangutils.translator.GeneratedFileType;
 import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
-import org.onosproject.yangutils.utils.UtilConstants;
 import org.onosproject.yangutils.utils.YangConstructType;
 import org.onosproject.yangutils.utils.io.impl.FileSystemUtil;
 
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-
 /*-
  * Reference:RFC 6020.
  * The "module" statement defines the module's name,
@@ -211,7 +211,7 @@
     /**
      * Get name of the module.
      *
-     * @return module name.
+     * @return module name
      */
     @Override
     public String getName() {
@@ -221,7 +221,7 @@
     /**
      * Set module name.
      *
-     * @param moduleName module name.
+     * @param moduleName module name
      */
     @Override
     public void setName(String moduleName) {
@@ -231,7 +231,7 @@
     /**
      * Get the contact details of the module owner.
      *
-     * @return the contact details of YANG owner.
+     * @return the contact details of YANG owner
      */
     public String getContact() {
         return contact;
@@ -240,7 +240,7 @@
     /**
      * Set the contact details of the module owner.
      *
-     * @param contact the contact details of YANG owner.
+     * @param contact the contact details of YANG owner
      */
     public void setContact(String contact) {
         this.contact = contact;
@@ -249,7 +249,7 @@
     /**
      * Get the description of module.
      *
-     * @return the description of YANG module.
+     * @return the description of YANG module
      */
     @Override
     public String getDescription() {
@@ -259,7 +259,7 @@
     /**
      * Set the description of module.
      *
-     * @param description set the description of YANG module.
+     * @param description set the description of YANG module
      */
     @Override
     public void setDescription(String description) {
@@ -269,7 +269,7 @@
     /**
      * Get the list of imported modules.
      *
-     * @return the list of imported modules.
+     * @return the list of imported modules
      */
     public List<YangImport> getImportList() {
         return importList;
@@ -278,7 +278,7 @@
     /**
      * prevent setting the import list from outside.
      *
-     * @param importList the import list to set.
+     * @param importList the import list to set
      */
     private void setImportList(List<YangImport> importList) {
         this.importList = importList;
@@ -287,7 +287,7 @@
     /**
      * Add the imported module information to the import list.
      *
-     * @param importedModule module being imported.
+     * @param importedModule module being imported
      */
     public void addImportedInfo(YangImport importedModule) {
 
@@ -303,7 +303,7 @@
     /**
      * Get the list of included sub modules.
      *
-     * @return the included list of sub modules.
+     * @return the included list of sub modules
      */
     public List<YangInclude> getIncludeList() {
         return includeList;
@@ -312,7 +312,7 @@
     /**
      * Set the list of included sub modules.
      *
-     * @param includeList the included list to set.
+     * @param includeList the included list to set
      */
     private void setIncludeList(List<YangInclude> includeList) {
         this.includeList = includeList;
@@ -321,7 +321,7 @@
     /**
      * Add the included sub module information to the include list.
      *
-     * @param includeModule submodule being included.
+     * @param includeModule submodule being included
      */
     public void addIncludedInfo(YangInclude includeModule) {
 
@@ -336,7 +336,7 @@
     /**
      * Get the list of leaves in module.
      *
-     * @return the list of leaves.
+     * @return the list of leaves
      */
     @Override
     public List<YangLeaf> getListOfLeaf() {
@@ -346,7 +346,7 @@
     /**
      * Set the list of leaf in module.
      *
-     * @param leafsList the list of leaf to set.
+     * @param leafsList the list of leaf to set
      */
     private void setListOfLeaf(List<YangLeaf> leafsList) {
         listOfLeaf = leafsList;
@@ -355,7 +355,7 @@
     /**
      * Add a leaf in module.
      *
-     * @param leaf the leaf to be added.
+     * @param leaf the leaf to be added
      */
     @Override
     public void addLeaf(YangLeaf leaf) {
@@ -369,7 +369,7 @@
     /**
      * Get the list of leaf-list from module.
      *
-     * @return the list of leaf-list.
+     * @return the list of leaf-list
      */
     @Override
     public List<YangLeafList> getListOfLeafList() {
@@ -379,7 +379,7 @@
     /**
      * Set the list of leaf-list in module.
      *
-     * @param listOfLeafList the list of leaf-list to set.
+     * @param listOfLeafList the list of leaf-list to set
      */
     private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
         this.listOfLeafList = listOfLeafList;
@@ -388,7 +388,7 @@
     /**
      * Add a leaf-list in module.
      *
-     * @param leafList the leaf-list to be added.
+     * @param leafList the leaf-list to be added
      */
     @Override
     public void addLeafList(YangLeafList leafList) {
@@ -402,7 +402,7 @@
     /**
      * Get the name space of module elements.
      *
-     * @return the nameSpace.
+     * @return the nameSpace
      */
     public YangNameSpace getNameSpace() {
         return nameSpace;
@@ -411,7 +411,7 @@
     /**
      * Set the name space of module elements.
      *
-     * @param nameSpace the nameSpace to set.
+     * @param nameSpace the nameSpace to set
      */
     public void setNameSpace(YangNameSpace nameSpace) {
         this.nameSpace = nameSpace;
@@ -420,7 +420,7 @@
     /**
      * Get the modules organization.
      *
-     * @return the organization.
+     * @return the organization
      */
     public String getOrganization() {
         return organization;
@@ -429,7 +429,7 @@
     /**
      * Set the modules organization.
      *
-     * @param org the organization to set.
+     * @param org the organization to set
      */
     public void setOrganization(String org) {
         organization = org;
@@ -447,7 +447,7 @@
     /**
      * Set the prefix.
      *
-     * @param prefix the prefix to set.
+     * @param prefix the prefix to set
      */
     public void setPrefix(String prefix) {
         this.prefix = prefix;
@@ -456,7 +456,7 @@
     /**
      * Get the textual reference.
      *
-     * @return the reference.
+     * @return the reference
      */
     @Override
     public String getReference() {
@@ -466,7 +466,7 @@
     /**
      * Set the textual reference.
      *
-     * @param reference the reference to set.
+     * @param reference the reference to set
      */
     @Override
     public void setReference(String reference) {
@@ -476,7 +476,7 @@
     /**
      * Get the revision.
      *
-     * @return the revision.
+     * @return the revision
      */
     public YangRevision getRevision() {
         return revision;
@@ -485,7 +485,7 @@
     /**
      * Set the revision.
      *
-     * @param revision the revision to set.
+     * @param revision the revision to set
      */
     public void setRevision(YangRevision revision) {
         this.revision = revision;
@@ -494,7 +494,7 @@
     /**
      * Get the version.
      *
-     * @return the version.
+     * @return the version
      */
     public byte getVersion() {
         return version;
@@ -503,7 +503,7 @@
     /**
      * Set the version.
      *
-     * @param version the version to set.
+     * @param version the version to set
      */
     public void setVersion(byte version) {
         this.version = version;
@@ -558,7 +558,7 @@
     /**
      * Get the list of nested reference's which required resolution.
      *
-     * @return list of nested reference's which required resolution.
+     * @return list of nested reference's which required resolution
      */
     public List<YangNode> getNestedReferenceResoulutionList() {
         return nestedReferenceResoulutionList;
@@ -568,7 +568,7 @@
      * Set list of nested reference's which requires resolution.
      *
      * @param nestedReferenceResoulutionList list of nested reference's which
-     *            requires resolution.
+     *            requires resolution
      */
     private void setNestedReferenceResoulutionList(List<YangNode> nestedReferenceResoulutionList) {
         this.nestedReferenceResoulutionList = nestedReferenceResoulutionList;
@@ -577,7 +577,7 @@
     /**
      * Set list of nested reference's which requires resolution.
      *
-     * @param nestedReference nested reference which requires resolution.
+     * @param nestedReference nested reference which requires resolution
      */
     public void addToNestedReferenceResoulutionList(YangNode nestedReference) {
         if (getNestedReferenceResoulutionList() == null) {
@@ -589,7 +589,7 @@
     /**
      * Returns the type of the parsed data.
      *
-     * @return returns MODULE_DATA.
+     * @return returns MODULE_DATA
      */
     @Override
     public YangConstructType getYangConstructType() {
@@ -625,18 +625,21 @@
     /**
      * Generates java code for module.
      *
-     * @throws IOException when fails to generate the source files.
+     * @param codeGenDir code generation directory
+     * @throws IOException when fails to generate the source files
      */
     @Override
-    public void generateJavaCodeEntry() throws IOException {
+    public void generateJavaCodeEntry(String codeGenDir) throws IOException {
         String modPkg = JavaIdentifierSyntax.getRootPackage(getVersion(), getNameSpace().getUri(),
                 getRevision().getRevDate());
 
+        modPkg = JavaIdentifierSyntax.getCamelCase(modPkg);
         CachedFileHandle handle = null;
         try {
-            FileSystemUtil.createPackage(UtilConstants.YANG_GEN_DIR + modPkg, getName());
+            FileSystemUtil.createPackage(codeGenDir + modPkg, getName());
             handle = FileSystemUtil.createSourceFiles(modPkg, getName(),
                     GeneratedFileType.GENERATE_INTERFACE_WITH_BUILDER);
+            handle.setCodeGenFilePath(codeGenDir);
         } catch (IOException e) {
             throw new IOException("Failed to create the source files.");
         }
@@ -680,8 +683,8 @@
     /**
      * Add a type to resolve the nested references.
      *
-     * @param node grouping or typedef node which needs to be resolved.
-     * @throws DataModelException data model exception.
+     * @param node grouping or typedef node which needs to be resolved
+     * @throws DataModelException data model exception
      */
     public static void addToResolveList(YangNode node) throws DataModelException {
         /* get the module node to add maintain the list of nested reference */
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index f2e9119..971f512 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -470,9 +470,11 @@
 
     /**
      * Generates java code for sub-module.
+     *
+     * @param codeGenDir code generation directory.
      */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
     }
 
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
index 85db895..dd3e232 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
@@ -47,7 +47,7 @@
 /**
  * Maintains the data type information.
  *
- * @param <T> YANG data type info.
+ * @param <T> YANG data type info
  */
 public class YangType<T> implements Parsable {
 
@@ -57,6 +57,11 @@
     private String dataTypeName;
 
     /**
+     * Java package in which the Java type is defined.
+     */
+    private String javaPackage;
+
+    /**
      * YANG data type.
      */
     private YangDataTypes dataType;
@@ -93,6 +98,24 @@
     }
 
     /**
+     * Get the Java package where the type is defined.
+     *
+     * @return Java package where the type is defined
+     */
+    public String getJavaPackage() {
+        return javaPackage;
+    }
+
+    /**
+     * Set Java package where the type is defined.
+     *
+     * @param javaPackage Java package where the type is defined
+     */
+    public void setJavaPackage(String javaPackage) {
+        this.javaPackage = javaPackage;
+    }
+
+    /**
      * Get the type of data.
      *
      * @return the data type
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
index b1feb31..c8381d0 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -15,10 +15,16 @@
  */
 package org.onosproject.yangutils.datamodel;
 
+import java.io.IOException;
+
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.translator.CachedFileHandle;
+import org.onosproject.yangutils.translator.GeneratedFileType;
+import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
+import org.onosproject.yangutils.utils.UtilConstants;
 import org.onosproject.yangutils.utils.YangConstructType;
+import org.onosproject.yangutils.utils.io.impl.FileSystemUtil;
 
 /*-
  * Reference RFC 6020.
@@ -91,6 +97,11 @@
     private String pkg;
 
     /**
+     * Cached Java File Handle.
+     */
+    private CachedFileHandle fileHandle;
+
+    /**
      * Create a typedef node.
      */
     public YangTypeDef() {
@@ -298,20 +309,60 @@
 
     /**
      * Generate java code snippet corresponding to YANG typedef.
+     *
+     * @param codeGenDir code generation directory
+     * @throws IOException when fails to generate files for typedef
      */
     @Override
-    public void generateJavaCodeEntry() {
-        // TODO Auto-generated method stub
+    public void generateJavaCodeEntry(String codeGenDir) throws IOException {
 
+        YangNode parent = getParent();
+        String typeDefPkg = JavaIdentifierSyntax.getPackageFromParent(parent.getPackage(), parent.getName());
+
+        typeDefPkg = JavaIdentifierSyntax.getCamelCase(typeDefPkg).toLowerCase();
+        setPackage(typeDefPkg);
+
+        CachedFileHandle handle = null;
+        try {
+            FileSystemUtil.createPackage(codeGenDir + getPackage(), parent.getName() + UtilConstants.CHILDREN);
+            handle = FileSystemUtil.createSourceFiles(getPackage(), getName(),
+                    GeneratedFileType.GENERATE_TYPEDEF_CLASS);
+            handle.setRelativeFilePath(getPackage().replace(".", "/"));
+            handle.setCodeGenFilePath(codeGenDir);
+        } catch (IOException e) {
+            throw new IOException("Failed to create the source files.");
+        }
+        setFileHandle(handle);
+        addAttributeInfo();
+        addAttributeInParent();
+    }
+
+    /**
+     * Adds current node attribute to parent file.
+     */
+    private void addAttributeInParent() {
+        if (getParent() != null) {
+            getParent().getFileHandle().addAttributeInfo(null, getName(), false);
+        }
+    }
+
+    /**
+     * Adds attribute to file handle.
+     */
+    private void addAttributeInfo() {
+        getFileHandle().addAttributeInfo(getDerivedType().getDataTypeExtendedInfo().getBaseType(),
+                JavaIdentifierSyntax.getCamelCase(getName()), false);
     }
 
     /**
      * Free resource used for code generation of YANG typedef.
+     *
+     * @throws IOException when fails to generate files
      */
     @Override
-    public void generateJavaCodeExit() {
-        // TODO Auto-generated method stub
-
+    public void generateJavaCodeExit() throws IOException {
+        getFileHandle().close();
+        return;
     }
 
     /**
@@ -342,18 +393,16 @@
      */
     @Override
     public CachedFileHandle getFileHandle() {
-        // TODO Auto-generated method stub
-        return null;
+        return fileHandle;
     }
 
     /**
      * Set the file handle to be used used for code generation.
      *
-     * @param fileHandle cached file handle
+     * @param handle cached file handle
      */
     @Override
-    public void setFileHandle(CachedFileHandle fileHandle) {
-        // TODO Auto-generated method stub
-
+    public void setFileHandle(CachedFileHandle handle) {
+        fileHandle = handle;
     }
 }
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
index 5e6bee4..9086f9a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -213,54 +213,36 @@
         // TODO auto-generated method stub, to be implemented by parser
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.datamodel.YangNode#getName()
-     */
     @Override
     public String getName() {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
-     */
     @Override
     public void setName(String name) {
         // TODO Auto-generated method stub
 
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
-     */
     @Override
-    public void generateJavaCodeEntry() {
+    public void generateJavaCodeEntry(String codeGenDir) {
         // TODO Auto-generated method stub
 
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
-     */
     @Override
     public void generateJavaCodeExit() {
         // TODO Auto-generated method stub
 
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
-     */
     @Override
     public String getPackage() {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
-     */
     @Override
     public void setPackage(String pkg) {
         // TODO Auto-generated method stub