public JSONObject getJsonConfig ( String name ) throws IOException , JSONException { if ( name . endsWith ( ".xml" ) ) { URL url = getResource ( MATERIALIZEDJSON ) ; if ( url != null ) { InputStream in = url . openStream ( ) ; if ( in != null ) { JSONObject json = instantiateJsonObject ( in ) ; if ( json . has ( xmlToThrift ( name ) ) ) { return json . getJSONObject ( xmlToThrift ( name ) ) ; } } } } return null ; }
Given a xml config file specified as a string return the corresponding json object if it exists .