/** * Get jdbc database vendor names list. * @return set of common database vendor names */ public Set<String> getDatabaseVendorNames() { return driverLoader.getDatabaseVendorNames(); }
/** * Get jdbc driver implementation class names list for the dbVendor and * resource type supplied. * @param dbVendor * @param resType * @return all jdbc driver implementation class names */ public Set<String> getJdbcDriverClassNames(String dbVendor, String resType) { return driverLoader.getJdbcDriverClassNames(dbVendor, resType); }
implClass = processMetaInf(metaInf); if (implClass != null) { if (isLoaded(implClass, resType)) { if(isVendorSpecific(f, dbVendor, implClass, origDbVendor)) { implClassNames.add(implClass); implClass = getClassName(entry); if (implClass != null) { if (isLoaded(implClass, resType)) { if (isVendorSpecific(f, dbVendor, implClass, origDbVendor)) { implClassNames.add(implClass);
vendor = getEquivalentName(dbVendor); if (vendor == null) { vendor = dbVendor; String implClass = getImplClassNameFromMapping(dbVendor, resType); List<File> jarFileLocations = getJdbcDriverLocations(); Set<File> allJars = new HashSet<File>(); implClassNames = introspectAndLoadJar(file, resType, vendor, dbVendor);
private List<File> getJdbcDriverLocations() { List<File> jarFileLocations = new ArrayList<File>(); jarFileLocations.add(getLocation(SystemPropertyConstants.DERBY_ROOT_PROPERTY)); jarFileLocations.add(getLocation(SystemPropertyConstants.INSTALL_ROOT_PROPERTY)); jarFileLocations.add(getLocation(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY)); Vector extLibDirs = getLibExtDirs(); for(int i=0; i<extLibDirs.size(); i++) { jarFileLocations.add(new File( (String) extLibDirs.elementAt(i) )); } return jarFileLocations; }
private boolean isVendorSpecific(File f, String dbVendor, String className, String origDbVendor) { //File could be a jdbc jar file or a normal jar file boolean isVendorSpecific = false; if(origDbVendor != null) { if(origDbVendor.equalsIgnoreCase(DATABASE_VENDOR_EMBEDDED_DERBY)) { return className.toUpperCase(Locale.getDefault()).indexOf(DATABASE_VENDOR_EMBEDDED) != -1; } else if(origDbVendor.endsWith(DATABASE_VENDOR_30)) { return !(className.toUpperCase(Locale.getDefault()).endsWith(DATABASE_VENDOR_40)); } } String vendor = getVendorFromManifest(f); if (vendor == null) { //might have to do this part by going through the class names or some other method. //dbVendor might be used in this portion if (isVendorSpecific(dbVendor, className)) { isVendorSpecific = true; } } else { //Got from Manifest file. if (vendor.equalsIgnoreCase(dbVendor) || vendor.toUpperCase(Locale.getDefault()).indexOf( dbVendor.toUpperCase(Locale.getDefault())) != -1) { isVendorSpecific = true; } } return isVendorSpecific; }
/** * Returns a list of all driver class names that were loaded from the jar file. * @param f * @param dbVendor * @return Set of driver/datasource class implementations based on resType */ private Set<String> introspectAndLoadJar(File f, String resType, String dbVendor, String origDbVendor) { if(logger.isLoggable(Level.FINEST)) { logger.finest("DriverLoader : introspectAndLoadJar "); } return getImplClassesByIteration(f, resType, dbVendor, origDbVendor); }
public Set<String> getJdbcDriverClassNames(String dbVendor, String resType) { //Do not use introspection by default. return getJdbcDriverClassNames(dbVendor, resType, false); }
/** * Get jdbc driver implementation class names list for the dbVendor and * resource type supplied. If introspect is true, classnames are got from * introspection of the jdbc driver jar. Else a pre-defined list is used to * retrieve the class names. * @param dbVendor * @param resType * @param introspect * @return all jdbc driver implementation class names */ public Set<String> getJdbcDriverClassNames(String dbVendor, String resType, boolean introspect) { return driverLoader.getJdbcDriverClassNames(dbVendor, resType, introspect); }