public static void configure ( Properties props ) { Properties defaultProperties = new Properties ( ) ; HashMap < String , Properties > driversProps = new HashMap <> ( ) ; for ( Enumeration < ? > enumeration = props . propertyNames ( ) ; enumeration . hasMoreElements ( ) ; ) { String propertyName = ( String ) enumeration . nextElement ( ) ; String value = props . getProperty ( propertyName ) ; int idx = propertyName . lastIndexOf ( ' ' ) ; if ( idx < 0 ) { defaultProperties . put ( propertyName , value ) ; } else { String prefix = propertyName . substring ( 0 , idx ) ; String name = propertyName . substring ( idx + 1 ) ; Properties driverProperties = driversProps . get ( prefix ) ; if ( driverProperties == null ) { driverProperties = new Properties ( ) ; driversProps . put ( prefix , driverProperties ) ; } driverProperties . put ( name , value ) ; } } // Merge with default properties Map < String , Driver > newInstances = new HashMap <> ( ) ; for ( Entry < String , Properties > entry : driversProps . entrySet ( ) ) { String name = entry . getKey ( ) ; Properties properties = new Properties ( ) ; properties . putAll ( defaultProperties ) ; properties . putAll ( entry . getValue ( ) ) ; newInstances . put ( name , createDriver ( name , properties ) ) ; } if ( newInstances . get ( DEFAULT_INSTANCE_NAME ) == null && Parameters . REMOTE_URL_BASE . getValue ( defaultProperties ) != null ) { newInstances . put ( DEFAULT_INSTANCE_NAME , createDriver ( DEFAULT_INSTANCE_NAME , defaultProperties ) ) ; } instances = new IndexedInstances ( newInstances ) ; }
Loads all instances according to the properties parameter .