private IndexingContext getIndexingContext(String id) { String repoId; if (StringUtils.startsWith(id, "remote-")) { repoId = StringUtils.substringAfter(id, "remote-"); } else { repoId = id; } Repository repo = repositoryRegistry.getRepository(repoId); if (repo==null) { return null; } else { if (repo.getIndexingContext()!=null) { try { return repo.getIndexingContext().getBaseContext(IndexingContext.class); } catch (UnsupportedBaseContextException e) { return null; } } else { return null; } } }
assert rRepo.getIndexingContext() != null; IndexingContext context = rRepo.getIndexingContext().getBaseContext(IndexingContext.class); if (context.isSearchable()) { indexingContextIds.addAll(getRemoteIndexingContextIds(repo));
/** * Resets the indexing context of a given repository. * * @param repo * @throws IndexUpdateFailedException */ @SuppressWarnings( "unchecked" ) public void resetIndexingContext(Repository repo) throws IndexUpdateFailedException { if (repo.hasIndex() && repo instanceof EditableRepository) { EditableRepository eRepo = (EditableRepository) repo; ArchivaIndexingContext newCtx = getIndexManager(repo.getType()).reset(repo.getIndexingContext()); eRepo.setIndexingContext(newCtx); } }
try return repo.getIndexingContext().getBaseContext( IndexingContext.class );