001package org.hl7.fhir.utilities.npm; 002 003import java.io.IOException; 004import java.io.InputStream; 005 006import org.hl7.fhir.exceptions.FHIRException; 007 008public interface IPackageCacheManager { 009 010 String getPackageId(String canonicalUrl) throws IOException; 011 012 NpmPackage addPackageToCache(String id, String version, InputStream packageTgzInputStream, String sourceDesc) throws IOException; 013 014 String getPackageUrl(String packageId) throws IOException; 015 016 /** 017 * Load the package specified by the id and version specified by the parameters. 018 * <p/> 019 * Depending on the implementation logic, this may be from the package cache, or resolved from another service. 020 * 021 * @param id The package id 022 * @param version The package version. If this is null, the implementation logic will attempt to resolve an 023 * appropriate version based on the package id. 024 * @return the NPM Package 025 * @throws FHIRException 026 * @throws IOException 027 */ 028 NpmPackage loadPackage(String id, String version) throws FHIRException, IOException; 029 030 /** 031 * Load the package specified by the id and version specified in the idAndVer parameter. 032 * <p/> 033 * Depending on the implementation logic, this may be from the package cache, or resolved from another service. 034 * 035 * @param idAndVer - use id#ver 036 * @return the NPM Package or 037 * @throws FHIRException 038 * @throws IOException 039 */ 040 NpmPackage loadPackage(String idAndVer) throws FHIRException, IOException; 041}