Examples of ArtifactIndexingTask


Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

        {
            File artifactFile = new File( repoContent.getRepoRoot(), repoContent.toPath( artifact ) );
           
            if ( !artifactFile.exists() )
            {
                ArtifactIndexingTask task =               
                        TaskCreator.createIndexingTask( repository.getId(), artifactFile, ArtifactIndexingTask.DELETE );
               
                log.debug( "Queueing indexing task '" + task.getName() + "' to remove the artifact from the index." );
                scheduler.queueIndexingTask( task );
            }
                  
        }
        catch ( TaskQueueException e )
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

        ManagedRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
        repoContent.setRepository( repositoryConfig );
       
        File artifactFile = new File( repoContent.getRepoRoot(), repoContent.toPath( artifact ) );
      
        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryConfig.getId(), artifactFile, ArtifactIndexingTask.DELETE );
       
        repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( repositoryConfig.getId() ),
                                            repoContent );
      
        repoFactoryControl.replay();     

        consumer.processArchivaArtifact( artifact );

        repoFactoryControl.verify();      
       
        assertTrue( scheduler.isProcessingIndexingTaskWithName( task.getName() ) );              
    }
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

        ManagedRepositoryContent repoContent = new ManagedDefaultRepositoryContent();
        repoContent.setRepository( repositoryConfig );

        File artifactFile = new File( repoContent.getRepoRoot(), repoContent.toPath( artifact ) );
       
        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryConfig.getId(), artifactFile, ArtifactIndexingTask.DELETE );
       
        repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( repositoryConfig.getId() ),
                                            repoContent );

        repoFactoryControl.replay();

        consumer.processArchivaArtifact( artifact );

        repoFactoryControl.verify();
       
        assertFalse( scheduler.isProcessingIndexingTaskWithName( task.getName() ) );
    }
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

    {
        File artifactFile =
            new File( repositoryConfig.getLocation(),
                      "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );

        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );

        indexingExecutor.executeTask( task );

        BooleanQuery q = new BooleanQuery();
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

    {
        File artifactFile =
            new File( repositoryConfig.getLocation(),
                      "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );

        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );

        indexingExecutor.executeTask( task );
        indexingExecutor.executeTask( task );
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

    {
        File artifactFile =
            new File( repositoryConfig.getLocation(),
                      "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );

        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );

        // remove artifact from index
        indexingExecutor.executeTask( task );
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

    {
        File artifactFile =
            new File( repositoryConfig.getLocation(),
                      "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );

        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryConfig, artifactFile, ArtifactIndexingTask.Action.ADD, context );

        indexingExecutor.executeTask( task );

        task =
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

    public void executeTask( Task task )
        throws TaskExecutionException
    {
        synchronized ( indexerEngine )
        {
            ArtifactIndexingTask indexingTask = (ArtifactIndexingTask) task;

            ManagedRepositoryConfiguration repository = indexingTask.getRepository();
            IndexingContext context = indexingTask.getContext();

            if ( ArtifactIndexingTask.Action.FINISH.equals( indexingTask.getAction() )
                && indexingTask.isExecuteOnEntireRepo() )
            {
                log.debug( "Finishing indexing task on repo: " + repository.getId() );
                finishIndexingTask( indexingTask, repository, context );
            }
            else
            {
                // create context if not a repo scan request
                if( !indexingTask.isExecuteOnEntireRepo() )
                {
                    try
                    {
                        log.debug( "Creating indexing context on resource: " + indexingTask.getResourceFile().getPath() );
                        context = TaskCreator.createContext( repository );
                    }
                    catch( IOException e )
                    {
                        log.error( "Error occurred while creating context: " + e.getMessage() );
                        throw new TaskExecutionException( "Error occurred while creating context: " + e.getMessage() );
                    }
                    catch( UnsupportedExistingLuceneIndexException e )
                    {
                        log.error( "Error occurred while creating context: " + e.getMessage() );
                        throw new TaskExecutionException( "Error occurred while creating context: " + e.getMessage() );   
                    }
                }

                if ( context == null || context.getIndexDirectory() == null )
                {
                    throw new TaskExecutionException( "Trying to index an artifact but the context is already closed" );
                }
               
                try
                {
                    File artifactFile = indexingTask.getResourceFile();
                    ArtifactContext ac = artifactContextProducer.getArtifactContext( context, artifactFile );

                    if ( ac != null )
                    {
                        if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
                        {
                            IndexSearcher s = context.getIndexSearcher();
                            String uinfo = ac.getArtifactInfo().getUinfo();
                            TopDocs d = s.search( new TermQuery( new Term( ArtifactInfo.UINFO, uinfo ) ), 1 );
                            if ( d.totalHits == 0 )
                            {
                                log.debug( "Adding artifact '" + ac.getArtifactInfo() + "' to index.." );
                                indexerEngine.index( context, ac );
                                context.getIndexWriter().commit();
                            }
                            else
                            {
                                log.debug( "Updating artifact '" + ac.getArtifactInfo() + "' in index.." );
                                indexerEngine.update( context, ac );
                                context.getIndexWriter().commit();
                            }

                            // close the context if not a repo scan request
                            if( !indexingTask.isExecuteOnEntireRepo() )
                            {
                                log.debug( "Finishing indexing task on resource file : " + indexingTask.getResourceFile().getPath() );
                                finishIndexingTask( indexingTask, repository, context );  
                            }
                        }
                        else
                        {
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

    public void processFile( String path )
        throws ConsumerException
    {
        File artifactFile = new File( managedRepository, path );

        ArtifactIndexingTask task =
            TaskCreator.createIndexingTask( repositoryContent.getRepository(), artifactFile,
                                            ArtifactIndexingTask.Action.ADD, context );
        try
        {
            log.debug( "Queueing indexing task + '" + task + "' to add or update the artifact in the index." );
View Full Code Here

Examples of org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask

        else
        {
            File artifactFile = new File( managedRepository, path );

            // specify in indexing task that this is not a repo scan request!
            ArtifactIndexingTask task =
                new ArtifactIndexingTask( repository, artifactFile, ArtifactIndexingTask.Action.ADD, context, false );
            try
            {
                log.debug( "Queueing indexing task + '" + task + "' to add or update the artifact in the index." );
                scheduler.queueIndexingTask( task );
            }
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.