diff options
author | skygo <skygo@unknown> | 2012-08-31 20:41:42 +0000 |
---|---|---|
committer | skygo <skygo@unknown> | 2012-08-31 20:41:42 +0000 |
commit | fcc715e89f2a06d9e21cbe0592d3f14eb8d971cb (patch) | |
tree | 2f21e7613781bcc5ce40995154d07cb2171935cd /archiva-modules/plugins/maven2-repository/src/main | |
parent | de6d5108af479740858c1bac8a0d9377b6595467 (diff) | |
download | archiva-fcc715e89f2a06d9e21cbe0592d3f14eb8d971cb.tar.gz archiva-fcc715e89f2a06d9e21cbe0592d3f14eb8d971cb.zip |
M2.x repo support
logs rewritted for performance
add test for more complex archiva configuration
remove previous check in RepositoryModelResolver (misunderstanding of class role)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1379598 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/maven2-repository/src/main')
3 files changed, 19 insertions, 32 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index 01ea63c49..3eee39799 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -614,7 +614,7 @@ public class Maven2RepositoryStorage } catch ( IOException e ) { - log.error( "Unable to checksum file " + file + ": " + e.getMessage() ); + log.error( "Unable to checksum file {}: {},MD5", file, e.getMessage() ); } try { @@ -622,7 +622,7 @@ public class Maven2RepositoryStorage } catch ( IOException e ) { - log.error( "Unable to checksum file " + file + ": " + e.getMessage() ); + log.error( "Unable to checksum file {}: {},SHA1", file, e.getMessage() ); } metadata.setSize( file.length() ); } diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java index 6e72fdcd7..a49d10321 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/MavenArtifactFacet.java @@ -91,7 +91,7 @@ public class MavenArtifactFacet public Map<String, String> toProperties() { - HashMap<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<String, String>(); properties.put( "type", type ); if ( classifier != null ) { diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index a43f6d6e9..a1c7009fc 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -54,7 +54,6 @@ import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; -import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; public class RepositoryModelResolver implements ModelResolver @@ -112,20 +111,9 @@ public class RepositoryModelResolver if ( !model.exists() ) { - if ( VersionUtil.isSnapshot( version ) ) // skygo trying to improve speed by honoring managed configuration MRM-1658 - { - if ( managedRepository.isReleases() && !managedRepository.isSnapshots() ) - { - throw new UnresolvableModelException("lookforsnaponreleaseonly", groupId, artifactId, version ); - } - } - else - { - if ( !managedRepository.isReleases() && managedRepository.isSnapshots() ) - { - throw new UnresolvableModelException("lookforsreleaseonsneponly", groupId, artifactId, version ); - } - } + /** + * + */ // is a SNAPSHOT ? so we can try to find locally before asking remote repositories. if ( StringUtils.contains( version, VersionUtil.SNAPSHOT ) ) { @@ -145,21 +133,20 @@ public class RepositoryModelResolver if ( success && model.exists() ) { log.info( - "Model '" + model.getAbsolutePath() + "' successfully retrieved from remote repository '" - + remoteRepository.getId() + "'" ); + "Model '{}' successfully retrieved from remote repository '{}'", + model.getAbsolutePath(), remoteRepository.getId() ); break; } } catch ( ResourceDoesNotExistException e ) { - log.info( "An exception was caught while attempting to retrieve model '" + model.getAbsolutePath() - + "' from remote repository '" + remoteRepository.getId() + "'.Reason:" - + e.getMessage() ); + log.info( "An exception was caught while attempting to retrieve model '{}' from remote repository '{}'.Reason:{}", + new Object[]{ model.getAbsolutePath(), remoteRepository.getId(), e.getMessage() } ); } catch ( Exception e ) { - log.warn( "An exception was caught while attempting to retrieve model '" + model.getAbsolutePath() - + "' from remote repository '" + remoteRepository.getId() + "'.", e.getMessage() ); + log.warn( "An exception was caught while attempting to retrieve model '{}' from remote repository '{}'.Reason:{}", + new Object[]{ model.getAbsolutePath(), remoteRepository.getId(), e.getMessage() } ); continue; } @@ -290,11 +277,11 @@ public class RepositoryModelResolver artifactPath = pathTranslator.toPath( groupId, artifactId, version, filename ); - log.debug( "New artifactPath : " + artifactPath ); + log.debug( "New artifactPath :{}", artifactPath ); } } - log.info( "Retrieving " + artifactPath + " from " + remoteRepository.getName() ); + log.info( "Retrieving {} from {}", artifactPath, remoteRepository.getName() ); wagon.get( artifactPath, tmpResource ); @@ -414,12 +401,12 @@ public class RepositoryModelResolver } catch ( ConnectionException e ) { - log.error( "Could not connect to " + remoteRepository.getName() + ": " + e.getMessage() ); + log.error( "Could not connect to {}:{} ",remoteRepository.getName(), e.getMessage() ); connected = false; } catch ( AuthenticationException e ) { - log.error( "Could not connect to " + remoteRepository.getName() + ": " + e.getMessage() ); + log.error( "Could not connect to {}:{} ",remoteRepository.getName(), e.getMessage() ); connected = false; } @@ -432,7 +419,7 @@ public class RepositoryModelResolver { File destFile = new File( tmpDirectory, resource.getName() + ext ); - log.info( "Retrieving " + remotePath + " from " + remoteRepository.getName() ); + log.info( "Retrieving {} from {}", remotePath, remoteRepository.getName() ); wagon.get( remotePath, destFile ); @@ -477,8 +464,8 @@ public class RepositoryModelResolver { if ( newLocation.exists() ) { - log.error( "Tried to copy file " + fileToMove.getName() + " to " + newLocation.getAbsolutePath() - + " but file with this name already exists." ); + log.error( "Tried to copy file {} to {} but file with this name already exists.", + fileToMove.getName(), newLocation.getAbsolutePath() ); } else { |