Package org.apache.archiva.metadata.repository

Examples of org.apache.archiva.metadata.repository.MetadataRepository


    private List<RepositoryStatistics> getMultipleRepositoriesReport( List<String> repositoriesId, int rowCount )
    {
        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();
            List<RepositoryStatistics> stats = new ArrayList<>();
            for ( String repo : repositoriesId )
            {
                try
                {
View Full Code Here


                                                                  Date endDate )
    {
        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();
            List<RepositoryStatistics> stats = null;
            try
            {
                stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repositoryId, startDate,
                                                                          endDate );
View Full Code Here

            {
                observableRepositories = Collections.singletonList( repository );
            }

            List<RepositoryProblemFacet> problemArtifacts = new ArrayList<>();
            MetadataRepository metadataRepository = repositorySession.getRepository();
            for ( String repoId : observableRepositories )
            {
                for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
                {
                    RepositoryProblemFacet metadataFacet =
                        (RepositoryProblemFacet) metadataRepository.getMetadataFacet( repoId,
                                                                                      RepositoryProblemFacet.FACET_ID,
                                                                                      name );
                    if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
                    {
                        problemArtifacts.add( metadataFacet );
View Full Code Here

        RepositorySession repositorySession = repositorySessionFactory.createSession();

        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();

            metadataRepository.updateProjectVersion( repositoryId, groupId, artifactId, projectVersionMetadata );

            repositorySession.save();
        }
        catch ( MetadataRepositoryException e )
        {
View Full Code Here

        RepositorySession repositorySession = repositorySessionFactory.createSession();

        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();

            metadataRepository.updateProjectVersion( repositoryId, groupId, artifactId, projectVersionMetadata );

            repositorySession.save();
        }
        catch ( MetadataRepositoryException e )
        {
View Full Code Here

    private List<RepositoryStatistics> getMultipleRepositoriesReport( List<String> repositoriesId, int rowCount )
    {
        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();
            List<RepositoryStatistics> stats = new ArrayList<RepositoryStatistics>();
            for ( String repo : repositoriesId )
            {
                try
                {
View Full Code Here

                                                                  Date endDate )
    {
        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();
            List<RepositoryStatistics> stats = null;
            try
            {
                stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repositoryId, startDate,
                                                                          endDate );
View Full Code Here

            {
                observableRepositories = Collections.<String>singletonList( repository );
            }

            List<RepositoryProblemFacet> problemArtifacts = new ArrayList<RepositoryProblemFacet>();
            MetadataRepository metadataRepository = repositorySession.getRepository();
            for ( String repoId : observableRepositories )
            {
                for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
                {
                    RepositoryProblemFacet metadataFacet =
                        (RepositoryProblemFacet) metadataRepository.getMetadataFacet( repoId,
                                                                                      RepositoryProblemFacet.FACET_ID,
                                                                                      name );
                    if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
                    {
                        problemArtifacts.add( metadataFacet );
View Full Code Here

            project.setNamespace( artifact.getNamespace() );
            project.setId( artifact.getProject() );

            String projectVersion = VersionUtil.getBaseVersion( artifact.getVersion() );

            MetadataRepository metadataRepository = repositorySession.getRepository();

            boolean createVersionMetadata = false;

            // FIXME: maybe not too efficient since it may have already been read and stored for this artifact
            ProjectVersionMetadata versionMetadata = null;
            try
            {
                ReadMetadataRequest readMetadataRequest =
                    new ReadMetadataRequest().repositoryId( repoId ).namespace( artifact.getNamespace() ).projectId(
                        artifact.getProject() ).projectVersion( projectVersion );
                versionMetadata = repositoryStorage.readProjectVersionMetadata( readMetadataRequest );
                createVersionMetadata = true;
            }
            catch ( RepositoryStorageMetadataNotFoundException e )
            {
                log.warn( "Missing or invalid POM for artifact:{} (repository:{}); creating empty metadata", path,
                          repoId );

                versionMetadata = new ProjectVersionMetadata();
                versionMetadata.setId( projectVersion );
                versionMetadata.setIncomplete( true );
                createVersionMetadata = true;
            }
            catch ( RepositoryStorageMetadataInvalidException e )
            {
                log.warn( "Error occurred resolving POM for artifact:{} (repository:{}); message: {}",
                          new Object[]{ path, repoId, e.getMessage() } );
            }

            // read the metadata and update it if it is newer or doesn't exist
            artifact.setWhenGathered( whenGathered );
            metadataRepository.updateArtifact( repoId, project.getNamespace(), project.getId(), projectVersion,
                                               artifact );
            if ( createVersionMetadata )
            {
                metadataRepository.updateProjectVersion( repoId, project.getNamespace(), project.getId(),
                                                         versionMetadata );
            }
            metadataRepository.updateProject( repoId, project );
            repositorySession.save();
        }
        catch ( MetadataRepositoryException e )
        {
            log.warn(
View Full Code Here

        // Remove problems associated with this version on successful addition
        // TODO: this removes all problems - do we need something that just remove the problems we know are corrected?
        String name = RepositoryProblemFacet.createName( namespace, projectId, metadata.getId(), null );
        try
        {
            MetadataRepository metadataRepository = session.getRepository();
            metadataRepository.removeMetadataFacet( repoId, RepositoryProblemFacet.FACET_ID, name );
            session.markDirty();
        }
        catch ( MetadataRepositoryException e )
        {
            log.warn( "Unable to remove repository problem facets for the version being corrected in the repository: {}",
View Full Code Here

TOP

Related Classes of org.apache.archiva.metadata.repository.MetadataRepository

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.