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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructorprotectedBasePackageCacheManager(List<PackageServer> thePackageServers) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPackageServer(PackageServer thePackageServer) Add a package server that can be used to fetch remote packagesgetPackageId(String canonicalUrl) getPackageUrl(String packageId) 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.loadPackage(String idAndVer) Load the package specified by the id and version specified in the idAndVer parameter.Load the latest version of the identified package from the cache - it it existsabstract NpmPackageloadPackageFromCacheOnly(String id, String version) voidsetClientFactory(Function<PackageServer, PackageClient> theClientFactory) Provide a new client factory implementationprotected StringstripAlias(String id) The NPM Alias format is: npm install@npm: : (see https://docs.npmjs.com/cli/v8/commands/npm-install) We're using that format to allow us to use more than one version of the same package in packages.json, but what the prefix actually is is irrelevant here - we just load the actual package the user is interested in Corollary: you will get a different package name than you asked for when using aliases Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hl7.fhir.utilities.npm.IPackageCacheManager
addPackageToCache, loadPackage
-
Field Details
-
myPackageServers
-
-
Constructor Details
-
BasePackageCacheManager
public BasePackageCacheManager()Constructor -
BasePackageCacheManager
-
-
Method Details
-
setClientFactory
Provide a new client factory implementation -
getPackageServers
-
addPackageServer
Add a package server that can be used to fetch remote packages -
loadPackageFromCacheOnly
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
- Specified by:
getPackageUrlin interfaceIPackageCacheManager- Throws:
IOException
-
getPackageId
- Specified by:
getPackageIdin interfaceIPackageCacheManager- Throws:
IOException
-
loadPackage
Description copied from interface:IPackageCacheManagerLoad the package specified by the id and version specified in the idAndVer parameter. Depending on the implementation logic, this may be from the package cache, or resolved from another service.- Specified by:
loadPackagein interfaceIPackageCacheManager- Parameters:
idAndVer- - use id#ver- Returns:
- the NPM Package or
- Throws:
FHIRExceptionIOException
-
stripAlias
The NPM Alias format is: npm install@npm: : (see https://docs.npmjs.com/cli/v8/commands/npm-install) We're using that format to allow us to use more than one version of the same package in packages.json, but what the prefix actually is is irrelevant here - we just load the actual package the user is interested in Corollary: you will get a different package name than you asked for when using aliases - Parameters:
id-- Returns:
-