Package org.apache.archiva.metadata.repository.storage.maven2

Examples of org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacetFactory


        ref.setGroupId( artifactMetadata.getNamespace() );
        ref.setVersion( artifactMetadata.getVersion() );

        String type = null, classifier = null;

        MavenArtifactFacet facet = (MavenArtifactFacet) artifactMetadata.getFacet( MavenArtifactFacet.FACET_ID );
        if ( facet != null )
        {
            type = facet.getType();
            classifier = facet.getClassifier();
        }

        ref.setClassifier( classifier );
        ref.setType( type );
        File file = managedRepositoryContent.toFile( ref );
View Full Code Here


    private void populateSharedModel( RepositorySession repositorySession, MetadataResolver metadataResolver,
                                      Collection<String> selectedRepos, Collection<String> projectVersions )
    {
        sharedModel = new ProjectVersionMetadata();

        MavenProjectFacet mavenFacet = new MavenProjectFacet();
        mavenFacet.setGroupId( groupId );
        mavenFacet.setArtifactId( artifactId );
        sharedModel.addFacet( mavenFacet );

        boolean isFirstVersion = true;

        for ( String version : projectVersions )
        {
            ProjectVersionMetadata versionMetadata = null;
            for ( String repoId : selectedRepos )
            {
                if ( versionMetadata == null )
                {
                    try
                    {
                        versionMetadata =
                            metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId, artifactId,
                                                                    version );
                    }
                    catch ( MetadataResolutionException e )
                    {
                        log.error(
                            "Skipping invalid metadata while compiling shared model for " + groupId + ":" + artifactId
                                + " in repo " + repoId + ": " + e.getMessage() );
                    }
                }
            }

            if ( versionMetadata == null )
            {
                continue;
            }

            if ( isFirstVersion )
            {
                sharedModel = versionMetadata;
                sharedModel.setId( null );
            }
            else
            {
                MavenProjectFacet versionMetadataMavenFacet =
                    (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
                if ( versionMetadataMavenFacet != null )
                {
                    if ( mavenFacet.getPackaging() != null && !StringUtils.equalsIgnoreCase( mavenFacet.getPackaging(),
                                                                                             versionMetadataMavenFacet.getPackaging() ) )
                    {
                        mavenFacet.setPackaging( null );
                    }
                }
View Full Code Here

        assertEquals( TEST_CI_URL, model.getCiManagement( ).getUrl( ) );
        assertEquals( TEST_SCM_CONNECTION, model.getScm( ).getConnection( ) );
        assertEquals( TEST_SCM_DEV_CONNECTION, model.getScm( ).getDeveloperConnection( ) );
        assertEquals( TEST_SCM_URL, model.getScm( ).getUrl( ) );

        MavenProjectFacet mavenFacet = (MavenProjectFacet) model.getFacet( MavenProjectFacet.FACET_ID );
        assertEquals( groupId, mavenFacet.getGroupId( ) );
        assertEquals( artifactId, mavenFacet.getArtifactId( ) );
        assertEquals( TEST_PACKAGING, mavenFacet.getPackaging( ) );
        assertEquals( TEST_PARENT_GROUP_ID, mavenFacet.getParent( ).getGroupId( ) );
        assertEquals( TEST_PARENT_ARTIFACT_ID, mavenFacet.getParent( ).getArtifactId( ) );
        assertEquals( TEST_PARENT_VERSION, mavenFacet.getParent( ).getVersion( ) );
    }
View Full Code Here

        scm.setConnection( TEST_SCM_CONNECTION );
        scm.setDeveloperConnection( TEST_SCM_DEV_CONNECTION );
        scm.setUrl( TEST_SCM_URL );
        model.setScm( scm );

        MavenProjectFacet mavenProjectFacet = new MavenProjectFacet( );
        mavenProjectFacet.setGroupId( groupId );
        mavenProjectFacet.setArtifactId( artifactId );
        mavenProjectFacet.setPackaging( TEST_PACKAGING );
        MavenProjectParent parent = new MavenProjectParent( );
        parent.setGroupId( TEST_PARENT_GROUP_ID );
        parent.setArtifactId( TEST_PARENT_ARTIFACT_ID );
        parent.setVersion( TEST_PARENT_VERSION );
        mavenProjectFacet.setParent( parent );
        model.addFacet( mavenProjectFacet );

        GenericMetadataFacet genericMetadataFacet = new GenericMetadataFacet( );
        Map<String, String> props = new HashMap<String, String>( );
        props.put( TEST_GENERIC_METADATA_PROPERTY_NAME, TEST_GENERIC_METADATA_PROPERTY_VALUE );
View Full Code Here

                            if ( model != null )
                            {
                                String packaging = "jar";

                                MavenProjectFacet facet = (MavenProjectFacet) model.getFacet(
                                    MavenProjectFacet.FACET_ID );
                                if ( facet != null && facet.getPackaging() != null )
                                {
                                    packaging = facet.getPackaging();
                                }
                                artifact = new Artifact( repoId, resultHit.getGroupId(), resultHit.getArtifactId(),
                                                         version, packaging );
                                break;
                            }
View Full Code Here

        searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
                                              results );

        ProjectVersionMetadata model = new ProjectVersionMetadata();
        model.setId( "1.0" );
        MavenProjectFacet facet = new MavenProjectFacet();
        facet.setPackaging( "war" );
        model.addFacet( facet );

        metadataResolverControl.expectAndReturn(
            metadataResolver.resolveProjectVersion( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
                                                    "archiva-webapp", "1.0" ), model );
View Full Code Here

        searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
                                              results );

        ProjectVersionMetadata model = new ProjectVersionMetadata();
        model.setId( "1.0" );
        MavenProjectFacet facet = new MavenProjectFacet();
        facet.setPackaging( "jar" );
        model.addFacet( facet );

        metadataResolverControl.expectAndReturn(
            metadataResolver.resolveProjectVersion( repositorySession, "repo1.mirror", ARCHIVA_TEST_GROUP_ID,
                                                    ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
View Full Code Here

            MetadataResolver metadataResolver = repositorySession.getResolver();

            ProjectVersionMetadata sharedModel = new ProjectVersionMetadata();

            MavenProjectFacet mavenFacet = new MavenProjectFacet();
            mavenFacet.setGroupId( groupId );
            mavenFacet.setArtifactId( artifactId );
            sharedModel.addFacet( mavenFacet );

            boolean isFirstVersion = true;

            for ( String version : projectVersions )
            {
                ProjectVersionMetadata versionMetadata = null;
                for ( String repoId : selectedRepos )
                {
                    if ( versionMetadata == null || versionMetadata.isIncomplete() )
                    {
                        try
                        {
                            ProjectVersionMetadata projectVersionMetadataResolved = null;
                            boolean useCache = !StringUtils.endsWith( version, VersionUtil.SNAPSHOT );
                            String cacheKey = null;
                            boolean cacheToUpdate = false;
                            // FIXME a bit maven centric!!!
                            // not a snapshot so get it from cache
                            if ( useCache )
                            {
                                cacheKey = repoId + groupId + artifactId + version;
                                projectVersionMetadataResolved = versionMetadataCache.get( cacheKey );
                            }
                            if ( useCache && projectVersionMetadataResolved != null )
                            {
                                versionMetadata = projectVersionMetadataResolved;
                            }
                            else
                            {
                                projectVersionMetadataResolved =
                                    metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId,
                                                                            artifactId, version );
                                versionMetadata = projectVersionMetadataResolved;
                                cacheToUpdate = true;
                            }

                            if ( useCache && cacheToUpdate )
                            {
                                versionMetadataCache.put( cacheKey, projectVersionMetadataResolved );
                            }

                        }
                        catch ( MetadataResolutionException e )
                        {
                            log.error( "Skipping invalid metadata while compiling shared model for " + groupId + ":"
                                           + artifactId + " in repo " + repoId + ": " + e.getMessage() );
                        }
                    }
                }

                if ( versionMetadata == null )
                {
                    continue;
                }

                if ( isFirstVersion )
                {
                    sharedModel = versionMetadata;
                    sharedModel.setId( null );
                }
                else
                {
                    MavenProjectFacet versionMetadataMavenFacet =
                        (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
                    if ( versionMetadataMavenFacet != null )
                    {
                        if ( mavenFacet.getPackaging() != null //
                            && !StringUtils.equalsIgnoreCase( mavenFacet.getPackaging(),
                                                              versionMetadataMavenFacet.getPackaging() ) )
                        {
                            mavenFacet.setPackaging( null );
                        }
                    }
View Full Code Here

            MetadataResolver metadataResolver = repositorySession.getResolver();

            ProjectVersionMetadata sharedModel = new ProjectVersionMetadata();

            MavenProjectFacet mavenFacet = new MavenProjectFacet();
            mavenFacet.setGroupId( groupId );
            mavenFacet.setArtifactId( artifactId );
            sharedModel.addFacet( mavenFacet );

            boolean isFirstVersion = true;

            for ( String version : projectVersions )
            {
                ProjectVersionMetadata versionMetadata = null;
                for ( String repoId : selectedRepos )
                {
                    if ( versionMetadata == null || versionMetadata.isIncomplete() )
                    {
                        try
                        {
                            versionMetadata =
                                metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId, artifactId,
                                                                        version );
                        }
                        catch ( MetadataResolutionException e )
                        {
                            log.error( "Skipping invalid metadata while compiling shared model for " + groupId + ":"
                                           + artifactId + " in repo " + repoId + ": " + e.getMessage() );
                        }
                    }
                }

                if ( versionMetadata == null )
                {
                    continue;
                }

                if ( isFirstVersion )
                {
                    sharedModel = versionMetadata;
                    sharedModel.setId( null );
                }
                else
                {
                    MavenProjectFacet versionMetadataMavenFacet =
                        (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
                    if ( versionMetadataMavenFacet != null )
                    {
                        if ( mavenFacet.getPackaging() != null && !StringUtils.equalsIgnoreCase(
                            mavenFacet.getPackaging(), versionMetadataMavenFacet.getPackaging() ) )
                        {
                            mavenFacet.setPackaging( null );
                        }
                    }
View Full Code Here

            MetadataResolver metadataResolver = repositorySession.getResolver();

            ProjectVersionMetadata sharedModel = new ProjectVersionMetadata();

            MavenProjectFacet mavenFacet = new MavenProjectFacet();
            mavenFacet.setGroupId( groupId );
            mavenFacet.setArtifactId( artifactId );
            sharedModel.addFacet( mavenFacet );

            boolean isFirstVersion = true;

            for ( String version : projectVersions )
            {
                ProjectVersionMetadata versionMetadata = null;
                for ( String repoId : selectedRepos )
                {
                    if ( versionMetadata == null || versionMetadata.isIncomplete() )
                    {
                        try
                        {
                            versionMetadata =
                                metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId, artifactId,
                                                                        version );
                        }
                        catch ( MetadataResolutionException e )
                        {
                            log.error( "Skipping invalid metadata while compiling shared model for " + groupId + ":"
                                           + artifactId + " in repo " + repoId + ": " + e.getMessage() );
                        }
                    }
                }

                if ( versionMetadata == null )
                {
                    continue;
                }

                if ( isFirstVersion )
                {
                    sharedModel = versionMetadata;
                    sharedModel.setId( null );
                }
                else
                {
                    MavenProjectFacet versionMetadataMavenFacet =
                        (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
                    if ( versionMetadataMavenFacet != null )
                    {
                        if ( mavenFacet.getPackaging() != null && !StringUtils.equalsIgnoreCase(
                            mavenFacet.getPackaging(), versionMetadataMavenFacet.getPackaging() ) )
                        {
                            mavenFacet.setPackaging( null );
                        }
                    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacetFactory

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.