public static Properties parseURL ( String url , Properties info ) { if ( ( url == null ) || ! url . toLowerCase ( ) . startsWith ( driverPrefix ) ) { return null ; // throws exception ?! } Properties props = new Properties ( info ) ; // take local copy of existing properties Enumeration < ? > en = info . propertyNames ( ) ; while ( en . hasMoreElements ( ) ) { String key = ( String ) en . nextElement ( ) ; String value = info . getProperty ( key ) ; if ( value != null ) { props . setProperty ( key . toUpperCase ( ) , value ) ; } } String tmp = url . substring ( driverPrefix . length ( ) ) ; String [ ] tokens = tmp . split ( ";" ) ; if ( tokens . length != 2 ) { return null ; // datasource missing } try { new URL ( tokens [ 0 ] ) ; } catch ( MalformedURLException e ) { return null ; // url invalid } props . setProperty ( SERVER_URL , tokens [ 0 ] ) ; props . setProperty ( DATASOURCE_PATH , tokens [ 1 ] ) ; return props ; }
Parse the driver URL and extract the properties .