Examples of ArtifactReference


Examples of org.apache.archiva.model.ArtifactReference

     * @param classifier TODO
     */
    private void assertLayout( String path, String groupId, String artifactId, String version, String classifier, String type )
        throws LayoutException
    {
        ArtifactReference expectedArtifact = createArtifact( groupId, artifactId, version, classifier, type );

        // --- Artifact Tests.
        // Artifact to Path
        assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( expectedArtifact ) );

        // --- Artifact Reference Tests

        // Path to Artifact Reference.
        ArtifactReference testReference = toArtifactReference( path );
        assertArtifactReference( testReference, groupId, artifactId, version, classifier, type );

        // And back again, using test Reference from previous step.
        assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( testReference ) );
    }
View Full Code Here

Examples of org.apache.archiva.model.ArtifactReference

        assertEquals( expectedId + " - Type", type, actualReference.getType() );
    }

    protected ArtifactReference createArtifact( String groupId, String artifactId, String version, String classifier, String type )
    {
        ArtifactReference artifact = new ArtifactReference();
        artifact.setGroupId( groupId );
        artifact.setArtifactId( artifactId );
        artifact.setVersion( version );
        artifact.setClassifier( classifier );
        artifact.setType( type );
        assertNotNull( artifact );
        return artifact;
    }
View Full Code Here

Examples of org.apache.archiva.model.ArtifactReference

        log.info( "Processing entry [" + path + "] from repository [" + this.repository.getId() + "]" );

        try
        {
            ManagedRepositoryContent repositoryContent = repositoryContentFactory.getManagedRepositoryContent( repository.getId() );
            ArtifactReference artifact = repositoryContent.toArtifactReference( path );

            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

Examples of org.apache.archiva.model.ArtifactReference

                // check if target repo is enabled for releases
                // we suppose that release-artifacts can be deployed only to repos enabled for releases
                if ( managedRepository.getRepository().isReleases() && !repositoryRequest.isMetadata( resourcePath )
                    && !repositoryRequest.isSupportFile( resourcePath ) )
                {
                    ArtifactReference artifact = null;
                    try
                    {
                        artifact = managedRepository.toArtifactReference( resourcePath );

                        if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
                        {
                            // check if artifact already exists and if artifact re-deployment to the repository is allowed
                            if ( managedRepository.hasContent( artifact )
                                && managedRepository.getRepository().isBlockRedeployments() )
                            {
View Full Code Here

Examples of org.apache.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 );

                File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact );

                resource.setPath( managedRepository.toPath( artifact ) );
                if ( log.isDebugEnabled() )
                {
                    log.debug( "Proxied artifact '" + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
                                   + artifact.getVersion() + "'" );
                }
                return ( proxiedFile != null );
            }
        }
        catch ( LayoutException e )
View Full Code Here

Examples of org.apache.archiva.model.ArtifactReference

        {
            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

Examples of org.apache.archiva.model.ArtifactReference

            throw new ArchivaRestServiceException( e.getMessage() );
        }

        // sounds good we can continue !

        ArtifactReference artifactReference = new ArtifactReference();
        artifactReference.setArtifactId( artifactTransferRequest.getArtifactId() );
        artifactReference.setGroupId( artifactTransferRequest.getGroupId() );
        artifactReference.setVersion( artifactTransferRequest.getVersion() );
        artifactReference.setClassifier( artifactTransferRequest.getClassifier() );
        String packaging = StringUtils.trim( artifactTransferRequest.getPackaging() );
        artifactReference.setType( StringUtils.isEmpty( packaging ) ? "jar" : packaging );

        try
        {

            ManagedRepositoryContent sourceRepository =
View Full Code Here

Examples of org.apache.archiva.model.ArtifactReference

                if ( StringUtils.isBlank( artifact.getPackaging() ) )
                {
                    throw new ArchivaRestServiceException( "You must configure a type/packaging when using classifier",
                                                           400 );
                }
                ArtifactReference artifactReference = new ArtifactReference();
                artifactReference.setArtifactId( artifact.getArtifactId() );
                artifactReference.setGroupId( artifact.getGroupId() );
                artifactReference.setVersion( artifact.getVersion() );
                artifactReference.setClassifier( artifact.getClassifier() );
                artifactReference.setType( artifact.getPackaging() );
                repository.deleteArtifact( artifactReference );

                // TODO cleanup facet which contains classifier information
                return Boolean.TRUE;
            }
View Full Code Here

Examples of org.apache.archiva.model.ArtifactReference

            String relativePath = PathUtil.getRelative( managedRepository.getRepoRoot(), repoFiles[i] );

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

                return artifact;
            }
        }
View Full Code Here

Examples of org.apache.archiva.model.ArtifactReference

             */
            return requestedPath;
        }

        // Treat as an artifact reference.
        ArtifactReference ref = toArtifactReference( referencedResource );
        String adjustedPath = repository.toPath( ref );
        return adjustedPath + supportfile;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.