Package org.hl7.fhir.utilities.cache
Class PackageCacheManager
- java.lang.Object
-
- org.hl7.fhir.utilities.cache.PackageCacheManager
-
public class PackageCacheManager extends Object
Package cache manager API: constructor getPackageUrl getPackageId findPackageCache addPackageToCache- Author:
- Grahame Grieve
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classPackageCacheManager.BuildRecordclassPackageCacheManager.BuildRecordSorterstatic interfacePackageCacheManager.INetworkServicesif you don't provide and implementation of this interface, the PackageCacheManager will use the web directly.classPackageCacheManager.PackageEntryclassPackageCacheManager.VersionHistory
-
Field Summary
Fields Modifier and Type Field Description static StringPACKAGE_REGEXstatic StringPACKAGE_VERSION_REGEX
-
Constructor Summary
Constructors Constructor Description PackageCacheManager(boolean userMode, int toolsVersion)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NpmPackageaddPackageToCache(String id, String version, InputStream tgz, String sourceDesc)Add an already fetched package to the cacheStringbuildPath(String url)booleancheckBuildLoaded()voidclear()Clear the cacheMap<String,String>getCiList()StringgetFolder()StringgetPackageId(String url)StringgetPackageUrl(String id)List<String>getUrls()booleanhasPackage(String id, String version)turn true if a package existsbooleaninitUrlMaps(IniFile ini, boolean save)booleanisBuildLoaded()PackageCacheManager.VersionHistorylistVersions(String url)List which versions of a package are availablevoidloadFromBuildServer()voidloadFromFolder(String packagesFolder)NpmPackageloadPackage(String id)NpmPackageloadPackage(String id, String v)NpmPackageloadPackageFromCacheOnly(String id)get the latest version of the package from what is in the cacheNpmPackageloadPackageFromCacheOnly(String id, String version)Load the identified package from the cache - it it exists This is for special purpose only.voidrecordMap(String url, String id)voidremovePackage(String id, String ver)static StringuserDir()
-
-
-
Field Detail
-
PACKAGE_REGEX
public static final String PACKAGE_REGEX
- See Also:
- Constant Field Values
-
PACKAGE_VERSION_REGEX
public static final String PACKAGE_VERSION_REGEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PackageCacheManager
public PackageCacheManager(boolean userMode, int toolsVersion) throws IOException
- Throws:
IOException
-
-
Method Detail
-
userDir
public static String userDir() throws IOException
- Throws:
IOException
-
initUrlMaps
public boolean initUrlMaps(IniFile ini, boolean save)
-
recordMap
public void recordMap(String url, String id) throws IOException
- Throws:
IOException
-
getPackageUrl
public String getPackageUrl(String id) throws IOException
- Throws:
IOException
-
getPackageId
public String getPackageId(String url) throws IOException
- Throws:
IOException
-
loadFromBuildServer
public void loadFromBuildServer() throws IOException, ParseException
- Throws:
IOExceptionParseException
-
isBuildLoaded
public boolean isBuildLoaded()
-
checkBuildLoaded
public boolean checkBuildLoaded() throws IOException, ParseException
- Throws:
IOExceptionParseException
-
getUrls
public List<String> getUrls() throws IOException
- Throws:
IOException
-
removePackage
public void removePackage(String id, String ver) throws IOException
- Throws:
IOException
-
loadPackageFromCacheOnly
public NpmPackage loadPackageFromCacheOnly(String id) throws IOException
get the latest version of the package from what is in the cache- Parameters:
id-- Returns:
- Throws:
IOException
-
loadPackageFromCacheOnly
public NpmPackage loadPackageFromCacheOnly(String id, String version) throws IOException
Load the identified package from the cache - it it exists This is for special purpose only. Generally, use the loadPackage method- Parameters:
id-version-- Returns:
- Throws:
IOException
-
addPackageToCache
public NpmPackage addPackageToCache(String id, String version, InputStream tgz, String sourceDesc) throws IOException
Add an already fetched package to the cache- Throws:
IOException
-
loadPackage
public NpmPackage loadPackage(String id) throws FHIRException, IOException
- Throws:
FHIRExceptionIOException
-
loadPackage
public NpmPackage loadPackage(String id, String v) throws FHIRException, IOException
- Throws:
FHIRExceptionIOException
-
hasPackage
public boolean hasPackage(String id, String version)
turn true if a package exists- Parameters:
id-version-- Returns:
-
listVersions
public PackageCacheManager.VersionHistory listVersions(String url) throws IOException
List which versions of a package are available- Parameters:
url-- Returns:
- Throws:
IOException
-
clear
public void clear() throws IOException
Clear the cache- Throws:
IOException
-
loadFromFolder
public void loadFromFolder(String packagesFolder) throws IOException
- Throws:
IOException
-
-