use of aQute.service.library.Library.Program in project bnd by bndtools.
the class Repository method programTooltip.
private String programTooltip(String bsn) throws Exception {
Program p = getProgram(bsn, false);
if (p != null) {
try (Formatter sb = new Formatter()) {
if (p.wiki != null && p.wiki.text != null)
sb.format("%s\n", p.wiki.text.replaceAll("#\\s?", ""));
else if (p.last.description != null)
sb.format("%s\n", p.last.description);
else
sb.format("No description\n");
if (bsn.indexOf("__") >= 0) {
sb.format("\nThis artifact has no OSGi metadata. Its coordinates are %s:%s\n", p.groupId, p.artifactId);
}
j.wrap((StringBuilder) sb.out());
return sb.toString().trim();
}
}
return null;
}
use of aQute.service.library.Library.Program in project bnd by bndtools.
the class Repository method update.
/**
* Update all baselines for a bsn
*
* @param bsn
* @throws Exception
*/
void update(String bsn) throws Exception {
Program program = getProgram(bsn, false);
Runnable updateAction = getUpdateAction(program, bsn);
if (updateAction == null)
return;
logger.debug("update bsn {}", updateAction);
updateAction.run();
}
use of aQute.service.library.Library.Program in project bnd by bndtools.
the class Main method printPrograms.
// void print(Iterable<RevisionRef> revisions) {
// for (RevisionRef r : revisions) {
// out.printf("%-40s %s %s\n", jpm.getCoordinates(r),
// Hex.toHexString(r._id), (r.description == null ? ""
// : r.description));
// }
// }
void printPrograms(Iterable<? extends Program> programs) {
Justif j = new Justif(120, 40, 42, 100);
StringBuilder sb = new StringBuilder();
try (Formatter f = new Formatter(sb)) {
for (Program p : programs) {
if (p.groupId.equals(Library.OSGI_GROUP) || p.groupId.equals(Library.SHA_GROUP))
f.format("%s", p.artifactId);
else
f.format("%s:%s", p.groupId, p.artifactId);
f.format("\t0-\t1");
if (p.wiki != null && p.wiki.text != null)
sb.append(p.wiki.text.replace('\n', '\f'));
else if (p.last != null) {
if (p.last.description != null)
sb.append(p.last.description.replace('\n', '\f'));
}
f.format("%n");
}
j.wrap(sb);
out.println(sb);
}
}
use of aQute.service.library.Library.Program in project bnd by bndtools.
the class StoredRevisionCache method getProgram.
public Program getProgram(String bsn) {
Program p = programs.get(bsn);
if (p != null)
return p;
File pf = IO.getFile(programdir, bsn + ".json");
if (pf != null && pf.isFile() && pf.lastModified() >= refresh.lastModified()) {
try {
p = codec.dec().from(pf).get(Program.class);
programs.put(bsn, p);
return p;
} catch (Exception e) {
//
return null;
}
} else
return null;
}
use of aQute.service.library.Library.Program in project bnd by bndtools.
the class Repository method getRevisionRefs.
private List<RevisionRef> getRevisionRefs(String bsn) throws Exception {
String classifier = null;
String[] parts = bsn.split("__");
if (parts.length == 3) {
bsn = parts[0] + "__" + parts[1];
classifier = parts[2];
}
Program program = getProgram(bsn, false);
if (program != null) {
List<RevisionRef> refs = new ArrayList<Library.RevisionRef>();
for (RevisionRef r : program.revisions) {
if (eq(classifier, r.classifier))
refs.add(r);
}
return refs;
}
return Collections.emptyList();
}
Aggregations