path = "/" + path;
}
List<RepositoryUrlResource> urls = new ArrayList<RepositoryUrlResource>();
for (String repositoryId : repositories) {
RepositoryUrlResource repoUrl = new RepositoryUrlResource();
try {
protectedRepositoryRegistry.getRepository(repositoryId);
repoUrl.setCanView(true);
}
catch (NoSuchRepositoryAccessException e) {
// don't have view access, so won't see it!
repoUrl.setCanView(false);
}
catch (NoSuchRepositoryException e) {
// completely unexpect, probably another thread removed this repo
getLogger().error(e.getMessage(), e);
continue;
}
repoUrl.setRepositoryId(repositoryId);
try {
repoUrl.setRepositoryName(repositoryRegistry.getRepository(repositoryId).getName());
}
catch (NoSuchRepositoryException e) {
// should never happen;
getLogger().error(e.getMessage(), e);
}
repoUrl.setArtifactUrl(referenceFactory.createReference(req,
"content/repositories/" + repositoryId + path).toString());
repoUrl.setPath(path);
urls.add(repoUrl);
}
return urls;
}