@Deprecated public TreeNode listNodes( TreeNodeFactory factory, Repository repository, String path ) { try { return indexTreeView.listNodes( factory, path ); } catch ( IOException e ) { // TODO Auto-generated catch block getLogger().warn( "Error retrieving index nodes", e ); } return null; }
/** * Used to close all indexing context explicitly. */ public void shutdown( boolean deleteFiles ) throws IOException { getLogger().info( "Shutting down Nexus IndexerManager" ); for ( IndexingContext ctx : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( ctx, false ); } locks.clear(); }
public TreeNode listNodes( TreeViewRequest request ) { try { return indexTreeView.listNodes( request ); } catch ( IOException e ) { // TODO Auto-generated catch block getLogger().warn( "Error retrieving index nodes", e ); } return null; }
protected void logSkippingRepositoryMessage( Repository repository ) { boolean isSupported = isIndexingSupported( repository ); boolean isIndexed = repository.isIndexable(); if ( getLogger().isDebugEnabled() ) { StringBuilder sb = new StringBuilder( "Indexing is " ); if ( !isSupported ) { sb.append( "not " ); } sb.append( "supported on repository \"" + repository.getName() + "\" (ID=\"" + repository.getId() + "\")" ); if ( isSupported ) { sb.append( " and is set as " ); if ( !isIndexed ) { sb.append( "not " ); } sb.append( "indexed. " ); } else { sb.append( ". " ); } sb.append( "Skipping it." ); getLogger().debug( sb.toString() ); } }
public void optimizeRepositoryIndex( String repositoryId ) throws IOException { try { optimizeIndex( repositoryRegistry.getRepository( repositoryId ) ); } catch ( NoSuchRepositoryException e ) { // should never happen getLogger().error( e.getMessage(), e ); } }
public void optimizeGroupIndex( String groupId ) throws IOException { try { GroupRepository group = repositoryRegistry.getRepositoryWithFacet( groupId, GroupRepository.class ); optimizeIndex( group ); } catch ( NoSuchRepositoryException e ) { // should never happen getLogger().error( e.getMessage(), e ); } }
public void setRepositoryIndexContextSearchable( String repositoryId, boolean searchable ) throws IOException, NoSuchRepositoryException { Repository repository = repositoryRegistry.getRepository( repositoryId ); // cannot do "!repository.isIndexable()" since we may be called to handle that config change (using events)! // the repo might be already non-indexable, but the context would still exist! if ( !isIndexingSupported( repository ) ) { logSkippingRepositoryMessage( repository ); return; } IndexingContext ctx = getRepositoryLocalIndexContext( repository ); IndexingContext rctx = getRepositoryRemoteIndexContext( repository ); // do this only if we have contexts, otherwise be muted if ( ctx != null && rctx != null ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Searching on repository ID='" + repositoryId + "' is set to: " + String.valueOf( searchable ) ); } ctx.setSearchable( searchable ); rctx.setSearchable( searchable ); } }
getLogger().error( e.getMessage(), e );
getLogger().info( "Trying to get remote index for repository " + repository.getId() ); getLogger().info( "Remote indexes updated successfully for repository " + repository.getId() ); getLogger().info( "Remote indexes unchanged (no update needed) for repository " + repository.getId() ); getLogger().warn( "Cannot fetch remote index for repository " + repository.getId(), e );
private void copyIndexPropertiesToTempDir( Repository repository, File tempDir ) { InputStream is = null; try { // Need to use RepositoryUID to get around security ResourceStoreRequest req = new ResourceStoreRequest( "/.index/" + IndexingContext.INDEX_FILE + ".properties" ); req.setRequestLocalOnly( true ); StorageFileItem item = (StorageFileItem) repository.retrieveItem( true, req ); // Hack to make sure that group properties isn't retrieved from child repo if ( repository.getId().equals( item.getRepositoryId() ) ) { is = item.getInputStream(); // FileUtils.copyStreamToFile closes the stream! FileUtils.copyStreamToFile( new RawInputStreamFacade( is ), new File( tempDir, IndexingContext.INDEX_FILE + ".properties" ) ); } } catch ( Exception e ) { getLogger().debug( "Unable to copy index properties file, continuing without it", e ); } }
getLogger().error( "Cannot store index file " + path, e );
protected void optimizeIndex( Repository repo ) throws CorruptIndexException, IOException { if ( repo.getRepositoryKind().isFacetAvailable( GroupRepository.class ) ) { GroupRepository group = repo.adaptToFacet( GroupRepository.class ); for ( Repository member : group.getMemberRepositories() ) { optimizeIndex( member ); } } // local IndexingContext context = getRepositoryLocalIndexContext( repo ); if ( context != null ) { getLogger().debug( "Optimizing local index context for repository: " + repo.getId() ); context.optimize(); } // remote context = getRepositoryRemoteIndexContext( repo ); if ( context != null ) { getLogger().debug( "Optimizing remote index context for repository: " + repo.getId() ); context.optimize(); } } }
getLogger().info( "Cascading merge of group indexes for group \"" + groupId + "\", where repository \"" + repository.getId() + "\" is member." ); groupContext.merge( remoteContext.getIndexDirectory() ); if ( getLogger().isDebugEnabled() ) getLogger().debug( "Rebuilding groups in merged index for repository group " + group );