use of aQute.bnd.service.repository.RepositoryDigest in project bnd by bndtools.
the class Workspace method _repodigests.
/**
* Return the repository signature digests. These digests are a unique id
* for the contents of the repository
*/
public Object _repodigests(String[] args) throws Exception {
Macro.verifyCommand(args, "${repodigests;[;<repo names>]...}, get the repository digests", null, 1, 10000);
List<RepositoryPlugin> repos = getRepositories();
if (args.length > 1) {
repos: for (Iterator<RepositoryPlugin> it = repos.iterator(); it.hasNext(); ) {
String name = it.next().getName();
for (int i = 1; i < args.length; i++) {
if (name.equals(args[i])) {
continue repos;
}
}
it.remove();
}
}
List<String> digests = new ArrayList<String>();
for (RepositoryPlugin repo : repos) {
try {
if (repo instanceof RepositoryDigest) {
byte[] digest = ((RepositoryDigest) repo).getDigest();
digests.add(Hex.toHexString(digest));
} else {
if (args.length != 1)
error("Specified repo %s for ${repodigests} was named but it is not found", repo.getName());
}
} catch (Exception e) {
if (args.length != 1)
error("Specified repo %s for digests is not found", repo.getName());
// else Ignore
}
}
return join(digests, ",");
}
Aggregations