protected void optimizeRepositoryIndex(final Repository repository) throws CorruptIndexException, IOException { if (!INDEXABLE(repository)) { return; } // this does not do much useful with maven-indexer 5.0 and lucene 3.6+ // and according to lucene javadoc should be fully thread-safe sharedSingle(repository, new Runnable() { @Override public void run(IndexingContext context) throws IOException { TaskUtil.checkInterruption(); log.debug("Optimizing index for repository {} ", repository.getId()); context.optimize(); log.debug("Optimized index for repository {} ", repository.getId()); } }); }
private boolean INCLUDEINSEARCH(Repository repository) { return INSERVICE(repository) && (ISGROUP(repository) || (INDEXABLE(repository))); }
public void removeItemFromIndex(final Repository repository, final StorageItem item) throws IOException { if (!INDEXABLE(repository) || !INSERVICE(repository)) { return; } // index for proxy repos shouldn't change just because you deleted something locally if (ISPROXY(repository)) { return; } // do the work sharedSingle(repository, new Runnable() { @Override public void run(IndexingContext context) throws IOException { removeItemFromIndex(repository, item, context); } }); }
public TreeNode listNodes(final TreeNodeFactory factory, final String path, final Map<Field, String> hints, final ArtifactInfoFilter artifactInfoFilter, final String repositoryId) throws NoSuchRepositoryException, IOException { final Repository repository = repositoryRegistry.getRepository(repositoryId); if (!INDEXABLE(repository) || !INSERVICE(repository)) { return null; } final TreeNode[] result = new TreeNode[1]; shared(repository, new Runnable() { @Override public void run(IndexingContext context) throws IOException { TreeViewRequest request = new TreeViewRequest(factory, path, hints, artifactInfoFilter, context); // TODO igorf // TreeNode.listChildren lists children on demand using provided context // if context is closed asynchronously, the method will return empty list. // should through IllegalStateException instead. result[0] = indexTreeView.listNodes(request); } }); return result[0]; }
protected void publishRepositoryIndex(final Repository repository) throws IOException { if (!INDEXABLE(repository) || !INSERVICE(repository)) { return; } ForceableReentrantLock reindexLock = getReindexLock(repository); if (reindexLock.tryLock()) { try { shared(repository, new Runnable() { @Override public void run(IndexingContext context) throws IOException { publishRepositoryIndex(repository, context); } }); } finally { reindexLock.unlock(); } } else { log.info( "Repository '{}' is already in the process of being re-indexed. Skipping additional publish index requests.", repository.getId()); } }
public void addRepositoryIndexContext(final Repository repository) throws IOException, NoSuchRepositoryException { if (!INDEXABLE(repository)) { return; } if (repository.getRepositoryKind().isFacetAvailable(GroupRepository.class)) { // group repository // just to throw NoSuchRepositoryGroupException if not existing repositoryRegistry.getRepositoryWithFacet(repository.getId(), GroupRepository.class); } else { repositoryRegistry.getRepositoryWithFacet(repository.getId(), Repository.class); } exclusiveSingle(repository, new Runnable() { @Override public void run(IndexingContext context) throws IOException { addRepositoryIndexContext(repository, context); } }); }
throws IOException if (!INDEXABLE(repository) || !INSERVICE(repository)) { return;
if (!INDEXABLE(repository) || !INSERVICE(repository) || !ISPROXY(repository)) { return;
if (!INDEXABLE(repository) || !ISPROXY(repository)) { return;
public void addItemToIndex(final Repository repository, final StorageItem item) throws IOException if (!INDEXABLE(repository) || !INSERVICE(repository)) { return;