private static void loadRepositoryDescription ( ) { LOGGER . log ( Level . INFO , "Loading repository description...." ) ; final InputStream inputStream = AbstractRepository . class . getResourceAsStream ( "/repository.json" ) ; if ( null == inputStream ) { LOGGER . log ( Level . INFO , "Not found repository description [repository.json] file under classpath" ) ; return ; } LOGGER . log ( Level . INFO , "Parsing repository description...." ) ; try { final String description = IOUtils . toString ( inputStream , "UTF-8" ) ; LOGGER . log ( Level . DEBUG , "{0}{1}" , new Object [ ] { Strings . LINE_SEPARATOR , description } ) ; repositoriesDescription = new JSONObject ( description ) ; // Repository name prefix final String tableNamePrefix = StringUtils . isNotBlank ( Latkes . getLocalProperty ( "jdbc.tablePrefix" ) ) ? Latkes . getLocalProperty ( "jdbc.tablePrefix" ) + "_" : "" ; final JSONArray repositories = repositoriesDescription . optJSONArray ( "repositories" ) ; for ( int i = 0 ; i < repositories . length ( ) ; i ++ ) { final JSONObject repository = repositories . optJSONObject ( i ) ; repository . put ( "name" , tableNamePrefix + repository . optString ( "name" ) ) ; } } catch ( final Exception e ) { LOGGER . log ( Level . ERROR , "Parses repository description failed" , e ) ; } finally { try { inputStream . close ( ) ; } catch ( final IOException e ) { LOGGER . log ( Level . ERROR , e . getMessage ( ) , e ) ; throw new RuntimeException ( e ) ; } } }
Loads repository description .