Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.ArtifactReference


        Map ret = new HashMap();

        Iterator it = artifactReferences.iterator();
        while ( it.hasNext() )
        {
            ArtifactReference artifactReference = (ArtifactReference) it.next();
            String key = toVersionlessArtifactKey( artifactReference );
            ret.put( key, artifactReference );
        }

        return ret;
View Full Code Here


        if ( mainArtifactReference == null )
        {
            return ArchivaModelCloner.clone( parentArtifactReference );
        }

        ArtifactReference merged = new ArtifactReference();

        // Unmerged.
        merged.setGroupId( mainArtifactReference.getGroupId() );
        merged.setArtifactId( mainArtifactReference.getArtifactId() );

        // Merged.
        merged.setVersion( merge( mainArtifactReference.getVersion(), parentArtifactReference.getVersion() ) );
        merged.setClassifier( merge( mainArtifactReference.getClassifier(), parentArtifactReference.getClassifier() ) );
        merged.setType( merge( mainArtifactReference.getType(), parentArtifactReference.getType() ) );

        return merged;
    }
View Full Code Here

        Iterator it = mainArtifactReferenceMap.entrySet().iterator();
        while ( it.hasNext() )
        {
            Map.Entry entry = (Entry) it.next();
            String key = (String) entry.getKey();
            ArtifactReference mainArtifactReference = (ArtifactReference) entry.getValue();
            ArtifactReference parentArtifactReference = (ArtifactReference) parentArtifactReferenceMap.get( key );

            if ( parentArtifactReference == null )
            {
                merged.add( mainArtifactReference );
            }
View Full Code Here

        {
            return;
        }

        // Find winning node.
        ArtifactReference winningArtifact = findWinningArtifact( this.foundNodesMap.values() );
        DependencyGraphNode winningNode = graph.getNode( winningArtifact );

        // Gather up Losing Nodes.
        Set losingNodes = new HashSet();
        Predicate losersPredicate = NotPredicate.getInstance( new NodeLocationPredicate( winningArtifact ) );
View Full Code Here

    private ListOrderedMap nodes = new ListOrderedMap();

    public DependencyGraph( String groupId, String artifactId, String version )
    {
        ArtifactReference rootRef = new ArtifactReference();
        rootRef.setGroupId( groupId );
        rootRef.setArtifactId( artifactId );
        rootRef.setVersion( version );
        rootRef.setClassifier( "" );
        rootRef.setType( "pom" );

        this.rootNode = new DependencyGraphNode( rootRef );
    }
View Full Code Here

        }

        if ( model.getRelocation() != null )
        {
            // We need to CHANGE this node.
            ArtifactReference refTO = new ArtifactReference();

            refTO.setGroupId( fromNode.getArtifact().getGroupId() );
            refTO.setArtifactId( fromNode.getArtifact().getArtifactId() );
            refTO.setVersion( fromNode.getArtifact().getVersion() );
            refTO.setClassifier( fromNode.getArtifact().getClassifier() );
            refTO.setType( fromNode.getArtifact().getType() );

            VersionedReference relocation = model.getRelocation();

            if ( StringUtils.isNotBlank( relocation.getGroupId() ) )
            {
                refTO.setGroupId( relocation.getGroupId() );
            }

            if ( StringUtils.isNotBlank( relocation.getArtifactId() ) )
            {
                refTO.setArtifactId( relocation.getArtifactId() );
            }

            if ( StringUtils.isNotBlank( relocation.getVersion() ) )
            {
                refTO.setVersion( relocation.getVersion() );
            }

            DependencyGraphNode nodeTO = new DependencyGraphNode( refTO );

            graph.addNode( nodeTO );
            collapseNodes( graph, fromNode, nodeTO );
            return;
        }

        boolean isRootNode = graph.getRootNode().equals( fromNode );

        Iterator it;

        if ( CollectionUtils.isNotEmpty( model.getDependencyManagement() ) )
        {
            it = model.getDependencyManagement().iterator();
            while ( it.hasNext() )
            {
                Dependency dependency = (Dependency) it.next();
                fromNode.addDependencyManagement( dependency );
            }
        }

        if ( CollectionUtils.isNotEmpty( model.getDependencies() ) )
        {
            it = model.getDependencies().iterator();
            while ( it.hasNext() )
            {
                Dependency dependency = (Dependency) it.next();

                String scope = dependency.getScope();

                // Test scopes *NOT* from root node can be skipped.
                if ( DependencyScope.TEST.equals( scope ) && !isRootNode )
                {
                    // skip add of test scope
                    continue;
                }

                ArtifactReference artifactRef = new ArtifactReference();
                artifactRef.setGroupId( dependency.getGroupId() );
                artifactRef.setArtifactId( dependency.getArtifactId() );
                artifactRef.setVersion( dependency.getVersion() );
                artifactRef.setClassifier( dependency.getClassifier() );
                artifactRef.setType( dependency.getType() );

                DependencyGraphNode toNode = new DependencyGraphNode( artifactRef );

                if ( CollectionUtils.isNotEmpty( dependency.getExclusions() ) )
                {
View Full Code Here

    }

    public void testGetRelatedArtifacts()
        throws Exception
    {
        ArtifactReference reference = createArtifact( "org.apache.maven", "testing", "1.0", null, "jar" );

        Set<ArtifactReference> related = repoContent.getRelatedArtifacts( reference );
        assertNotNull( related );

        String expected[] = new String[] {
View Full Code Here

        throws Exception
    {
        String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":"
            + ( classifier != null ? classifier + ":" : "" ) + type;

        ArtifactReference reference = repoRequest.toArtifactReference( path );

        assertNotNull( expectedId + " - Should not be null.", reference );

        assertEquals( expectedId + " - Group ID", groupId, reference.getGroupId() );
        assertEquals( expectedId + " - Artifact ID", artifactId, reference.getArtifactId() );
        if ( StringUtils.isNotBlank( classifier ) )
        {
            assertEquals( expectedId + " - Classifier", classifier, reference.getClassifier() );
        }
        assertEquals( expectedId + " - Version ID", version, reference.getVersion() );
        assertEquals( expectedId + " - Type", type, reference.getType() );
    }
View Full Code Here

     */
    private void assertLayout( String path, String groupId, String artifactId, String version, String classifier, String type )
        throws LayoutException
    {
        // Path to Artifact Reference.
        ArtifactReference testReference = LegacyPathParser.toArtifactReference( path );
        assertArtifactReference( testReference, groupId, artifactId, version, classifier, type );
    }
View Full Code Here

        // Not any of the above? Then it's gotta be an artifact reference.
        try
        {
            // Get the artifact reference in a layout neutral way.
            ArtifactReference artifact = repositoryRequest.toArtifactReference( resource );

            if ( artifact != null )
            {
                applyServerSideRelocation( artifact );
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.ArtifactReference

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.