use of aQute.lib.json.Decoder in project bnd by bndtools.
the class Index method init.
private void init() throws Exception {
if (repo == null) {
cache = new TreeMap<String, TreeMap<Version, Library.RevisionRef>>();
if (indexFile.isFile() && indexFile.length() > 100) {
try (Decoder dec = codec.dec()) {
repo = dec.from(indexFile).get(new TypeReference<Repo>() {
});
for (Library.RevisionRef r : repo.revisionRefs) {
TreeMap<Version, Library.RevisionRef> map = cache.get(r.bsn);
if (map == null) {
map = new TreeMap<Version, Library.RevisionRef>(Collections.reverseOrder());
cache.put(r.bsn, map);
}
Version v = toVersion(r.baseline, r.qualifier);
map.put(v, r);
}
}
} else {
repo = new Repo();
}
}
}
Aggregations