[ONOS-3906],[ONOS-3910] Implementation of YANG module and leaf/leaf-list translator.
Change-Id: If1a8a991ffafa14b51211f97c435176ee1bf856f
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 ca5da57..a9006d2 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
@@ -34,14 +34,39 @@
}
/**
- * Returns the list of yang files.
+ * Returns the list of YANG files.
*
* @param root specified directory
- * @return list of yang files.
- * @throws IOException when files get deleted while performing the operations.
+ * @return list of YANG files.
+ * @throws IOException when files get deleted while performing the
+ * operations.
*/
public static List<String> getYangFiles(String root) throws IOException {
+ return getFiles(root, ".yang");
+ }
+ /**
+ * Returns the list of java files.
+ *
+ * @param root specified directory
+ * @return list of java files.
+ * @throws IOException when files get deleted while performing the
+ * operations.
+ */
+ public static List<String> getJavaFiles(String root) throws IOException {
+ return getFiles(root, ".java");
+ }
+
+ /**
+ * Returns the list of required files.
+ *
+ * @param root specified directory
+ * @param extension file extension.
+ * @return list of required files.
+ * @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);
@@ -60,7 +85,7 @@
stack.push(current.toString());
} else {
String yangFile = current.getCanonicalPath();
- if (yangFile.endsWith(".yang")) {
+ if (yangFile.endsWith(extension)) {
store.add(yangFile);
}
}