private static void initRepositoryDefinitions ( ) throws JSONException { final JSONObject jsonObject = Repositories . getRepositoriesDescription ( ) ; if ( null == jsonObject ) { LOGGER . warn ( "Loads repository description [repository.json] failed" ) ; return ; } repositoryDefinitions = new ArrayList <> ( ) ; final JSONArray repositoritArray = jsonObject . getJSONArray ( REPOSITORIES ) ; JSONObject repositoryObject ; JSONObject keyObject ; for ( int i = 0 ; i < repositoritArray . length ( ) ; i ++ ) { repositoryObject = repositoritArray . getJSONObject ( i ) ; final RepositoryDefinition repositoryDefinition = new RepositoryDefinition ( ) ; repositoryDefinitions . add ( repositoryDefinition ) ; repositoryDefinition . setName ( repositoryObject . getString ( NAME ) ) ; repositoryDefinition . setDescription ( repositoryObject . optString ( DESCRIPTION ) ) ; final List < FieldDefinition > keys = new ArrayList <> ( ) ; repositoryDefinition . setKeys ( keys ) ; final JSONArray keysJsonArray = repositoryObject . getJSONArray ( KEYS ) ; FieldDefinition definition ; for ( int j = 0 ; j < keysJsonArray . length ( ) ; j ++ ) { keyObject = keysJsonArray . getJSONObject ( j ) ; definition = fillFieldDefinitionData ( keyObject ) ; keys . add ( definition ) ; } repositoryDefinition . setCharset ( repositoryObject . optString ( CHARSET ) ) ; repositoryDefinition . setCollate ( repositoryObject . optString ( COLLATE ) ) ; } }
Initializes the repository definitions .