archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sk...@apache.org
Subject [3/3] git commit: jdk 7 (multicatch) for-loop remove unused package, reduce annotations (value= or locations=) move javadoc from Maven2RepsotirotyStorage to RepositoryStorage
Date Thu, 17 Apr 2014 23:51:03 GMT
jdk 7 (multicatch)  for-loop
remove unused package, reduce annotations (value= or locations=)
move javadoc from Maven2RepsotirotyStorage to RepositoryStorage

Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/a7c6ebb1
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/a7c6ebb1
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/a7c6ebb1

Branch: refs/heads/master
Commit: a7c6ebb10e533634d4cdd0c2baa2034979524f85
Parents: fe7e671
Author: Eric Barboni <skygo@apache.org>
Authored: Fri Apr 18 01:46:55 2014 +0200
Committer: Eric Barboni <skygo@apache.org>
Committed: Fri Apr 18 01:46:55 2014 +0200

----------------------------------------------------------------------
 .../repository/storage/RepositoryStorage.java   | 13 ++++-
 .../maven2/Maven3DependencyTreeBuilder.java     |  2 +-
 .../storage/maven2/Maven2RepositoryStorage.java | 13 +----
 .../storage/maven2/RepositoryModelResolver.java |  7 +--
 .../legacy/AbstractLegacyRepositoryContent.java |  2 +-
 .../maven2/ManagedDefaultRepositoryContent.java | 59 +++++++-------------
 6 files changed, 36 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/a7c6ebb1/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
----------------------------------------------------------------------
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
index 664103d..1c300b0 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
@@ -58,7 +58,18 @@ public interface RepositoryStorage
     // FIXME: reconsider this API, do we want to expose storage format in the form of a path?
     ArtifactMetadata readArtifactMetadataFromPath( String repoId, String path )
         throws RepositoryStorageRuntimeException;
-
+    
+    /**
+     * A relocation capable client will request the POM prior to the artifact, and will then
read meta-data and do
+     * client side relocation. A simplier client (like maven 1) will only request the artifact
and not use the
+     * metadatas.
+     * <p>
+     * For such clients, archiva does server-side relocation by reading itself the &lt;relocation&gt;
element in
+     * metadatas and serving the expected artifact.
+     * @param managedRepository the used managed repository
+     * @param artifact the artifact reference
+     * @throws org.apache.archiva.policies.ProxyDownloadException
+     */    
     void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference
artifact )
         throws ProxyDownloadException;
 

http://git-wip-us.apache.org/repos/asf/archiva/blob/a7c6ebb1/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java
----------------------------------------------------------------------
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java
b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java
index 53e801b..6acf622 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/Maven3DependencyTreeBuilder.java
@@ -92,7 +92,7 @@ public class Maven3DependencyTreeBuilder
     private PlexusSisuBridge plexusSisuBridge;
 
     @Inject
-    @Named(value = "repositoryPathTranslator#maven2")
+    @Named( "repositoryPathTranslator#maven2" )
     private RepositoryPathTranslator pathTranslator;
 
     @Inject

http://git-wip-us.apache.org/repos/asf/archiva/blob/a7c6ebb1/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
----------------------------------------------------------------------
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 0543c33..6db2b79 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
@@ -84,7 +84,6 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.Reader;
@@ -130,7 +129,7 @@ public class Maven2RepositoryStorage
     private NetworkProxyAdmin networkProxyAdmin;
 
     @Inject
-    @Named( value = "repositoryPathTranslator#maven2" )
+    @Named( "repositoryPathTranslator#maven2" )
     private RepositoryPathTranslator pathTranslator;
 
     @Inject
@@ -140,7 +139,7 @@ public class Maven2RepositoryStorage
     private ApplicationContext applicationContext;
 
     @Inject
-    @Named( value = "pathParser#default" )
+    @Named( "pathParser#default" )
     private PathParser pathParser;
 
     private static final String METADATA_FILENAME_START = "maven-metadata";
@@ -649,14 +648,6 @@ public class Maven2RepositoryStorage
         return metadata;
     }
 
-    /**
-     * A relocation capable client will request the POM prior to the artifact, and will then
read meta-data and do
-     * client side relocation. A simplier client (like maven 1) will only request the artifact
and not use the
-     * metadatas.
-     * <p>
-     * For such clients, archiva does server-side relocation by reading itself the &lt;relocation&gt;
element in
-     * metadatas and serving the expected artifact.
-     */
     @Override
     public void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference
artifact )
         throws ProxyDownloadException

http://git-wip-us.apache.org/repos/asf/archiva/blob/a7c6ebb1/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java
----------------------------------------------------------------------
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 99340f3..0113513 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
@@ -403,12 +403,7 @@ public class RepositoryModelResolver
             }
             connected = true;
         }
-        catch ( ConnectionException e )
-        {
-            log.error( "Could not connect to {}:{} ", remoteRepository.getName(), e.getMessage()
);
-            connected = false;
-        }
-        catch ( AuthenticationException e )
+        catch ( ConnectionException | AuthenticationException e )
         {
             log.error( "Could not connect to {}:{} ", remoteRepository.getName(), e.getMessage()
);
             connected = false;

http://git-wip-us.apache.org/repos/asf/archiva/blob/a7c6ebb1/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java
----------------------------------------------------------------------
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java
b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java
index e40292d..6c7f239 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/legacy/AbstractLegacyRepositoryContent.java
@@ -56,7 +56,7 @@ public abstract class AbstractLegacyRepositoryContent
      *
      */
     @Inject
-    @Named( value = "pathParser#legacy" )
+    @Named( "pathParser#legacy" )
     private PathParser legacyPathParser;
 
     public ArtifactReference toArtifactReference( String path )

http://git-wip-us.apache.org/repos/asf/archiva/blob/a7c6ebb1/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java
----------------------------------------------------------------------
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java
b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java
index 930855e..aa4ca8a 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java
@@ -54,7 +54,7 @@ public class ManagedDefaultRepositoryContent
     implements ManagedRepositoryContent
 {
     @Inject
-    @Named (value = "fileTypes")
+    @Named ( "fileTypes" )
     private FileTypes filetypes;
 
     private ManagedRepository repository;
@@ -182,20 +182,17 @@ public class ManagedDefaultRepositoryContent
                 "Unable to get related artifacts using a non-directory: " + repoDir.getAbsolutePath()
);
         }
 
-        Set<ArtifactReference> foundArtifacts = new HashSet<ArtifactReference>();
+        Set<ArtifactReference> foundArtifacts = new HashSet<>();
 
         // First gather up the versions found as artifacts in the managed repository.
         File repoFiles[] = repoDir.listFiles();
-        for ( int i = 0; i < repoFiles.length; i++ )
+        for (File repoFile : repoFiles) 
         {
-            if ( repoFiles[i].isDirectory() )
-            {
+            if (repoFile.isDirectory()) {
                 // Skip it. it's a directory.
                 continue;
             }
-
-            String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i]
);
-
+            String relativePath = PathUtil.getRelative(repository.getLocation(), repoFile);
             if ( filetypes.matchesArtifactPattern( relativePath ) )
             {
                 try
@@ -204,7 +201,7 @@ public class ManagedDefaultRepositoryContent
 
                     // Test for related, groupId / artifactId / version must match.
                     if ( artifact.getGroupId().equals( reference.getGroupId() ) &&
artifact.getArtifactId().equals(
-                        reference.getArtifactId() ) && artifact.getVersion().equals(
reference.getVersion() ) )
+                            reference.getArtifactId() ) && artifact.getVersion().equals(
reference.getVersion() ) )
                     {
                         foundArtifacts.add( artifact );
                     }
@@ -265,24 +262,21 @@ public class ManagedDefaultRepositoryContent
                 "Unable to get Versions on a non-directory: " + repoDir.getAbsolutePath()
);
         }
 
-        Set<String> foundVersions = new HashSet<String>();
+        Set<String> foundVersions = new HashSet<>();
         VersionedReference versionRef = new VersionedReference();
         versionRef.setGroupId( reference.getGroupId() );
         versionRef.setArtifactId( reference.getArtifactId() );
 
         File repoFiles[] = repoDir.listFiles();
-        for ( int i = 0; i < repoFiles.length; i++ )
+        for (File repoFile : repoFiles) 
         {
-            if ( !repoFiles[i].isDirectory() )
-            {
+            if (!repoFile.isDirectory()) {
                 // Skip it. not a directory.
                 continue;
             }
-
             // Test if dir has an artifact, which proves to us that it is a valid version
directory.
-            String version = repoFiles[i].getName();
+            String version = repoFile.getName();
             versionRef.setVersion( version );
-
             if ( hasArtifact( versionRef ) )
             {
                 // Found an artifact, must be a valid version.
@@ -319,26 +313,22 @@ public class ManagedDefaultRepositoryContent
                 "Unable to get versions on a non-directory: " + repoDir.getAbsolutePath()
);
         }
 
-        Set<String> foundVersions = new HashSet<String>();
+        Set<String> foundVersions = new HashSet<>();
 
         // First gather up the versions found as artifacts in the managed repository.
         File repoFiles[] = repoDir.listFiles();
-        for ( int i = 0; i < repoFiles.length; i++ )
+        for (File repoFile : repoFiles) 
         {
-            if ( repoFiles[i].isDirectory() )
-            {
+            if (repoFile.isDirectory()) {
                 // Skip it. it's a directory.
                 continue;
             }
-
-            String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i]
);
-
+            String relativePath = PathUtil.getRelative(repository.getLocation(), repoFile);
             if ( filetypes.matchesDefaultExclusions( relativePath ) )
             {
                 // Skip it, it's metadata or similar
                 continue;
             }
-
             if ( filetypes.matchesArtifactPattern( relativePath ) )
             {
                 try
@@ -372,11 +362,7 @@ public class ManagedDefaultRepositoryContent
             Set<String> versions = getVersions( reference );
             return !versions.isEmpty();
         }
-        catch ( ContentNotFoundException e )
-        {
-            return false;
-        }
-        catch ( LayoutException e )
+        catch ( ContentNotFoundException | LayoutException e )
         {
             return false;
         }
@@ -389,11 +375,7 @@ public class ManagedDefaultRepositoryContent
         {
             return ( getFirstArtifact( reference ) != null );
         }
-        catch ( IOException e )
-        {
-            return false;
-        }
-        catch ( LayoutException e )
+        catch ( IOException | LayoutException e )
         {
             return false;
         }
@@ -470,16 +452,13 @@ public class ManagedDefaultRepositoryContent
         }
 
         File repoFiles[] = repoDir.listFiles();
-        for ( int i = 0; i < repoFiles.length; i++ )
+        for (File repoFile : repoFiles) 
         {
-            if ( repoFiles[i].isDirectory() )
-            {
+            if (repoFile.isDirectory()) {
                 // Skip it. it's a directory.
                 continue;
             }
-
-            String relativePath = PathUtil.getRelative( repository.getLocation(), repoFiles[i]
);
-
+            String relativePath = PathUtil.getRelative(repository.getLocation(), repoFile);
             if ( filetypes.matchesArtifactPattern( relativePath ) )
             {
                 ArtifactReference artifact = toArtifactReference( relativePath );


Mime
View raw message