[ONOS-4350] Inter file linking implementation and inter-jar linking framework
Change-Id: I71a26ba3e0b9d17261e78a9313fe7f047195932e
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
index 7fa99b7..4a3f847 100644
--- a/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/YangFileScanner.java
@@ -21,7 +21,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
-import org.onosproject.yangutils.plugin.manager.YangFileInfo;
/**
* Represents utility for searching the files in a directory.
@@ -43,8 +42,8 @@
* @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
+ * @throws IOException when files get deleted while performing the
+ * operations
*/
public static List<String> getJavaFiles(String root) throws IOException {
@@ -52,33 +51,27 @@
}
/**
- * Returns the list of YANG file information.
+ * 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
+ * @throws IOException when files get deleted while performing the
+ * operations
*/
- public static List<YangFileInfo> getYangFiles(String root) throws IOException {
+ public static List<String> getYangFiles(String root) throws IOException {
List<String> yangFiles = getFiles(root, YANG_FILE_EXTENTION);
- List<YangFileInfo> fileInfo = new LinkedList<>();
- for (String yangFile : yangFiles) {
- YangFileInfo yangFileInfo = new YangFileInfo();
- yangFileInfo.setYangFileName(yangFile);
- fileInfo.add(yangFileInfo);
- }
- return fileInfo;
+ return yangFiles;
}
/**
* Returns the list of required files.
*
- * @param root specified directory
+ * @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
+ * @throws IOException when files get deleted while performing the operations
*/
public static List<String> getFiles(String root, String extension) throws IOException {
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
index d8f7e53..835b675 100644
--- a/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
@@ -23,18 +23,20 @@
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.Iterator;
import java.util.List;
+import java.util.LinkedList;
import java.util.Stack;
+import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.apache.maven.model.Resource;
import org.apache.maven.project.MavenProject;
+import org.onosproject.yangutils.plugin.manager.YangFileInfo;
+
import org.slf4j.Logger;
import org.sonatype.plexus.build.incremental.BuildContext;
-import org.onosproject.yangutils.plugin.manager.YangFileInfo;
import static org.onosproject.yangutils.utils.UtilConstants.COMMA;
import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
@@ -81,9 +83,9 @@
/**
* 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 path directory path
+ * @param classInfo class info for the package
+ * @param pack package of the directory
* @param isChildNode is it a child node
* @throws IOException when fails to create package info file
*/
@@ -167,7 +169,7 @@
/**
* Adds generated source directory to the compilation root.
*
- * @param source directory
+ * @param source directory
* @param project current maven project
* @param context current build context
*/
@@ -180,7 +182,7 @@
/**
* Removes extra char from the string.
*
- * @param valueString string to be trimmed
+ * @param valueString string to be trimmed
* @param removealStirng extra chars
* @return new string
*/
@@ -215,8 +217,8 @@
* 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
+ * 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) {
@@ -236,8 +238,8 @@
* 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
+ * 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) {
@@ -247,12 +249,12 @@
/**
* 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
+ * @param yangFileInfo set 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(List<YangFileInfo> yangFileInfo, String outputDir, MavenProject project)
+ public static void copyYangFilesToTarget(Set<YangFileInfo> yangFileInfo, String outputDir, MavenProject project)
throws IOException {
List<File> files = getListOfFile(yangFileInfo);
@@ -274,10 +276,10 @@
/**
* Provides a list of files from list of strings.
*
- * @param yangFileInfo list of yang file information
+ * @param yangFileInfo set of yang file information
* @return list of files
*/
- private static List<File> getListOfFile(List<YangFileInfo> yangFileInfo) {
+ private static List<File> getListOfFile(Set<YangFileInfo> yangFileInfo) {
List<File> files = new ArrayList<>();
Iterator<YangFileInfo> yangFileIterator = yangFileInfo.iterator();
while (yangFileIterator.hasNext()) {
@@ -291,7 +293,7 @@
* Merges the temp java files to main java files.
*
* @param appendFile temp file
- * @param srcFile main file
+ * @param srcFile main file
* @throws IOException when fails to append contents
*/
public static void mergeJavaFiles(File appendFile, File srcFile) throws IOException {