Package org.apache.archiva.consumers

Examples of org.apache.archiva.consumers.ConsumerException


        {
            checksumSha1 = checksummedFile.calculateChecksum( ChecksumAlgorithm.SHA1 );
        }
        catch ( IOException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }

        MetadataRepository metadataRepository = repositorySession.getRepository();

        List<ArtifactMetadata> results;
        try
        {
            results = metadataRepository.getArtifactsByChecksum( repoId, checksumSha1 );
        }
        catch ( MetadataRepositoryException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }

        if ( CollectionUtils.isNotEmpty( results ) )
        {
            ArtifactMetadata originalArtifact;
            try
            {
                originalArtifact = pathTranslator.getArtifactForPath( repoId, path );
            }
            catch ( Exception e )
            {
                log.warn( "Not reporting problem for invalid artifact in checksum check: " + e.getMessage() );
                return;
            }

            for ( ArtifactMetadata dupArtifact : results )
            {
                String id = path.substring( path.lastIndexOf( "/" ) + 1 );
                if ( dupArtifact.getId().equals( id )
                    && dupArtifact.getNamespace().equals( originalArtifact.getNamespace() )
                    && dupArtifact.getProject().equals( originalArtifact.getProject() )
                    && dupArtifact.getVersion().equals( originalArtifact.getVersion() ) )
                {
                    // Skip reference to itself.
                    if ( log.isDebugEnabled() )
                    {
                        log.debug( "Not counting duplicate for artifact " + dupArtifact + " for path " + path );
                    }
                    continue;
                }

                RepositoryProblemFacet problem = new RepositoryProblemFacet();
                problem.setRepositoryId( repoId );
                problem.setNamespace( originalArtifact.getNamespace() );
                problem.setProject( originalArtifact.getProject() );
                problem.setVersion( originalArtifact.getVersion() );
                problem.setId( id );
                // FIXME: need to get the right storage resolver for the repository the dupe artifact is in, it might be
                //       a different type
                // FIXME: we need the project version here, not the artifact version
                problem.setMessage( "Duplicate Artifact Detected: " + path + " <--> " + pathTranslator.toPath(
                    dupArtifact.getNamespace(), dupArtifact.getProject(), dupArtifact.getVersion(),
                    dupArtifact.getId() ) );
                problem.setProblem( "duplicate-artifact" );

                try
                {
                    metadataRepository.addMetadataFacet( repoId, problem );
                }
                catch ( MetadataRepositoryException e )
                {
                    throw new ConsumerException( e.getMessage(), e );
                }
            }
        }
    }
View Full Code Here


            repositorySession.getRepository().getArtifacts( repository.getId(), artifact.getGroupId(),
                                                            artifact.getArtifactId(), artifact.getVersion() );
        }
        catch ( RepositoryException | LayoutException | MetadataResolutionException e )
        {
            throw new ConsumerException( e.getLocalizedMessage(), e );
        }
    }
View Full Code Here

        {
            this.repository = factory.getManagedRepositoryContent( repository.getId() );
        }
        catch ( RepositoryException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }
    }
View Full Code Here

            {
                consumed.add( repository.toArtifactReference( path ) );
            }
            catch ( LayoutException e )
            {
                throw new ConsumerException( e.getMessage(), e );
            }
        }
    }
View Full Code Here

        {
            repositoryContent = repositoryContentFactory.getManagedRepositoryContent( repository.getId() );
        }
        catch ( RepositoryNotFoundException e )
        {
            throw new ConsumerException( "Can't run repository purge: " + e.getMessage(), e );
        }
        catch ( RepositoryException e )
        {
            throw new ConsumerException( "Can't run repository purge: " + e.getMessage(), e );
        }

        repositorySession = repositorySessionFactory.createSession();

        if ( repository.getDaysOlder() != 0 )
View Full Code Here

            repoPurge.process( path );
        }
        catch ( RepositoryPurgeException rpe )
        {
            throw new ConsumerException( rpe.getMessage(), rpe );
        }
    }
View Full Code Here

            this.repositoryDir = new File( repository.getRepoRoot() );
            this.scanStartTimestamp = System.currentTimeMillis();
        }
        catch ( RepositoryNotFoundException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }
        catch ( RepositoryException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }
    }
View Full Code Here

            log.info( "Creating indexing context for repo : {}", repository.getId() );
            context = managedRepositoryAdmin.createIndexContext( repository );
        }
        catch ( RepositoryAdminException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }
    }
View Full Code Here

            log.debug( "Queueing indexing task '{}' to add or update the artifact in the index.", task );
            scheduler.queueTask( task );
        }
        catch ( TaskQueueException e )
        {
            throw new ConsumerException( e.getMessage(), e );
        }
    }
View Full Code Here

                log.debug( "Queueing indexing task '{}' to add or update the artifact in the index.", task );
                scheduler.queueTask( task );
            }
            catch ( TaskQueueException e )
            {
                throw new ConsumerException( e.getMessage(), e );
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.consumers.ConsumerException

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.