code: public static LocationType getLocationType(URI location) {
          String scheme = location.getScheme();
          if (EMODB_SCHEME.equals(scheme)) {
              // If the host matches the locator pattern then assume host discovery, otherwise it's a
              // direct URL to an EmoDB server
              if (LOCATOR_PATTERN.matcher(location.getHost()).matches()) {
                  return LocationType.EMO_HOST_DISCOVERY;
              } else {
                  return LocationType.EMO_URL;
              }
          } else if (STASH_SCHEME.equals(scheme)) {
              return LocationType.STASH;
          }
  
          throw new IllegalArgumentException("Invalid location: " + location);
      }
docs: Returns the location type from a location URI.