private CollectionDescriptor loadCollection(String collectionName) throws OracleException {
  if (!metadataTableExists) {
    return null;
  }
  OracleCallableStatement stmt=null;
  String sqltext="begin\n" + "  DBMS_SODA_ADMIN.DESCRIBE_COLLECTION(\n" + "                   P_URI_NAME   => ?,\n"+ "                   P_DESCRIPTOR => ?);\n"+ "end;";
  CollectionDescriptor desc=null;
  try {
    metrics.startTiming();
    stmt=(OracleCallableStatement)conn.prepareCall(sqltext);
    stmt.setNString(1,collectionName);
    stmt.registerOutParameter(2,OracleTypes.VARCHAR,DESC_LENGTH);
    stmt.execute();
    String jsonDescriptor=stmt.getString(2);
    desc=getDescriptorFromCaches(collectionName);
    if ((desc == null) && (jsonDescriptor != null)) {
      Builder builder=CollectionDescriptor.jsonToBuilder(jsonDescriptor);
      desc=putDescriptorIntoCaches(builder.buildDescriptor(collectionName));
    }
    stmt.close();
    stmt=null;
    metrics.recordCall();
  }
 catch (  SQLException e) {
    if (OracleLog.isLoggingEnabled())     log.severe(e.toString());
    throw SODAUtils.makeExceptionWithSQLText(e,sqltext);
  }
 finally {
    for (    String message : SODAUtils.closeCursor(stmt,null)) {
      if (OracleLog.isLoggingEnabled())       log.severe(message);
    }
  }
  return (desc);
}

private CollectionDescriptor loadCollection ( String collectionName ) throws OracleException { if ( ! metadataTableExists ) { return null ; } OracleCallableStatement stmt = null ; String sqltext = "begin\n" + "  DBMS_SODA_ADMIN.DESCRIBE_COLLECTION(\n" + "                   P_URI_NAME   => ?,\n" + "                   P_DESCRIPTOR => ?);\n" + "end;" ; CollectionDescriptor desc = null ; try { metrics . startTiming ( ) ; stmt = ( OracleCallableStatement ) conn . prepareCall ( sqltext ) ; stmt . setNString ( 1 , collectionName ) ; stmt . registerOutParameter ( 2 , OracleTypes . VARCHAR , DESC_LENGTH ) ; stmt . execute ( ) ; String jsonDescriptor = stmt . getString ( 2 ) ; desc = getDescriptorFromCaches ( collectionName ) ; if ( ( desc == null ) && ( jsonDescriptor != null ) ) { Builder builder = CollectionDescriptor . jsonToBuilder ( jsonDescriptor ) ; desc = putDescriptorIntoCaches ( builder . buildDescriptor ( collectionName ) ) ; } stmt . close ( ) ; stmt = null ; metrics . recordCall ( ) ; } catch ( SQLException e ) { if ( OracleLog . isLoggingEnabled ( ) ) log . severe ( e . toString ( ) ) ; throw SODAUtils . makeExceptionWithSQLText ( e , sqltext ) ; } finally { for ( String message : SODAUtils . closeCursor ( stmt , null ) ) { if ( OracleLog . isLoggingEnabled ( ) ) log . severe ( message ) ; } } return ( desc ) ; }
load the metadata for a collection from the table .
