+
+ public static List<File> getClassPath(MavenProject project)
+ throws DependencyResolutionRequiredException {
+ List<File> dependencies = Lists.newArrayList();
+ try {
+ for (Object element : project.getCompileClasspathElements()) {
+ File asFile = new File((String) element);
+ if (isJar(asFile)) {
+ dependencies.add(asFile);
+ }
+ }
+ } catch (DependencyResolutionRequiredException e) {
+ throw e;
+ }
+ return dependencies;
+ }
+
+ private static final String JAR_SUFFIX = ".jar";
+
+ private static boolean isJar(File element) {
+ return (element.isFile() && element.getName().endsWith(JAR_SUFFIX)) ? true
+ : false;
+ }
+
+ public static Collection<File> getFilesFromClasspath(
+ List<File> jarsOnClasspath, List<String> classPathFilter)
+ throws ZipException, IOException {
+ List<File> yangs = Lists.newArrayList();
+
+ for (File file : jarsOnClasspath) {
+ ZipFile zip = new ZipFile(file);
+ Enumeration<? extends ZipEntry> entries = zip.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ if (entry.getName().endsWith(YANG_SUFFIX)) {
+ InputStream stream = zip.getInputStream(entry);
+ }
+ }
+ }
+
+ return yangs;
+ }
+
+ public static boolean acceptedFilter(String name, List<String> filter) {
+ for(String f : filter) {
+ if(name.endsWith(f)) {
+ return true;
+ }
+ }
+ return false;
+ }
+