
001package org.hl7.fhir.r5.utils.validation; 002 003import org.hl7.fhir.exceptions.FHIRException; 004import org.hl7.fhir.r5.elementmodel.Element; 005import org.hl7.fhir.r5.model.CanonicalResource; 006import org.hl7.fhir.utilities.MarkedToMoveToAdjunctPackage; 007 008import java.io.IOException; 009import java.net.URISyntaxException; 010import java.util.List; 011import java.util.Locale; 012import java.util.Set; 013 014@MarkedToMoveToAdjunctPackage 015public interface IValidatorResourceFetcher { 016 017 Element fetch(IResourceValidator validator, Object appContext, String url) throws FHIRException, IOException; 018 019 boolean resolveURL(IResourceValidator validator, Object appContext, String path, String url, String type, boolean canonical) throws IOException, FHIRException; 020 021 byte[] fetchRaw(IResourceValidator validator, String url) throws IOException; // for attachment checking 022 023 IValidatorResourceFetcher setLocale(Locale locale); 024 025 /** 026 * this is used when the validator encounters a reference to a structure definition, value set or code system at some random URL reference 027 * while validating. 028 * <p> 029 * Added in v5.2.2. return null to leave functionality as it was before then. 030 * 031 * @return an R5 version of the resource 032 * @throws URISyntaxException 033 */ 034 CanonicalResource fetchCanonicalResource(IResourceValidator validator, Object appContext, String url) throws URISyntaxException; 035 036 /** 037 * Whether to try calling fetchCanonicalResource for this reference (not whether it will succeed - just throw an exception from fetchCanonicalResource if it doesn't resolve. This is a policy thing. 038 * <p> 039 * Added in v5.2.2. return false to leave functionality as it was before then. 040 * 041 * @param url 042 * @return 043 */ 044 boolean fetchesCanonicalResource(IResourceValidator validator, String url); 045 046 Set<String> fetchCanonicalResourceVersions(IResourceValidator validator, Object appContext, String url); 047}