@ SuppressWarnings ( "unchecked" ) public static Map < String , Properties > readMultipleClientConfigAvro ( String configAvro ) { Map < String , Properties > mapStoreToProps = Maps . newHashMap ( ) ; try { JsonDecoder decoder = new JsonDecoder ( CLIENT_CONFIGS_AVRO_SCHEMA , configAvro ) ; GenericDatumReader < Object > datumReader = new GenericDatumReader < Object > ( CLIENT_CONFIGS_AVRO_SCHEMA ) ; Map < Utf8 , Map < Utf8 , Utf8 > > storeConfigs = ( Map < Utf8 , Map < Utf8 , Utf8 > > ) datumReader . read ( null , decoder ) ; // Store config props to return back for ( Utf8 storeName : storeConfigs . keySet ( ) ) { Properties props = new Properties ( ) ; Map < Utf8 , Utf8 > singleConfig = storeConfigs . get ( storeName ) ; for ( Utf8 key : singleConfig . keySet ( ) ) { props . put ( key . toString ( ) , singleConfig . get ( key ) . toString ( ) ) ; } if ( storeName == null || storeName . length ( ) == 0 ) { throw new Exception ( "Invalid store name found!" ) ; } mapStoreToProps . put ( storeName . toString ( ) , props ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } return mapStoreToProps ; }
Parses a string that contains multiple fat client configs in avro format