private static CouchDBDesignDocument getDesignDocument ( HttpClient httpClient , HttpHost httpHost , Gson gson , String tableName , String schemaName ) { HttpResponse response = null ; try { String id = CouchDBConstants . DESIGN + tableName ; URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + schemaName . toLowerCase ( ) + CouchDBConstants . URL_SEPARATOR + id , null , null ) ; HttpGet get = new HttpGet ( uri ) ; get . addHeader ( "Accept" , "application/json" ) ; response = httpClient . execute ( httpHost , get , CouchDBUtils . getContext ( httpHost ) ) ; InputStream content = response . getEntity ( ) . getContent ( ) ; Reader reader = new InputStreamReader ( content ) ; JsonObject jsonObject = gson . fromJson ( reader , JsonObject . class ) ; return gson . fromJson ( jsonObject , CouchDBDesignDocument . class ) ; } catch ( Exception e ) { log . error ( "Error while fetching design document object, Caused by: ." , e ) ; throw new KunderaException ( e ) ; } finally { CouchDBUtils . closeContent ( response ) ; } }
Gets the design document .