Package org.codehaus.plexus.taskqueue.execution

Examples of org.codehaus.plexus.taskqueue.execution.TaskExecutionException


        }
        catch ( IOException e )
        {
            log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage() );
            throw new TaskExecutionException( "Error occurred while executing indexing task '" + indexingTask + "'",
                                              e );
        }
    }
View Full Code Here


            RepositoryTask repoTask = (RepositoryTask) task;

            String repoId = repoTask.getRepositoryId();
            if ( StringUtils.isBlank( repoId ) )
            {
                throw new TaskExecutionException( "Unable to execute RepositoryTask with blank repository Id." );
            }

            ManagedRepository arepo = managedRepositoryAdmin.getManagedRepository( repoId );

            // execute consumers on resource file if set
            if ( repoTask.getResourceFile() != null )
            {
                log.debug( "Executing task from queue with job name: {}", repoTask );
                consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() );
            }
            else
            {
                log.info( "Executing task from queue with job name: {}", repoTask );

                // otherwise, execute consumers on whole repository
                if ( arepo == null )
                {
                    throw new TaskExecutionException(
                        "Unable to execute RepositoryTask with invalid repository id: " + repoId );
                }

                long sinceWhen = RepositoryScanner.FRESH_SCAN;
                long previousFileCount = 0;

                RepositorySession repositorySession = repositorySessionFactory.createSession();
                MetadataRepository metadataRepository = repositorySession.getRepository();
                try
                {
                    if ( !repoTask.isScanAll() )
                    {
                        RepositoryStatistics previousStats =
                            repositoryStatisticsManager.getLastStatistics( metadataRepository, repoId );
                        if ( previousStats != null )
                        {
                            sinceWhen = previousStats.getScanStartTime().getTime();
                            previousFileCount = previousStats.getTotalFileCount();
                        }
                    }

                    RepositoryScanStatistics stats;
                    try
                    {
                        stats = repoScanner.scan( arepo, sinceWhen );
                    }
                    catch ( RepositoryScannerException e )
                    {
                        throw new TaskExecutionException( "Repository error when executing repository job.", e );
                    }

                    log.info( "Finished first scan: {}", stats.toDump( arepo ) );

                    // further statistics will be populated by the following method
                    Date endTime = new Date( stats.getWhenGathered().getTime() + stats.getDuration() );

                    log.info( "Gathering repository statistics" );

                    repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, repoId,
                                                                        stats.getWhenGathered(), endTime,
                                                                        stats.getTotalFileCount(),
                                                                        stats.getTotalFileCount() - previousFileCount );
                    repositorySession.save();
                }
                catch ( MetadataRepositoryException e )
                {
                    throw new TaskExecutionException( "Unable to store updated statistics: " + e.getMessage(), e );
                }
                finally
                {
                    repositorySession.close();
                }

//                log.info( "Scanning for removed repository content" );

//                metadataRepository.findAllProjects();
                // FIXME: do something

                log.info( "Finished repository task: {}", repoTask );

                this.task = null;
            }
        }
        catch ( RepositoryAdminException e )
        {
            log.error( e.getMessage(), e );
            throw new TaskExecutionException( e.getMessage(), e );
        }
    }
View Full Code Here

        RepositoryTask repoTask = (RepositoryTask) task;

        if ( StringUtils.isBlank( repoTask.getRepositoryId() ) )
        {
            throw new TaskExecutionException( "Unable to execute RepositoryTask with blank repository Id." );
        }

        ManagedRepositoryConfiguration arepo =
            archivaConfiguration.getConfiguration().findManagedRepositoryById( repoTask.getRepositoryId() );

        // execute consumers on resource file if set
        if ( repoTask.getResourceFile() != null )
        {
            log.debug( "Executing task from queue with job name: " + repoTask );
            consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() );
        }
        else
        {
            log.info( "Executing task from queue with job name: " + repoTask );

            // otherwise, execute consumers on whole repository
            try
            {
                if ( arepo == null )
                {
                    throw new TaskExecutionException(
                        "Unable to execute RepositoryTask with invalid repository id: " + repoTask.getRepositoryId() );
                }

                long sinceWhen = RepositoryScanner.FRESH_SCAN;

                List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query(
                    new MostRecentRepositoryScanStatistics( arepo.getId() ) );

                if ( CollectionUtils.isNotEmpty( results ) )
                {
                    RepositoryContentStatistics lastStats = results.get( 0 );
                    if ( !repoTask.isScanAll() )
                    {
                        sinceWhen = lastStats.getWhenGathered().getTime() - lastStats.getDuration();
                    }
                }

                RepositoryScanStatistics stats = repoScanner.scan( arepo, sinceWhen );

                log.info( "Finished repository task: " + stats.toDump( arepo ) );

                RepositoryContentStatistics dbstats = constructRepositoryStatistics( arepo, stats );

                dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( dbstats );

                this.task = null;
            }
            catch ( RepositoryException e )
            {
                throw new TaskExecutionException( "Repository error when executing repository job.", e );
            }
        }
    }
View Full Code Here

            continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result );

            performTask.getListener().error( e.getMessage() );

            throw new TaskExecutionException( "Failed to build reactor projects.", e );
        }

        ReleaseResult result = releaseManager.performWithResult( descriptor,
                                                                 new DefaultReleaseEnvironment().setSettings(
                                                                     settings ), reactorProjects, listener );
View Full Code Here

            endTime = System.currentTimeMillis();
        }
        catch ( MalformedURLException e )
        {
            log.error( "Invalid URL " + buildAgentUrl + ", not building" );
            throw new TaskExecutionException( "Invalid URL " + buildAgentUrl, e );
        }
        catch ( Exception e )
        {
            log.error( "Error occurred while building task", e );
            endTime = System.currentTimeMillis();
View Full Code Here

            }
        }
        catch ( ContinuumStoreException e )
        {
            throw new TaskExecutionException( "Error while creating result", e );
        }
    }
View Full Code Here

       
        RepositoryTask repoTask = (RepositoryTask) task;
       
        if ( StringUtils.isBlank( repoTask.getRepositoryId() ) )
        {
            throw new TaskExecutionException("Unable to execute RepositoryTask with blank repository Id.");
        }

        ManagedRepositoryConfiguration arepo = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoTask.getRepositoryId() );
       
        // execute consumers on resource file if set
        if( repoTask.getResourceFile() != null )
        {
            log.debug( "Executing task from queue with job name: " + repoTask.getName() );
            consumers.executeConsumers( arepo, repoTask.getResourceFile() );
        }
        else
        {
            log.info( "Executing task from queue with job name: " + repoTask.getName() );
           
            // otherwise, execute consumers on whole repository
            try
            {  
                if ( arepo == null )
                {
                    throw new TaskExecutionException( "Unable to execute RepositoryTask with invalid repository id: " + repoTask.getRepositoryId() );
                }
   
                long sinceWhen = RepositoryScanner.FRESH_SCAN;
   
                List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
   
                if ( CollectionUtils.isNotEmpty( results ) )
                {
                    RepositoryContentStatistics lastStats = results.get( 0 );
                    sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration();
                }
   
                RepositoryScanStatistics stats = repoScanner.scan( arepo, sinceWhen );
   
                log.info( "Finished repository task: " + stats.toDump( arepo ) );
               
                RepositoryContentStatistics dbstats = constructRepositoryStatistics( arepo, sinceWhen, results, stats );
               
                dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( dbstats );  
               
                this.task = null;
            }
            catch ( RepositoryException e )
            {  
                throw new TaskExecutionException( "Repository error when executing repository job.", e );
            }   
        }
    }
View Full Code Here

                    indexPacker.packIndex( request );
                }               
            }
            catch ( IOException e )
            {
                throw new TaskExecutionException( "Error occurred while executing indexing task '" +
                    indexingTask.getName() + "'" );
            }
            catch ( UnsupportedExistingLuceneIndexException e )
            {
                throw new TaskExecutionException( "Unsupported Lucene index format: " + e.getMessage() );
            }
            finally
            {
                if( context != null )
                {
                    try
                    {
                        context.close( false );
                    }
                    catch ( IOException e )
                    {
                        throw new TaskExecutionException( "Error occurred while closing context: " + e.getMessage() );
                    }
                }
            }
        }
    }
View Full Code Here

            continuumReleaseManager.getReleaseResults().put( releaseTask.getReleaseId(), result );

            releaseTask.getListener().error( e.getMessage() );

            throw new TaskExecutionException( "Failed to build reactor projects.", e );
        }

        return reactorProjects;
    }
View Full Code Here

            releaseManager.rollback( releaseTask.getDescriptor(), settings, new ArrayList(),
                                     releaseTask.getListener() );
        }
        catch ( ReleaseExecutionException e )
        {
            throw new TaskExecutionException( "Failed to rollback release", e );
        }
        catch ( ReleaseFailureException e )
        {
            throw new TaskExecutionException( "Failed to rollback release", e );
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.taskqueue.execution.TaskExecutionException

Copyright © 2018 www.massapicom. 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.