Search in sources :

Example 1 with JBossVFSv3ClassPathLocationScanner

use of org.flywaydb.core.internal.scanner.classpath.jboss.JBossVFSv3ClassPathLocationScanner in project flyway by flyway.

the class ClassPathScanner method createLocationScanner.

/**
 * Creates an appropriate location scanner for this url protocol.
 *
 * @param protocol The protocol of the location url to scan.
 * @return The location scanner or {@code null} if it could not be created.
 */
private ClassPathLocationScanner createLocationScanner(String protocol) {
    if (locationScannerCache.containsKey(protocol)) {
        return locationScannerCache.get(protocol);
    }
    if ("file".equals(protocol)) {
        FileSystemClassPathLocationScanner locationScanner = new FileSystemClassPathLocationScanner();
        locationScannerCache.put(protocol, locationScanner);
        resourceNameCache.put(locationScanner, new HashMap<>());
        return locationScanner;
    }
    if ("jar".equals(protocol) || isTomcat(protocol) || isWebLogic(protocol) || isWebSphere(protocol)) {
        String separator = isTomcat(protocol) ? "*/" : "!/";
        ClassPathLocationScanner locationScanner = new JarFileClassPathLocationScanner(separator);
        locationScannerCache.put(protocol, locationScanner);
        resourceNameCache.put(locationScanner, new HashMap<>());
        return locationScanner;
    }
    FeatureDetector featureDetector = new FeatureDetector(classLoader);
    if (featureDetector.isJBossVFSv3Available() && "vfs".equals(protocol)) {
        JBossVFSv3ClassPathLocationScanner locationScanner = new JBossVFSv3ClassPathLocationScanner();
        locationScannerCache.put(protocol, locationScanner);
        resourceNameCache.put(locationScanner, new HashMap<>());
        return locationScanner;
    }
    if (featureDetector.isOsgiFrameworkAvailable() && (isFelix(protocol) || isEquinox(protocol))) {
        OsgiClassPathLocationScanner locationScanner = new OsgiClassPathLocationScanner();
        locationScannerCache.put(protocol, locationScanner);
        resourceNameCache.put(locationScanner, new HashMap<>());
        return locationScanner;
    }
    return null;
}
Also used : JBossVFSv3ClassPathLocationScanner(org.flywaydb.core.internal.scanner.classpath.jboss.JBossVFSv3ClassPathLocationScanner) JBossVFSv3ClassPathLocationScanner(org.flywaydb.core.internal.scanner.classpath.jboss.JBossVFSv3ClassPathLocationScanner)

Aggregations

JBossVFSv3ClassPathLocationScanner (org.flywaydb.core.internal.scanner.classpath.jboss.JBossVFSv3ClassPathLocationScanner)1