protected synchronized String generateCatalogPayload() throws IOException { if (payload == null) { nexusIndexer.shared(repository, new DefaultIndexerManager.Runnable() { @Override public void run(IndexingContext context) throws IOException { // XXX igorf, this is not called when context == null, but we need to generate an empty catalog payload = generateCatalogPayload(context); } }); } return payload; }
@SuppressWarnings("deprecation") protected void deleteIndexItems(Repository repository) { ResourceStoreRequest request = new ResourceStoreRequest(PUBLISHING_PATH_PREFIX); try { // kill the chain, deleting the props file basically resets the chain shared(repository, new Runnable() { @Override public void run(IndexingContext context) throws IOException { if (context.getIndexDirectoryFile() != null) { new File( context.getIndexDirectoryFile(), IndexingContext.INDEX_PACKER_PROPERTIES_FILE ).delete(); } }}); repository.deleteItem(false, request); } catch (ItemNotFoundException e) { // nothing serious, no index was published yet, keep it silent } catch (Exception e) { log.error("Cannot delete index items!", e); } }
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()); } }
indexerManager.shared(repository, new Runnable()