public UrlComparator(URL base) { this(URLs.toFile(base)); }
private static File file(URL jarUrl) { return URLs.toFile(jarUrl); } }
public UrlComparator(final URL base) { this(URLs.toFile(base)); }
public UrlComparator(final URL base) { this(URLs.toFile(base)); }
public static String toFilePath(final URL url) { return toFile(url).getAbsolutePath(); }
public static String toFilePath(URL url) { return toFile(url).getAbsolutePath(); } }
public static String toFilePath(final URL url) { return toFile(url).getAbsolutePath(); }
public static boolean isOwb(final URL url) { final String jar = URLs.toFile(url).getName(); return jar.startsWith("openwebbeans-jsf-") || jar.startsWith("openwebbeans-el22-"); }
@Override public boolean accept(final URL url) { try { final File file = URLs.toFile(url); return !excluded.accept(file.getName()); } catch (final IllegalArgumentException iae) { return true; } }
private String getWarPersistenceXml(final URL url) { final File dir = URLs.toFile(url); if (dir.isDirectory() && (dir.getAbsolutePath().endsWith("/WEB-INF/classes") || dir.getAbsolutePath().endsWith("/WEB-INF/classes/"))) { final File pXmlStd = new File(dir.getParentFile(), "persistence.xml"); if (pXmlStd.exists()) { return pXmlStd.getAbsolutePath(); } final File pXml = new File(dir, META_INF_PERSISTENCE_XML); if (pXml.exists()) { return pXml.getAbsolutePath(); } } return null; }
@Override public boolean accept(final URL url) { try { final File file = URLs.toFile(url); return !excluded.accept(file.getName()); } catch (final IllegalArgumentException iae) { return true; } }
public ArrayList<File> getModulesFromClassPath(final List<File> declaredApps, final ClassLoader classLoader) { final List<URL> classpathAppsUrls = DeploymentsResolver.loadFromClasspath(classLoader); final ArrayList<File> jarFiles = new ArrayList<File>(); for (final URL path : classpathAppsUrls) { final File file = URLs.toFile(path); if (declaredApps != null && declaredApps.contains(file)) { continue; } jarFiles.add(file); } return jarFiles; }
private String getWarPersistenceXml(final URL url) { final File dir = URLs.toFile(url); if (dir.isDirectory() && (dir.getAbsolutePath().endsWith("/WEB-INF/classes") || dir.getAbsolutePath().endsWith("/WEB-INF/classes/"))) { final File pXmlStd = new File(dir.getParentFile(), "persistence.xml"); if (pXmlStd.exists()) { return pXmlStd.getAbsolutePath(); } final File pXml = new File(dir, META_INF_PERSISTENCE_XML); if (pXml.exists()) { return pXml.getAbsolutePath(); } } return null; }
private boolean isIncludedIn(final String filePath, final File classAsFile) throws MalformedURLException { return isIncluded(URLs.toFile(new URL(filePath)), classAsFile); }
private int score(final URL url) { final File file = URLs.toFile(url); final List<String> filePath = path(file); int matches = 0; final ListIterator<String> a = rootPath.listIterator(); final ListIterator<String> b = filePath.listIterator(); while (a.hasNext() && b.hasNext()) { final String nameA = a.next(); final String nameB = b.next(); if (nameA.equals(nameB)) { matches++; } else { break; } } return matches; }
public void list(final URL[] urls) { fileByArchive.clear(); // for all archives list all files // all is sorted by the natural String order for (final URL archive : urls) { try { final File file = URLs.toFile(archive); final List<String> files = JarUtil.listFiles(file, CLASS_EXTENSION); Collections.sort(files); fileByArchive.put(file.getName(), files); } catch (final Exception e) { // ignored } } } }
public static File toFile(URL url) { if ("jar".equals(url.getProtocol())) { try { String spec = url.getFile(); int separator = spec.indexOf('!'); /* * REMIND: we don't handle nested JAR URLs */ if (separator == -1) throw new MalformedURLException("no ! found in jar url spec:" + spec); return toFile(new URL(spec.substring(0, separator++))); } catch (MalformedURLException e) { throw new IllegalStateException(e); } } else if ("file".equals(url.getProtocol())) { return new File(decode(url.getFile())); } else { throw new IllegalArgumentException("Unsupported URL scheme: " + url.toExternalForm()); } }
public void list(final URL[] urls) { fileByArchive.clear(); // for all archives list all files // all is sorted by the natural String order for (final URL archive : urls) { try { final File file = URLs.toFile(archive); final List<String> files = JarUtil.listFiles(file, CLASS_EXTENSION); Collections.sort(files); fileByArchive.put(file.getName(), files); } catch (final Exception e) { // ignored } } } }
public static boolean skip(final URL url, final Filter includeFilter, final Filter excludeFilter) { if ("archive".equals(url.getProtocol())) { return true; } try { final File file = URLs.toFile(url); final String name = NameFiltering.filter(file).getName(); if (skip(includeFilter, excludeFilter, name)) { return true; } } catch (final IllegalArgumentException iae) { // no-op } return false; }
public ArrayList<File> getModulesFromClassPath(final List<File> declaredApps, final ClassLoader classLoader) { final FileUtils base = SystemInstance.get().getBase(); final List<URL> classpathAppsUrls = new ArrayList<URL>(); DeploymentsResolver.loadFromClasspath(base, classpathAppsUrls, classLoader); final ArrayList<File> jarFiles = new ArrayList<File>(); for (final URL path : classpathAppsUrls) { final File file = URLs.toFile(path); if (declaredApps != null && declaredApps.contains(file)) { continue; } jarFiles.add(file); } return jarFiles; }