Package org.sonatype.aether.spi.connector

Examples of org.sonatype.aether.spi.connector.MetadataDownload


        }

        File targetFile = TestFileUtils.createTempFile( "" );
        TestFileUtils.delete( targetFile );

        MetadataDownload down = new MetadataDownload();
        down.setChecksumPolicy( RepositoryPolicy.CHECKSUM_POLICY_FAIL );
        down.setMetadata( metadata ).setFile( targetFile );
        worker = new FileRepositoryWorker( down, repository, session );
        worker.setFileProcessor( TestFileProcessor.INSTANCE );
        worker.run();

        if ( down.getException() != null )
        {
            throw down.getException();
        }

        assertTrue( "download did not happen.", targetFile.exists() );

        assertContentEquals( targetFile, expectedContent );
View Full Code Here


                for ( UpdateCheck<Metadata, MetadataTransferException> check : checks )
                {
                    repositories.add( check.getAuthoritativeRepository() );
                }

                MetadataDownload download = new MetadataDownload();
                download.setMetadata( metadata );
                download.setRequestContext( request.getRequestContext() );
                download.setFile( metadataFile );
                download.setChecksumPolicy( policy );
                download.setRepositories( repositories );

                RepositoryConnector connector =
                    remoteRepositoryManager.getRepositoryConnector( session, requestRepository );
                try
                {
                    connector.get( null, Arrays.asList( download ) );
                }
                finally
                {
                    connector.close();
                }

                exception = download.getException();

                if ( exception == null )
                {

                    List<String> contexts = Collections.singletonList( request.getRequestContext() );
                    LocalMetadataRegistration registration =
                        new LocalMetadataRegistration( metadata, requestRepository, contexts );

                    session.getLocalRepositoryManager().add( session, registration );
                }
                else if ( request.isDeleteLocalCopyIfMissing() && exception instanceof MetadataNotFoundException )
                {
                    download.getFile().delete();
                }
            }
            catch ( NoRepositoryConnectorException e )
            {
                exception = new MetadataTransferException( metadata, requestRepository, e );
View Full Code Here

                    event.setRepository( repository );
                    repositoryEventDispatcher.dispatch( event );
                }

                RepositoryPolicy policy = getPolicy( session, repository, metadata.getNature() );
                MetadataDownload download = new MetadataDownload();
                download.setMetadata( metadata );
                download.setFile( dstFile );
                download.setChecksumPolicy( policy.getChecksumPolicy() );
                connector.get( null, Arrays.asList( download ) );

                Exception error = download.getException();

                if ( error instanceof MetadataNotFoundException )
                {
                    dstFile.delete();
                }
View Full Code Here

TOP

Related Classes of org.sonatype.aether.spi.connector.MetadataDownload

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.