Java Code Examples for org.apache.maven.wagon.Wagon#get()

The following examples show how to use org.apache.maven.wagon.Wagon#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryModelResolver.java    From archiva with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param wagon The wagon instance that should be connected.
 * @param remoteRepository The repository from where the checksum file should be retrieved
 * @param remotePath The remote path of the artifact (without extension)
 * @param resource The local artifact (without extension)
 * @param workingDir The working directory where the downloaded file should be placed to
 * @param ext The extension of th checksum file
 * @return The file where the data has been downloaded to.
 * @throws AuthorizationException
 * @throws TransferFailedException
 * @throws ResourceDoesNotExistException
 */
private Path transferChecksum( final Wagon wagon, final RemoteRepository remoteRepository,
                               final String remotePath, final Path resource,
                               final Path workingDir, final String ext )
    throws AuthorizationException, TransferFailedException, ResourceDoesNotExistException
{
    Path destFile = workingDir.resolve( resource.getFileName() + ext );
    String remoteChecksumPath = remotePath + ext;

    log.info( "Retrieving {} from {}", remoteChecksumPath, remoteRepository.getName() );

    wagon.get( addParameters( remoteChecksumPath, remoteRepository ), destFile.toFile() );

    log.debug( "Downloaded successfully." );

    return destFile;
}
 
Example 2
Source File: DefaultVersionsHelper.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Deprecated
private static RuleSet getRuleSet( Wagon wagon, String remoteURI )
    throws IOException, AuthorizationException, TransferFailedException, ResourceDoesNotExistException
{
    File tempFile = File.createTempFile( "ruleset", ".xml" );
    try
    {
        wagon.get( remoteURI, tempFile );
        InputStream is = new FileInputStream(tempFile );
        try
        {
            return readRulesFromStream(is);
        }
        finally
        {
            try
            {
                is.close();
            }
            catch ( IOException e )
            {
                // ignore
            }
        }
    }
    finally
    {
        if ( !tempFile.delete() )
        {
            // maybe we can delete this later
            tempFile.deleteOnExit();
        }
    }
}