protected Catalog getCatalog ( String url , String user , String password , String infoLevelName , String bundledDriverName , Properties properties ) throws IOException { // Determine info level InfoLevel level = InfoLevel . valueOf ( infoLevelName . toLowerCase ( ) ) ; SchemaInfoLevel schemaInfoLevel = level . getSchemaInfoLevel ( ) ; // Set options for ( InfoLevelOption option : InfoLevelOption . values ( ) ) { String value = properties . getProperty ( option . getPropertyName ( ) ) ; if ( value != null ) { LOGGER . info ( "Setting option " + option . name ( ) + "=" + value ) ; option . set ( schemaInfoLevel , Boolean . valueOf ( value . toLowerCase ( ) ) ) ; } } SchemaCrawlerOptions options ; if ( bundledDriverName != null ) { options = getOptions ( bundledDriverName , level ) ; } else { options = new SchemaCrawlerOptions ( ) ; } options . setSchemaInfoLevel ( schemaInfoLevel ) ; LOGGER . debug ( "Scanning database schemas on '" + url + "' (user='" + user + "', info level='" + level . name ( ) + "')" ) ; Catalog catalog ; try ( Connection connection = DriverManager . getConnection ( url , user , password ) ) { catalog = SchemaCrawlerUtility . getCatalog ( connection , options ) ; } catch ( SQLException | SchemaCrawlerException e ) { throw new IOException ( String . format ( "Cannot scan schema (url='%s', user='%s'" , url , user ) , e ) ; } return catalog ; }
Retrieves the catalog metadata using schema crawler .