Search in sources :

Example 1 with Utilities

use of org.hl7.davinci.r4.Utilities in project org.hl7.fhir.core by hapifhir.

the class FilesystemPackageCacheManager method removePackage.

// ========================= Utilities ============================================================================
/**
 * Remove a particular package from the cache
 *
 * @param id
 * @param ver
 * @throws IOException
 */
public void removePackage(String id, String ver) throws IOException {
    new CacheLock(id + "#" + ver).doWithLock(() -> {
        String f = Utilities.path(cacheFolder, id + "#" + ver);
        File ff = new File(f);
        if (ff.exists()) {
            Utilities.clearDirectory(f);
            IniFile ini = new IniFile(Utilities.path(cacheFolder, "packages.ini"));
            ini.removeProperty("packages", id + "#" + ver);
            ini.save();
            ff.delete();
        }
        return null;
    });
}
Also used : IniFile(org.hl7.fhir.utilities.IniFile) RandomAccessFile(java.io.RandomAccessFile) IniFile(org.hl7.fhir.utilities.IniFile) File(java.io.File) TextFile(org.hl7.fhir.utilities.TextFile)

Aggregations

File (java.io.File)1 RandomAccessFile (java.io.RandomAccessFile)1 IniFile (org.hl7.fhir.utilities.IniFile)1 TextFile (org.hl7.fhir.utilities.TextFile)1