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