Search in sources :

Example 1 with JBossVFSv3ClassPathLocationScanner

use of org.flywaydb.core.internal.util.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<URL, Set<String>>());
        return locationScanner;
    }
    if ("jar".equals(protocol) || "war".equals(protocol) || //WebLogic
    "zip".equals(protocol) || //WebSphere
    "wsjar".equals(protocol)) {
        JarFileClassPathLocationScanner locationScanner = new JarFileClassPathLocationScanner();
        locationScannerCache.put(protocol, locationScanner);
        resourceNameCache.put(locationScanner, new HashMap<URL, Set<String>>());
        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<URL, Set<String>>());
        return locationScanner;
    }
    if (featureDetector.isOsgiFrameworkAvailable() && (// Felix
    "bundle".equals(protocol) || //Equinox
    "bundleresource".equals(protocol))) {
        OsgiClassPathLocationScanner locationScanner = new OsgiClassPathLocationScanner();
        locationScannerCache.put(protocol, locationScanner);
        resourceNameCache.put(locationScanner, new HashMap<URL, Set<String>>());
        return locationScanner;
    }
    return null;
}
Also used : TreeSet(java.util.TreeSet) Set(java.util.Set) JBossVFSv3ClassPathLocationScanner(org.flywaydb.core.internal.util.scanner.classpath.jboss.JBossVFSv3ClassPathLocationScanner) URL(java.net.URL) FeatureDetector(org.flywaydb.core.internal.util.FeatureDetector)

Aggregations

URL (java.net.URL)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 FeatureDetector (org.flywaydb.core.internal.util.FeatureDetector)1 JBossVFSv3ClassPathLocationScanner (org.flywaydb.core.internal.util.scanner.classpath.jboss.JBossVFSv3ClassPathLocationScanner)1