public static DatabaseLiaison getLiaison ( String url ) { if ( url == null ) throw new NullPointerException ( "URL must not be null" ) ; // see if we already have a liaison mapped for this connection DatabaseLiaison liaison = _mappings . get ( url ) ; if ( liaison == null ) { // scan the list looking for a matching liaison for ( DatabaseLiaison candidate : _liaisons ) { if ( candidate . matchesURL ( url ) ) { liaison = candidate ; break ; } } // if we didn't find a matching liaison, use the default if ( liaison == null ) { log . warning ( "Unable to match liaison for database. Using default." , "url" , url ) ; liaison = new DefaultLiaison ( ) ; } // map this URL to this liaison _mappings . put ( url , liaison ) ; } return liaison ; }
Fetch the appropriate database liaison for the supplied URL which should be the same string that would be used to configure a connection to the database .