Examples of IndexingContext


Examples of org.apache.maven.index.context.IndexingContext

        TrackingFetcher fetcher;
        IndexUpdateRequest updateRequest;

        // initial index download (expected: successfull download)
        fetcher = new TrackingFetcher( remoteRepo );
        IndexingContext testContext = getNewTempContext();
        updateRequest = new IndexUpdateRequest( testContext, fetcher );
        updateRequest.setLocalIndexCacheDir( localCacheDir );
        updater.fetchAndUpdateIndex( updateRequest );

        // recreate local index from the cache without remote access (and NULL fetcher)
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

    }

    private void assertIndexFiles( final String indexDir )
        throws Exception
    {
        IndexingContext context = null;
        NexusIndexer indexer = lookup( NexusIndexer.class );
        try
        {
            List<IndexCreator> indexCreators = getContainer().lookupList( IndexCreator.class );
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

    public MergedRemoteIndexesTaskResult execute()
        throws IndexMergerException
    {
        IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.getIndexMerger();

        IndexingContext indexingContext =
            indexMerger.buildMergedIndex( mergedRemoteIndexesTaskRequest.getIndexMergerRequest() );

        return new MergedRemoteIndexesTaskResult( indexingContext );
    }
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

        String tempRepoId = mergedIndexDirectory.getName();

        try
        {
            File indexLocation = new File( mergedIndexDirectory, indexMergerRequest.getMergedIndexPath() );
            IndexingContext indexingContext =
                indexer.addIndexingContext( tempRepoId, tempRepoId, mergedIndexDirectory, indexLocation, null, null,
                                            mavenIndexerUtils.getAllIndexCreators() );

            for ( String repoId : indexMergerRequest.getRepositoriesIds() )
            {
                IndexingContext idxToMerge = indexer.getIndexingContexts().get( repoId );
                if ( idxToMerge != null )
                {
                    indexingContext.merge( idxToMerge.getIndexDirectory() );
                }
            }

            indexingContext.optimize();
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

            return;
        }

        try
        {
            IndexingContext indexingContext = indexer.getIndexingContexts().get( temporaryGroupIndex.getIndexId() );
            if ( indexingContext != null )
            {
                indexer.removeIndexingContext( indexingContext, true );
            }
            File directory = temporaryGroupIndex.getDirectory();
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

                        log.debug( "Skipping repository '" + repository + "' for user '" + activePrincipal + "': "
                                       + e.getMessage() );
                    }
                }
            }
            IndexingContext indexingContext = indexMerger.buildMergedIndex( authzRepos, true );
            File mergedRepoDir = indexingContext.getIndexDirectoryFile();
            TemporaryGroupIndex temporaryGroupIndex =
                new TemporaryGroupIndex( mergedRepoDir, indexingContext.getId() ).setCreationTime(
                    new Date().getTime() );
            temporaryGroupIndexMap.put( groupId, temporaryGroupIndex );
            session.setAttribute( TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY,
                                  temporaryGroupIndexMap );
            return mergedRepoDir;
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

        try
        {
            ManagedRepository repository = managedRepositoryAdmin.getManagedRepository( repositoryId );

            IndexingContext context = managedRepositoryAdmin.createIndexContext( repository );
            ArtifactIndexingTask task =
                new ArtifactIndexingTask( repository, null, ArtifactIndexingTask.Action.FINISH, context );

            task.setExecuteOnEntireRepo( true );
            task.setOnlyUpdate( false );
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

        indexUpdater = plexusSisuBridge.lookup( IndexUpdater.class );

        for ( RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
        {
            String contextKey = "remote-" + remoteRepository.getId();
            IndexingContext context = nexusIndexer.getIndexingContexts().get( contextKey );
            if ( context == null )
            {
                continue;
            }

            // TODO record jobs from configuration
            if ( remoteRepository.isDownloadRemoteIndex() && StringUtils.isNotEmpty(
                remoteRepository.getCronExpression() ) )
            {
                boolean fullDownload = context.getIndexDirectoryFile().list().length == 0;
                scheduleDownloadRemote( remoteRepository.getId(), false, fullDownload );
            }
        }

View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

        throws RepositoryAdminException, IOException
    {
        for ( RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
        {
            String contextKey = "remote-" + remoteRepository.getId();
            IndexingContext context = nexusIndexer.getIndexingContexts().get( contextKey );
            if ( context == null )
            {
                continue;
            }
            nexusIndexer.removeIndexingContext( context, false );
View Full Code Here

Examples of org.apache.maven.index.context.IndexingContext

        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        try
        {
            log.info( "start download remote index for remote repository " + this.remoteRepository.getId() );
            IndexingContext indexingContext = remoteRepositoryAdmin.createIndexContext( this.remoteRepository );

            // create a temp directory to download files
            tempIndexDirectory = new File( indexingContext.getIndexDirectoryFile().getParent(), ".tmpIndex" );
            File indexCacheDirectory = new File( indexingContext.getIndexDirectoryFile().getParent(), ".indexCache" );
            indexCacheDirectory.mkdirs();
            if ( tempIndexDirectory.exists() )
            {
                FileUtils.deleteDirectory( tempIndexDirectory );
            }
            tempIndexDirectory.mkdirs();
            tempIndexDirectory.deleteOnExit();
            String baseIndexUrl = indexingContext.getIndexUpdateUrl();

            final Wagon wagon = wagonFactory.getWagon( new URL( this.remoteRepository.getUrl() ).getProtocol() );
            setupWagonReadTimeout( wagon );

            // TODO transferListener
            wagon.addTransferListener( new DownloadListener() );
            ProxyInfo proxyInfo = null;
            if ( this.networkProxy != null )
            {
                proxyInfo = new ProxyInfo();
                proxyInfo.setHost( this.networkProxy.getHost() );
                proxyInfo.setPort( this.networkProxy.getPort() );
                proxyInfo.setUserName( this.networkProxy.getUsername() );
                proxyInfo.setPassword( this.networkProxy.getPassword() );
            }
            AuthenticationInfo authenticationInfo = null;
            if ( this.remoteRepository.getUserName() != null )
            {
                authenticationInfo = new AuthenticationInfo();
                authenticationInfo.setUserName( this.remoteRepository.getUserName() );
                authenticationInfo.setPassword( this.remoteRepository.getPassword() );
            }
            wagon.connect( new Repository( this.remoteRepository.getId(), baseIndexUrl ), authenticationInfo,
                           proxyInfo );

            File indexDirectory = indexingContext.getIndexDirectoryFile();
            if ( !indexDirectory.exists() )
            {
                indexDirectory.mkdirs();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.