[MNG-1908] rollback the change on trunk since it degrades performance significantly at present

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@390765 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2006-04-02 00:32:42 +00:00
parent 7f3012c19f
commit bc048ca9cc
3 changed files with 84 additions and 137 deletions

View File

@ -255,8 +255,7 @@ public class DefaultWagonManager
}
}
// if it already exists locally we were just trying to force it - ignore the update
if ( !successful && !artifact.getFile().exists() )
if ( !successful )
{
throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" );
}
@ -350,8 +349,6 @@ public class DefaultWagonManager
File temp = new File( destination + ".tmp" );
temp.deleteOnExit();
boolean downloaded = false;
try
{
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
@ -369,18 +366,8 @@ public class DefaultWagonManager
retry = false;
// This should take care of creating destination directory now on
if ( destination.exists() )
{
downloaded = wagon.getIfNewer( remotePath, temp, destination.lastModified() );
}
else
{
wagon.get( remotePath, temp );
downloaded = true;
}
if ( downloaded )
{
// keep the checksum files from showing up on the download monitor...
if ( downloadMonitor != null )
{
@ -444,7 +431,6 @@ public class DefaultWagonManager
{
wagon.addTransferListener( downloadMonitor );
}
}
// unset the firstRun flag, so we don't get caught in an infinite loop...
firstRun = false;
@ -469,8 +455,6 @@ public class DefaultWagonManager
releaseWagon( wagon );
}
if ( downloaded )
{
if ( !temp.exists() )
{
throw new ResourceDoesNotExistException( "Downloaded file does not exist: " + temp );
@ -497,7 +481,6 @@ public class DefaultWagonManager
}
}
}
}
private void failIfNotOnline()
throws TransferFailedException
@ -523,8 +506,8 @@ public class DefaultWagonManager
// otherwise it is ignore
}
private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination,
String remotePath, String checksumFileExtension, Wagon wagon )
private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination, String remotePath,
String checksumFileExtension, Wagon wagon )
throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException
{
try
@ -560,10 +543,7 @@ public class DefaultWagonManager
if ( expectedChecksum.equals( actualChecksum ) )
{
File checksumFile = new File( destination + checksumFileExtension );
if ( checksumFile.exists() )
{
checksumFile.delete();
}
if ( checksumFile.exists() ) checksumFile.delete();
FileUtils.copyFile( tempChecksumFile, checksumFile );
}
else
@ -744,9 +724,7 @@ public class DefaultWagonManager
}
catch ( final ComponentLookupException e )
{
throw new WagonConfigurationException( repositoryId,
"Unable to lookup wagon configurator. Wagon configuration cannot be applied.",
e );
throw new WagonConfigurationException( repositoryId, "Unable to lookup wagon configurator. Wagon configuration cannot be applied.", e );
}
catch ( ComponentConfigurationException e )
{

View File

@ -78,8 +78,7 @@ public class DefaultRepositoryMetadataManager
File file = new File( localRepository.getBasedir(),
localRepository.pathOfLocalRepositoryMetadata( metadata, repository ) );
boolean checkForUpdates =
policy.checkOutOfDate( new Date( file.lastModified() ) ) || !file.exists();
boolean checkForUpdates = policy.checkOutOfDate( new Date( file.lastModified() ) ) || !file.exists();
boolean metadataIsEmpty = true;
@ -202,8 +201,6 @@ public class DefaultRepositoryMetadataManager
if ( !m.getVersioning().getSnapshot().isLocalCopy() )
{
// TODO: I think this is incorrect (it results in localCopy set in a remote profile). Probably
// harmless so not removing at this point until full tests in place.
m.getVersioning().getSnapshot().setLocalCopy( true );
metadata.setMetadata( m );
metadata.storeInLocalRepository( localRepository, repository );

View File

@ -21,7 +21,6 @@ import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.transform.ArtifactTransformationManager;
import org.apache.maven.wagon.ResourceDoesNotExistException;
@ -33,7 +32,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -106,32 +104,6 @@ public class DefaultArtifactResolver
transformationManager.transformForResolve( artifact, remoteRepositories, localRepository );
File destination = artifact.getFile();
List repositories = remoteRepositories;
// TODO: would prefer the snapshot transformation took care of this. Maybe we need a "shouldresolve" flag.
if ( artifact.isSnapshot() && artifact.getBaseVersion().equals( artifact.getVersion() ) &&
destination.exists() )
{
Date comparisonDate = new Date( destination.lastModified() );
// cull to list of repositories that would like an update
repositories = new ArrayList( remoteRepositories );
for ( Iterator i = repositories.iterator(); i.hasNext(); )
{
ArtifactRepository repository = (ArtifactRepository) i.next();
ArtifactRepositoryPolicy policy = repository.getSnapshots();
if ( !policy.isEnabled() || !policy.checkOutOfDate( comparisonDate ) )
{
i.remove();
}
}
if ( !repositories.isEmpty() )
{
// someone wants to check for updates
force = true;
}
}
boolean resolved = false;
if ( !destination.exists() || force )
{
@ -149,10 +121,10 @@ public class DefaultArtifactResolver
}
else
{
wagonManager.getArtifact( artifact, repositories );
wagonManager.getArtifact( artifact, remoteRepositories );
}
if ( !artifact.isResolved() && !destination.exists() )
if ( !artifact.isResolved() )
{
throw new ArtifactResolutionException(
"Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.",