use of org.flywaydb.core.internal.util.FeatureDetector 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;
}
use of org.flywaydb.core.internal.util.FeatureDetector in project flyway by flyway.
the class EnvInfoServlet method doGet.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String appserver;
if (Environment.runningOnGoogleAppEngine()) {
appserver = "Google AppEngine";
} else {
FeatureDetector featureDetector = new FeatureDetector(Thread.currentThread().getContextClassLoader());
if (featureDetector.isJBossVFSv2Available()) {
appserver = "JBoss 5";
} else if (featureDetector.isJBossVFSv3Available()) {
appserver = "JBoss 6+";
} else {
appserver = "Other";
}
}
String database = ((DriverDataSource) flyway.getDataSource()).getUrl();
PrintWriter writer = response.getWriter();
writer.print("{\"status\":\"OK\"," + " \"appserver\":\"" + appserver + "\"," + " \"database\":\"" + database + "\"}");
}
Aggregations