legacy/src/main/java/thredds/catalog/XMLEntityResolver.java
static public void initEntity( String entityName, String resourceName, String urlName) {
    String entity = null;

    try (InputStream is = ucar.nc2.util.IO.getFileResource( resourceName)) { // try to read from local file resource, eg from catalog.jar
      ByteArrayOutputStream sbuff = new ByteArrayOutputStream(3000);
      if (is != null) {
        IO.copy(is, sbuff);
        entity = new String(sbuff.toByteArray(), CDM.utf8Charset);
        logger.debug(" *** entity " + entityName + " mapped to local resource at " + resourceName);

      } else if (urlName != null) { // otherwise, get from network
        entity = IO.readURLcontentsWithException(urlName);
        logger.debug(" *** entity "+entityName+" mapped to remote URL at "+urlName);
      }

    } catch (IOException e) {
      System.out.println(" *** FAILED to map entity "+entityName+" locally at "+resourceName+" or remotely at "+urlName);
      // e.printStackTrace();
    }

    entityHash.put( entityName, entity);
    entityHash.put( urlName, entity); // also map it to the remote URL
  }
static public void initEntity( String entityName, String resourceName, String urlName) {
    String entity = null;

    try (InputStream is = ucar.nc2.util.IO.getFileResource( resourceName)) { // try to read from local file resource, eg from catalog.jar
      ByteArrayOutputStream sbuff = new ByteArrayOutputStream(3000);
      if (is != null) {
        IO.copy(is, sbuff);
        entity = new String(sbuff.toByteArray(), CDM.utf8Charset);
        logger.debug(" *** entity " + entityName + " mapped to local resource at " + resourceName);

      } else if (urlName != null) { // otherwise, get from network
        entity = IO.readURLcontentsWithException(urlName);
        logger.debug(" *** entity "+entityName+" mapped to remote URL at "+urlName);
      }

    } catch (IOException e) {
      System.out.println(" *** FAILED to map entity "+entityName+" locally at "+resourceName+" or remotely at "+urlName);
      // e.printStackTrace();
    }

    entityHash.put( entityName, entity);
    entityHash.put( urlName, entity); // also map it to the remote URL
  }
Add an entity for resolution. Specify a local resource, and/or a URL. Look
for the local Resource first.

@param entityName name of entity, eg the namespace String
@param resourceName resolve using this Resource, found on the class path
@param urlName resolve using this Resource, found on the class path