@Override
  public List<String> listDatabaseNamesByPattern(String pattern)
    throws HCatException {
    List<String> dbNames = null;
    try {
      dbNames = hmsClient.getDatabases(pattern);
    } catch (MetaException exp) {
      throw new HCatException("MetaException while listing db names. " + exp.getMessage(), exp);
    } catch (TException e) {
      throw new HCatException("Transport Exception while listing db names. " + e.getMessage(), e);
    }
    return dbNames;
  }
The HCatClientHMSImpl is the Hive Metastore client based implementation of
HCatClient.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java