public NameResolver(String catalogName, String queryString) throws ProgressException {
    System.out.println("Using catalog " + catalogName + "!");
    if (catalogName.equalsIgnoreCase("Personal Catalog")) {
      this.getPersonalData(queryString);
    } else {
      queryString = queryString.replaceAll(" ", "%20");

      Catalog catalog = SkycatConfigFile.getConfigFile().getCatalog(catalogName);

      if ((catalogName == null) || (System.getProperty("DEBUG") != null)) {
        System.out.println(
            "NameResolver( \"" + catalogName + "\" , \"" + queryString + "\" ) called.");
        int n = SkycatConfigFile.getConfigFile().getNumCatalogs();
        System.out.println("There are " + n + " catalogs available.");
        System.out.println("Pick one of the following catalogs:");
        for (int i = 0; i < n; i++)
          System.out.println("    " + SkycatConfigFile.getConfigFile().getCatalog(i));
      }

      if (catalog == null)
        throw new RuntimeException("Could not create catalog \"" + catalogName + "\"");

      BasicQueryArgs queryArgs = new BasicQueryArgs(catalog);
      queryArgs.setId(queryString);

      TableQueryResult tableQueryResult = null;

      try {
        Object queryResult = catalog.query(queryArgs);
        if (queryResult instanceof TableQueryResult)
          tableQueryResult = (TableQueryResult) queryResult;
      } catch (ProgressException e) {
        // query interrupted by user. Handle exception in the calling class.
        System.out.println("Rethrowing " + e);
        throw e;
      } catch (Exception e) {
        // Exception is handled in the following code because tableQueryResult is still null.
        System.out.println(e);
      }

      if ((tableQueryResult == null) || (tableQueryResult.getRowCount() < 1))
        throw new RuntimeException("No query result.");

      if ((tableQueryResult.getRowCount() > 1) && (System.getProperty("DEBUG") != null))
        System.out.println(
            "NameResolver: More than 1 query result. Only the first result is used.");

      _id = "" + tableQueryResult.getValueAt(0, 0);

      try {
        double raDegDouble = Double.parseDouble("" + tableQueryResult.getValueAt(0, 1));
        double raDouble = (raDegDouble * 24) / 360;

        _ra = (new HMS(raDouble)).toString();
      } catch (NumberFormatException e) {
        _ra = "";
      }

      try {
        double decDouble = Double.parseDouble("" + tableQueryResult.getValueAt(0, 2));

        _dec = (new DMS(decDouble)).toString();
      } catch (NumberFormatException e) {
        _dec = "";
      }

      if (System.getProperty("DEBUG") != null) {
        System.out.println("Complete query result table for catalog " + catalogName + ":");
        for (int i = 0; i < tableQueryResult.getRowCount(); i++) {
          for (int j = 0; j < tableQueryResult.getColumnCount(); j++)
            System.out.print(
                "(" + i + ", " + j + ") = " + tableQueryResult.getValueAt(i, j) + " ;    ");

          System.out.println("");
        }
      }
    }
  }
 public static boolean isAvailableAsCatalog(String catalogName) {
   if (catalogName.equals("Personal Catalog")) return true;
   else return (SkycatConfigFile.getConfigFile().getCatalog(catalogName) != null);
 }