Package org.apache.maven.archiva.model

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


        // 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( path );

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


        {
            return;
        }

        // Build the artifact POM reference
        ArtifactReference pomReference = new ArtifactReference();
        pomReference.setGroupId( artifact.getGroupId() );
        pomReference.setArtifactId( artifact.getArtifactId() );
        pomReference.setVersion( artifact.getVersion() );
        pomReference.setType( "pom" );

        // Get the artifact POM from proxied repositories if needed
        connectors.fetchFromProxies( managedRepository, pomReference );

        // Open and read the POM from the managed repo
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

        Map<String, ArtifactReference> parentArtifactReferenceMap = createArtifactReferenceMap( parentArtifactReferences );

        for ( Map.Entry<String,ArtifactReference> entry : mainArtifactReferenceMap.entrySet() )
        {
            String key = entry.getKey();
            ArtifactReference mainArtifactReference = (ArtifactReference) entry.getValue();
            ArtifactReference parentArtifactReference = parentArtifactReferenceMap.get( key );

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

            {
                // Nothing to do here, file doesn't exist, skip it.
                return;
            }

            ArtifactReference artifact = repository.toArtifactReference( path );

            if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
            {
                // Nothing to do here, not a snapshot, skip it.
                return;
            }

            ProjectReference reference = new ProjectReference();
            reference.setGroupId( artifact.getGroupId() );
            reference.setArtifactId( artifact.getArtifactId() );

            // Gather up all of the versions.
            List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) );

            // Split the versions into released and snapshots.
            List<String> releasedVersions = new ArrayList<String>();
            List<String> snapshotVersions = new ArrayList<String>();

            for ( String version : allVersions )
            {
                if ( VersionUtil.isSnapshot( version ) )
                {
                    snapshotVersions.add( version );
                }
                else
                {
                    releasedVersions.add( version );
                }
            }

            Collections.sort( allVersions, VersionComparator.getInstance() );
            Collections.sort( releasedVersions, VersionComparator.getInstance() );
            Collections.sort( snapshotVersions, VersionComparator.getInstance() );

            VersionedReference versionRef = new VersionedReference();
            versionRef.setGroupId( artifact.getGroupId() );
            versionRef.setArtifactId( artifact.getArtifactId() );

            for ( String version : snapshotVersions )
            {
                if ( releasedVersions.contains( VersionUtil.getReleaseVersion( version ) ) )
                {
View Full Code Here

            String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i] );

            if ( filetypes.matchesArtifactPattern( relativePath ) )
            {
                ArtifactReference artifact = toArtifactReference( relativePath );

                // Test for related, groupId / artifactId / version must match.
                if ( artifact.getGroupId().equals( reference.getGroupId() ) &&
                    artifact.getArtifactId().equals( reference.getArtifactId() ) &&
                    artifact.getVersion().equals( reference.getVersion() ) )
                {
                    foundArtifacts.add( artifact );
                }
            }
        }
View Full Code Here

                continue;
            }

            if ( filetypes.matchesArtifactPattern( relativePath ) )
            {
                ArtifactReference artifact = toArtifactReference( relativePath );

                foundVersions.add( artifact.getVersion() );
            }
        }

        return foundVersions;
    }
View Full Code Here

            String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i] );

            if ( filetypes.matchesArtifactPattern( relativePath ) )
            {
                ArtifactReference artifact = toArtifactReference( relativePath );

                return artifact;
            }
        }
View Full Code Here

            if ( !artifactFile.exists() )
            {
                return;
            }

            ArtifactReference artifact = repository.toArtifactReference( path );

            Calendar olderThanThisDate = Calendar.getInstance( DateUtils.UTC_TIME_ZONE );
            olderThanThisDate.add( Calendar.DATE, -daysOlder );

            // respect retention count
            VersionedReference reference = new VersionedReference();
            reference.setGroupId( artifact.getGroupId() );
            reference.setArtifactId( artifact.getArtifactId() );
            reference.setVersion( artifact.getVersion() );

            List<String> versions = new ArrayList<String>( repository.getVersions( reference ) );

            Collections.sort( versions, VersionComparator.getInstance() );

            if ( retentionCount > versions.size() )
            {
                // Done. nothing to do here. skip it.
                return;
            }

            int countToPurge = versions.size() - retentionCount;

            for ( String version : versions )
            {
                if ( countToPurge <= 0 )
                {
                    break;
                }

                ArtifactReference newArtifactReference =
                    repository.toArtifactReference( artifactFile.getAbsolutePath() );
                newArtifactReference.setVersion( version );

                File newArtifactFile = repository.toFile( newArtifactReference );

                // Is this a generic snapshot "1.0-SNAPSHOT" ?
                if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion() ) )
                {
                    if ( newArtifactFile.lastModified() < olderThanThisDate.getTimeInMillis() )
                    {
                        doPurgeAllRelated( newArtifactReference );
                        countToPurge--;
                    }
                }
                // Is this a timestamp snapshot "1.0-20070822.123456-42" ?
                else if ( VersionUtil.isUniqueSnapshot( newArtifactReference.getVersion() ) )
                {
                    Calendar timestampCal = uniqueSnapshotToCalendar( newArtifactReference.getVersion() );

                    if ( timestampCal.getTimeInMillis() < olderThanThisDate.getTimeInMillis() )
                    {
                        doPurgeAllRelated( newArtifactReference );
                        countToPurge--;
View Full Code Here

            if ( !artifactFile.exists() )
            {
                return;
            }

            ArtifactReference artifact = repository.toArtifactReference( path );

            if ( VersionUtil.isSnapshot( artifact.getVersion() ) )
            {
                VersionedReference reference = new VersionedReference();
                reference.setGroupId( artifact.getGroupId() );
                reference.setArtifactId( artifact.getArtifactId() );
                reference.setVersion( artifact.getVersion() );

                List<String> versions = new ArrayList<String>( repository.getVersions( reference ) );

                Collections.sort( versions, VersionComparator.getInstance() );
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.