Package org.hl7.fhir.utilities.npm
Class BasePackageCacheManager
- java.lang.Object
-
- org.hl7.fhir.utilities.npm.BasePackageCacheManager
-
- All Implemented Interfaces:
IPackageCacheManager
- Direct Known Subclasses:
FilesystemPackageCacheManager
public abstract class BasePackageCacheManager extends Object implements IPackageCacheManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classBasePackageCacheManager.InputStreamWithSrc
-
Constructor Summary
Constructors Constructor Description BasePackageCacheManager()Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPackageServer(String thePackageServer)Add a package server that can be used to fetch remote packagesStringgetPackageId(String canonicalUrl)List<String>getPackageServers()StringgetPackageUrl(String packageId)protected BasePackageCacheManager.InputStreamWithSrcloadFromPackageServer(String id, String version)Try to load a package from all registered package servers, and returnnullif it can not be found at any of them.NpmPackageloadPackage(String idAndVer)NpmPackageloadPackageFromCacheOnly(String id)Load the latest version of the identified package from the cache - it it existsabstract NpmPackageloadPackageFromCacheOnly(String id, String version)voidsetClientFactory(Function<String,PackageClient> theClientFactory)Provide a new client factory implementation-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hl7.fhir.utilities.npm.IPackageCacheManager
addPackageToCache, loadPackage
-
-
-
-
Constructor Detail
-
BasePackageCacheManager
public BasePackageCacheManager()
Constructor
-
-
Method Detail
-
setClientFactory
public void setClientFactory(Function<String,PackageClient> theClientFactory)
Provide a new client factory implementation
-
getPackageServers
public List<String> getPackageServers()
-
addPackageServer
public void addPackageServer(@Nonnull String thePackageServer)
Add a package server that can be used to fetch remote packages
-
loadPackageFromCacheOnly
public NpmPackage loadPackageFromCacheOnly(String id) throws IOException
Load the latest version of the identified package from the cache - it it exists- Throws:
IOException
-
loadFromPackageServer
@Nullable protected BasePackageCacheManager.InputStreamWithSrc loadFromPackageServer(String id, String version)
Try to load a package from all registered package servers, and returnnullif it can not be found at any of them.
-
loadPackageFromCacheOnly
public abstract NpmPackage loadPackageFromCacheOnly(String id, @Nullable String version) throws IOException
- Throws:
IOException
-
getPackageUrl
public String getPackageUrl(String packageId) throws IOException
- Specified by:
getPackageUrlin interfaceIPackageCacheManager- Throws:
IOException
-
getPackageId
public String getPackageId(String canonicalUrl) throws IOException
- Specified by:
getPackageIdin interfaceIPackageCacheManager- Throws:
IOException
-
loadPackage
public NpmPackage loadPackage(String idAndVer) throws FHIRException, IOException
- Specified by:
loadPackagein interfaceIPackageCacheManager- Parameters:
idAndVer- - use id#ver- Returns:
- Throws:
FHIRExceptionIOException
-
-