}
}
if (kind == null) {
// unknown explodedPath[0]
throw new ItemNotFoundException(
reasonFor(
request,
"Repository kind '" + explodedPath[0] + "' is unknown"));
}
result.setStrippedPrefix(PathUtils.concatPaths(explodedPath[0]));
}
if (explodedPath.length >= 2) {
// we have repoId information in path
Repository repository = null;
try {
repository = getRepositoryForPathPrefixOrId(explodedPath[1], kind);
// explodedPath[1] is not _always_ ID anymore! It is PathPrefix _or_ ID! NEXUS-1710
// repository = repositoryRegistry.getRepositoryWithFacet( explodedPath[1], kind );
if (!repository.isExposed()) {
// this is not the main facet or the repo is not exposed
throw new ItemNotFoundException(reasonFor(request, "Repository %s exists but is not exposed.",
RepositoryStringUtils.getHumanizedNameString(repository)));
}
}
catch (NoSuchRepositoryException e) {
// obviously, the repoId (explodedPath[1]) points to some nonexistent repoID
throw new ItemNotFoundException(reasonFor(request, e.getMessage()), e);
}
result.setStrippedPrefix(PathUtils.concatPaths(explodedPath[0], explodedPath[1]));
result.setTargetedRepository(repository);