public Path getDatabaseManagedPath(Database db) throws MetaException {
    if (db.getManagedLocationUri() != null) {
      return getDnsPath(new Path(db.getManagedLocationUri()));
    }
    if (!db.getCatalogName().equalsIgnoreCase(DEFAULT_CATALOG_NAME)) {
      return new Path(db.getLocationUri());
    }
    if (db.getName().equalsIgnoreCase(DEFAULT_DATABASE_NAME)) {
      return getWhRoot();
    }

    return new Path(getWhRoot(), db.getName().toLowerCase() + DATABASE_WAREHOUSE_SUFFIX);
  }
Get the managed tables path specified by the database.  In the case of the default database the root of the
warehouse is returned.
@param db database to get the path of
@return path to the database directory
@throws MetaException when the file path cannot be properly determined from the configured
file system.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java