
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.r5.model.CanonicalType; 007import org.hl7.fhir.utilities.MarkedToMoveToAdjunctPackage; 008 009import java.io.IOException; 010import java.net.URISyntaxException; 011import java.util.List; 012import java.util.Locale; 013import java.util.Set; 014 015@MarkedToMoveToAdjunctPackage 016public interface IValidatorResourceFetcher { 017 018 Element fetch(IResourceValidator validator, Object appContext, String url) throws FHIRException, IOException; 019 020 boolean resolveURL(IResourceValidator validator, Object appContext, String path, String url, String type, boolean canonical, List<CanonicalType> targets) throws IOException, FHIRException; 021 022 byte[] fetchRaw(IResourceValidator validator, String url) throws IOException; // for attachment checking 023 024 IValidatorResourceFetcher setLocale(Locale locale); 025 026 /** 027 * this is used when the validator encounters a reference to a structure definition, value set or code system at some random URL reference 028 * while validating. 029 * <p> 030 * Added in v5.2.2. return null to leave functionality as it was before then. 031 * 032 * @return an R5 version of the resource 033 * @throws URISyntaxException 034 */ 035 CanonicalResource fetchCanonicalResource(IResourceValidator validator, Object appContext, String url) throws URISyntaxException; 036 037 /** 038 * 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. 039 * <p> 040 * Added in v5.2.2. return false to leave functionality as it was before then. 041 * 042 * @param url 043 * @return 044 */ 045 boolean fetchesCanonicalResource(IResourceValidator validator, String url); 046 047 Set<String> fetchCanonicalResourceVersions(IResourceValidator validator, Object appContext, String url); 048}