Exemple #1
0
 public static Pair<DatasetRepository, Map<String, String>> lookupRepoUri(URI repoUri) {
   for (URIPattern pattern : REPO_PATTERNS.keySet()) {
     Map<String, String> match = pattern.getMatch(repoUri);
     if (match != null) {
       return Pair.of(REPO_PATTERNS.get(pattern).getFromOptions(match), match);
     }
   }
   throw new IllegalArgumentException("Unknown repository URI: " + repoUri);
 }
Exemple #2
0
 public static Pair<DatasetRepository, Map<String, String>> lookupDatasetUri(URI datasetUri) {
   for (URIPattern pattern : DATASET_PATTERNS.keySet()) {
     Map<String, String> match = pattern.getMatch(datasetUri);
     if (match != null) {
       return Pair.of(DATASET_PATTERNS.get(pattern).getFromOptions(match), match);
     }
   }
   throw new DatasetNotFoundException("Unknown dataset URI: " + datasetUri);
 }
Exemple #3
0
 public static Pair<URIPattern, Map<String, String>> lookupPatternByRepoUri(URI uri) {
   for (URIPattern pattern : REPO_TO_DATASET_PATTERNS.keySet()) {
     Map<String, String> match = pattern.getMatch(uri);
     if (match != null) {
       URIPattern datasetPattern = REPO_TO_DATASET_PATTERNS.get(pattern);
       return Pair.of(datasetPattern, match);
     }
   }
   throw new IllegalArgumentException("Unknown repository URI: " + uri);
 }