Search in sources :

Example 1 with JarScanType

use of org.apache.tomcat.JarScanType in project tomee by apache.

the class TomEEJarScanner method doScan.

private void doScan(final JarScanType scanType, final JarScannerCallback callback, final Deque<URL> urls) {
    Method process = null;
    final boolean scanAllDirectories = isScanAllDirectories();
    for (final URL url : urls) {
        final File cpe = URLs.toFile(url);
        if ((cpe.getName().endsWith(".jar") || scanType == JarScanType.PLUGGABILITY || scanAllDirectories) && getJarScanFilter().check(scanType, cpe.getName())) {
            try {
                if (process == null) {
                    process = StandardJarScanner.class.getDeclaredMethod("process", JarScanType.class, JarScannerCallback.class, URL.class, String.class, boolean.class, Deque.class);
                    if (!process.isAccessible()) {
                        process.setAccessible(true);
                    }
                }
                process.invoke(this, scanType, callback, url, null, true, urls);
            } catch (final Exception ioe) {
            // no-op
            }
        }
    }
}
Also used : JarScannerCallback(org.apache.tomcat.JarScannerCallback) StandardJarScanner(org.apache.tomcat.util.scan.StandardJarScanner) Method(java.lang.reflect.Method) File(java.io.File) JarScanType(org.apache.tomcat.JarScanType) Deque(java.util.Deque) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Deque (java.util.Deque)1 JarScanType (org.apache.tomcat.JarScanType)1 JarScannerCallback (org.apache.tomcat.JarScannerCallback)1 StandardJarScanner (org.apache.tomcat.util.scan.StandardJarScanner)1