You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/03/15 08:04:31 UTC

[maven-resolver] branch MRESOLVER-241 updated (d7e3595 -> 44d1fd2)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git.


    omit d7e3595  Add UT for wrong input values
    omit 3eb5d29  Be clear about leading dots and validate input
    omit 3abac25  Sanitize checksums as well
    omit 5b11063  Improve javadoc
    omit da689a5  Fix javadoc
    omit cdf2ba3  Add since
    omit ab2353b  Rename variable, it is not location anymore
    omit a6ee97e  Refactor: it is layout matter, does an artifact has checksums or not.
    omit aa6fd77  Javadoc
    omit 3b64a34  Componentize filter factory, expand doco for 1.7.x behaviour
    omit c6375ed  Make members private, there is no more Ex instance to inherit
    omit 11e5d62  Refactor, drop signatures
    omit c8e9bae  Merge remote-tracking branch 'origin/master' into MRESOLVER-241
    omit faa33b6  Javadoc fixes
    omit ee44835  missing closing bracket
    omit 2f7a5fa  Fix parsing and comment
    omit dc0a91f  Update doco
    omit 1f65ab3  Fix for MRESOLVER-242
    omit 9f964c4  [MRESOLVER-241] Resolver checksum calculation should be driven by layout
     new 458d1a8  [MRESOLVER-241] Resolver checksum calculation should be driven by layout
     new 2e123bf  Fix for MRESOLVER-242
     new c1a287d  Update doco
     new d1833df  Fix parsing and comment
     new 83c7680  missing closing bracket
     new bfe042a  Javadoc fixes
     new 7e6befa  Refactor, drop signatures
     new 8241e83  Make members private, there is no more Ex instance to inherit
     new 5b9a21e  Componentize filter factory, expand doco for 1.7.x behaviour
     new 9720fdb  Javadoc
     new b6b613a  Refactor: it is layout matter, does an artifact has checksums or not.
     new 3fce4f8  Rename variable, it is not location anymore
     new 2c0faac  Add since
     new 8812681  Fix javadoc
     new 4404c9b  Improve javadoc
     new 1189c3c  Sanitize checksums as well
     new 22c14f0  Be clear about leading dots and validate input
     new c2b4d58  Add UT for wrong input values
     new 44d1fd2  Close parens

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d7e3595)
            \
             N -- N -- N   refs/heads/MRESOLVER-241 (44d1fd2)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 19 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

[maven-resolver] 01/19: [MRESOLVER-241] Resolver checksum calculation should be driven by layout

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 458d1a8e0ec0e68ed8e8385932f9d174b486bc32
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 22 09:20:08 2022 +0100

    [MRESOLVER-241] Resolver checksum calculation should be driven by layout
    
    Refactor checksum calculator and validator to rely on layout
    provided checksums (layout always had these), and not by the presence
    (or absence) or checksum locations.
    
    Checksum locations should drive only the checksum provision from
    remote, and nothing else.
---
 .../connector/basic/BasicRepositoryConnector.java    | 10 ++++++----
 .../aether/connector/basic/ChecksumCalculator.java   | 15 +++++++--------
 .../aether/connector/basic/ChecksumValidator.java    | 19 +++++++++++--------
 .../connector/basic/ChecksumCalculatorTest.java      |  7 +++----
 .../connector/basic/ChecksumValidatorTest.java       | 20 ++++++++++++++++----
 5 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
index c761941..e292de3 100644
--- a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
+++ b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
@@ -227,6 +227,7 @@ final class BasicRepositoryConnector
 
         Executor executor = getExecutor( artifactDownloads, metadataDownloads );
         RunnableErrorForwarder errorForwarder = new RunnableErrorForwarder();
+        List<ChecksumAlgorithmFactory> checksumAlgorithmFactories = layout.getChecksumAlgorithmFactories();
 
         for ( MetadataDownload transfer : safe( metadataDownloads ) )
         {
@@ -244,7 +245,7 @@ final class BasicRepositoryConnector
             }
 
             Runnable task = new GetTaskRunner( location, transfer.getFile(), checksumPolicy,
-                    checksumLocations, null, listener );
+                    checksumAlgorithmFactories, checksumLocations, null, listener );
             executor.execute( errorForwarder.wrap( task ) );
         }
 
@@ -254,7 +255,7 @@ final class BasicRepositoryConnector
             for ( ProvidedChecksumsSource providedChecksumsSource : providedChecksumsSources.values() )
             {
                 Map<String, String> provided = providedChecksumsSource.getProvidedArtifactChecksums(
-                    session, transfer, layout.getChecksumAlgorithmFactories() );
+                    session, transfer, checksumAlgorithmFactories );
 
                 if ( provided != null )
                 {
@@ -284,7 +285,7 @@ final class BasicRepositoryConnector
                 }
 
                 task = new GetTaskRunner( location, transfer.getFile(), checksumPolicy,
-                    checksumLocations, providedChecksums, listener );
+                        checksumAlgorithmFactories, checksumLocations, providedChecksums, listener );
             }
             executor.execute( errorForwarder.wrap( task ) );
         }
@@ -434,13 +435,14 @@ final class BasicRepositoryConnector
         private final ChecksumValidator checksumValidator;
 
         GetTaskRunner( URI path, File file, ChecksumPolicy checksumPolicy,
+                       List<ChecksumAlgorithmFactory> checksumAlgorithmFactories,
                        List<RepositoryLayout.ChecksumLocation> checksumLocations,
                        Map<String, String> providedChecksums,
                        TransferTransportListener<?> listener )
         {
             super( path, listener );
             this.file = requireNonNull( file, "destination file cannot be null" );
-            checksumValidator = new ChecksumValidator( file, fileProcessor, this,
+            checksumValidator = new ChecksumValidator( file, checksumAlgorithmFactories, fileProcessor, this,
                     checksumPolicy, providedChecksums, safe( checksumLocations ) );
         }
 
diff --git a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java
index 87eeb78..ccf0431 100644
--- a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java
+++ b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java
@@ -36,7 +36,6 @@ import java.util.Set;
 
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithm;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
-import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
 
 import static java.util.Objects.requireNonNull;
 
@@ -92,25 +91,25 @@ final class ChecksumCalculator
     private final File targetFile;
 
     public static ChecksumCalculator newInstance( File targetFile,
-                                                  Collection<RepositoryLayout.ChecksumLocation> checksumLocations )
+                                                  Collection<ChecksumAlgorithmFactory> checksumAlgorithmFactories )
     {
-        if ( checksumLocations == null || checksumLocations.isEmpty() )
+        if ( checksumAlgorithmFactories == null || checksumAlgorithmFactories.isEmpty() )
         {
             return null;
         }
-        return new ChecksumCalculator( targetFile, checksumLocations );
+        return new ChecksumCalculator( targetFile, checksumAlgorithmFactories );
     }
 
     private ChecksumCalculator( File targetFile,
-                                Collection<RepositoryLayout.ChecksumLocation> checksumLocations )
+                                Collection<ChecksumAlgorithmFactory> checksumAlgorithmFactories )
     {
         this.checksums = new ArrayList<>();
         Set<String> algos = new HashSet<>();
-        for ( RepositoryLayout.ChecksumLocation checksumLocation : checksumLocations )
+        for ( ChecksumAlgorithmFactory checksumAlgorithmFactory : checksumAlgorithmFactories )
         {
-            if ( algos.add( checksumLocation.getChecksumAlgorithmFactory().getName() ) )
+            if ( algos.add( checksumAlgorithmFactory.getName() ) )
             {
-                this.checksums.add( new Checksum( checksumLocation.getChecksumAlgorithmFactory() ) );
+                this.checksums.add( new Checksum( checksumAlgorithmFactory ) );
             }
         }
         this.targetFile = targetFile;
diff --git a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
index f6b0fef..87b6b3c 100644
--- a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
+++ b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
@@ -59,6 +59,8 @@ final class ChecksumValidator
 
     private final File dataFile;
 
+    private final Collection<ChecksumAlgorithmFactory> checksumAlgorithmFactories;
+
     private final Collection<File> tempFiles;
 
     private final FileProcessor fileProcessor;
@@ -74,6 +76,7 @@ final class ChecksumValidator
     private final Map<File, Object> checksumFiles;
 
     ChecksumValidator( File dataFile,
+                       Collection<ChecksumAlgorithmFactory> checksumAlgorithmFactories,
                        FileProcessor fileProcessor,
                        ChecksumFetcher checksumFetcher,
                        ChecksumPolicy checksumPolicy,
@@ -81,6 +84,7 @@ final class ChecksumValidator
                        Collection<ChecksumLocation> checksumLocations )
     {
         this.dataFile = dataFile;
+        this.checksumAlgorithmFactories = checksumAlgorithmFactories;
         this.tempFiles = new HashSet<>();
         this.fileProcessor = fileProcessor;
         this.checksumFetcher = checksumFetcher;
@@ -94,7 +98,7 @@ final class ChecksumValidator
     {
         if ( checksumPolicy != null )
         {
-            return ChecksumCalculator.newInstance( targetFile, checksumLocations );
+            return ChecksumCalculator.newInstance( targetFile, checksumAlgorithmFactories );
         }
         return null;
     }
@@ -134,27 +138,26 @@ final class ChecksumValidator
             {
                 continue;
             }
-            ChecksumLocation checksumLocation = checksumLocations.stream()
-                    .filter( a -> a.getChecksumAlgorithmFactory().getName().equals( algo ) )
+            ChecksumAlgorithmFactory checksumAlgorithmFactory = checksumAlgorithmFactories.stream()
+                    .filter( a -> a.getName().equals( algo ) )
                     .findFirst()
                     .orElse( null );
-            if ( checksumLocation == null )
+            if ( checksumAlgorithmFactory == null )
             {
                 continue;
             }
 
             String actual = String.valueOf( calculated );
             String expected = entry.getValue().toString();
-            ChecksumAlgorithmFactory factory = checksumLocation.getChecksumAlgorithmFactory();
-            checksumFiles.put( getChecksumFile( factory ), expected );
+            checksumFiles.put( getChecksumFile( checksumAlgorithmFactory ), expected );
 
             if ( !isEqualChecksum( expected, actual ) )
             {
-                checksumPolicy.onChecksumMismatch( factory.getName(), kind,
+                checksumPolicy.onChecksumMismatch( checksumAlgorithmFactory.getName(), kind,
                     new ChecksumFailureException( expected, kind.name(), actual )
                 );
             }
-            else if ( checksumPolicy.onChecksumMatch( factory.getName(), kind ) )
+            else if ( checksumPolicy.onChecksumMatch( checksumAlgorithmFactory.getName(), kind ) )
             {
                 return true;
             }
diff --git a/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java b/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
index 818de7c..ed56549 100644
--- a/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
+++ b/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
@@ -27,7 +27,6 @@ import static org.junit.Assert.*;
 
 import java.io.File;
 import java.io.IOException;
-import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -35,7 +34,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.eclipse.aether.internal.test.util.TestFileUtils;
-import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
+import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -48,10 +47,10 @@ public class ChecksumCalculatorTest
 
     private ChecksumCalculator newCalculator( String... algos )
     {
-        List<RepositoryLayout.ChecksumLocation> checksumLocations = new ArrayList<>();
+        List<ChecksumAlgorithmFactory> checksumLocations = new ArrayList<>();
         for ( String algo : algos )
         {
-            checksumLocations.add( new RepositoryLayout.ChecksumLocation( URI.create( "irrelevant" ), selector.select( algo ) ) );
+            checksumLocations.add( selector.select( algo ) );
         }
         return ChecksumCalculator.newInstance( file, checksumLocations );
     }
diff --git a/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumValidatorTest.java b/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumValidatorTest.java
index cd171b0..530e5e7 100644
--- a/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumValidatorTest.java
+++ b/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumValidatorTest.java
@@ -35,6 +35,7 @@ import java.util.Map;
 
 import org.eclipse.aether.internal.test.util.TestFileProcessor;
 import org.eclipse.aether.internal.test.util.TestFileUtils;
+import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumPolicy;
 import org.eclipse.aether.spi.connector.checksum.ChecksumPolicy.ChecksumKind;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
@@ -185,17 +186,27 @@ public class ChecksumValidatorTest
 
     private static final TestChecksumAlgorithmSelector selector = new TestChecksumAlgorithmSelector();
 
+    private List<ChecksumAlgorithmFactory> newChecksumAlgorithmFactories( String... factories )
+    {
+        List<ChecksumAlgorithmFactory> checksums = new ArrayList<>();
+        for ( String factory : factories )
+        {
+            checksums.add( selector.select( factory ) );
+        }
+        return checksums;
+    }
+
     private static RepositoryLayout.ChecksumLocation newChecksum( String factory )
     {
         return RepositoryLayout.ChecksumLocation.forLocation( URI.create( "file" ), selector.select( factory ) );
     }
 
-    private List<RepositoryLayout.ChecksumLocation> newChecksums( String... factories )
+    private List<RepositoryLayout.ChecksumLocation> newChecksums( List<ChecksumAlgorithmFactory> checksumAlgorithmFactories )
     {
         List<RepositoryLayout.ChecksumLocation> checksums = new ArrayList<>();
-        for ( String factory : factories )
+        for ( ChecksumAlgorithmFactory factory : checksumAlgorithmFactories )
         {
-            checksums.add( newChecksum( factory ) );
+            checksums.add( RepositoryLayout.ChecksumLocation.forLocation( URI.create( "file" ), factory ) );
         }
         return checksums;
     }
@@ -207,7 +218,8 @@ public class ChecksumValidatorTest
 
     private ChecksumValidator newValidator( Map<String, String> providedChecksums, String... factories )
     {
-        return new ChecksumValidator( dataFile, new TestFileProcessor(), fetcher, policy, providedChecksums, newChecksums( factories ) );
+        List<ChecksumAlgorithmFactory> checksumAlgorithmFactories = newChecksumAlgorithmFactories( factories );
+        return new ChecksumValidator( dataFile, checksumAlgorithmFactories, new TestFileProcessor(), fetcher, policy, providedChecksums, newChecksums( checksumAlgorithmFactories ) );
     }
 
     private Map<String, ?> checksums( String... algoDigestPairs )

[maven-resolver] 19/19: Close parens

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 44d1fd226ec82764a3b78b4a99f775c06f5efe4f
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Mar 15 09:04:26 2022 +0100

    Close parens
---
 .../org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index 8398591..30c3e8a 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -134,7 +134,7 @@ public final class Maven2RepositoryLayoutFactory
         {
             throw new IllegalArgumentException(
                     String.format(
-                            "The configuration %s contains illegal values: %s (all entries must start with '.' (dot)",
+                            "The configuration %s contains illegal values: %s (all entries must start with '.' (dot))",
                             CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS,
                             omitChecksumsForExtensions
                     )

[maven-resolver] 18/19: Add UT for wrong input values

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit c2b4d586177e06ca3ac01110f91fccd99f7cbc03
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Mar 14 11:54:59 2022 +0100

    Add UT for wrong input values
---
 .../impl/Maven2RepositoryLayoutFactoryTest.java         | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
index c239165..0fc7a29 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
@@ -331,4 +331,21 @@ public class Maven2RepositoryLayoutFactoryTest
         assertEquals( 0, checksums.size() );
     }
 
+    @Test
+    public void testCustomChecksumsIgnored_IllegalInout()
+            throws Exception
+    {
+        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, ".asc,foo" );
+        try
+        {
+            layout = factory.newInstance( session, newRepo( "default" ) );
+            fail( "Should not get here" );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            String message = e.getMessage();
+            assertTrue( message, message.contains( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS ) );
+        }
+    }
+
 }

[maven-resolver] 02/19: Fix for MRESOLVER-242

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 2e123bfc6300b19cde7174c8bc52190f85c29816
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 22 10:37:34 2022 +0100

    Fix for MRESOLVER-242
    
    Makes resolver aware of signatures in very same way as
    it became aware of checksums, but not implementing
    signign/verification services yet.
---
 .../aether/connector/basic/ChecksumValidator.java  |  9 ++-
 .../eclipse/aether/impl/guice/AetherModule.java    | 19 +++++
 .../impl/Maven2RepositoryLayoutFactory.java        | 62 ++++++++++++---
 .../DefaultSignatureAlgorithmFactorySelector.java  | 89 ++++++++++++++++++++++
 .../signature/GpgSignatureAlgorithmFactory.java    | 52 +++++++++++++
 .../spi/connector/layout/RepositoryLayout.java     | 14 +++-
 .../connector/signature/SignatureAlgorithm.java    | 38 +++++++++
 .../signature/SignatureAlgorithmFactory.java       | 49 ++++++++++++
 .../SignatureAlgorithmFactorySelector.java         | 45 +++++++++++
 .../SignatureAlgorithmFactorySupport.java          | 59 ++++++++++++++
 10 files changed, 422 insertions(+), 14 deletions(-)

diff --git a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
index 87b6b3c..14ae450 100644
--- a/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
+++ b/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
@@ -120,11 +120,14 @@ final class ChecksumValidator
         {
             return;
         }
-        if ( validateExternalChecksums( actualChecksums ) )
+        if ( !checksumLocations.isEmpty() )
         {
-            return;
+            if ( validateExternalChecksums( actualChecksums ) )
+            {
+                return;
+            }
+            checksumPolicy.onNoMoreChecksums();
         }
-        checksumPolicy.onNoMoreChecksums();
     }
 
     private boolean validateChecksums( Map<String, ?> actualChecksums, ChecksumKind kind, Map<String, ?> checksums )
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
index 9629dc9..64a201b 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
@@ -48,6 +48,8 @@ import org.eclipse.aether.internal.impl.checksum.Sha1ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha256ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha512ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
+import org.eclipse.aether.internal.impl.signature.DefaultSignatureAlgorithmFactorySelector;
+import org.eclipse.aether.internal.impl.signature.GpgSignatureAlgorithmFactory;
 import org.eclipse.aether.internal.impl.synccontext.DefaultSyncContextFactory;
 import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactorySelector;
 import org.eclipse.aether.internal.impl.synccontext.named.SimpleNamedLockFactorySelector;
@@ -90,6 +92,8 @@ import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.transport.TransporterProvider;
 import org.eclipse.aether.spi.io.FileProcessor;
 import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
@@ -184,6 +188,11 @@ public class AetherModule
         bind( ChecksumAlgorithmFactorySelector.class )
                 .to( DefaultChecksumAlgorithmFactorySelector.class ).in ( Singleton.class );
 
+        bind( SignatureAlgorithmFactory.class ).annotatedWith( Names.named( GpgSignatureAlgorithmFactory.NAME ) )
+                .to( GpgSignatureAlgorithmFactory.class );
+        bind( SignatureAlgorithmFactorySelector.class )
+                .to( DefaultSignatureAlgorithmFactorySelector.class ).in ( Singleton.class );
+
         bind( NamedLockFactorySelector.class ).to( SimpleNamedLockFactorySelector.class ).in( Singleton.class );
         bind( SyncContextFactory.class ).to( DefaultSyncContextFactory.class ).in( Singleton.class );
         bind( org.eclipse.aether.impl.SyncContextFactory.class )
@@ -241,6 +250,16 @@ public class AetherModule
 
     @Provides
     @Singleton
+    Map<String, SignatureAlgorithmFactory> provideSignatureTypes(
+            @Named( GpgSignatureAlgorithmFactory.NAME ) SignatureAlgorithmFactory gpg )
+    {
+        Map<String, SignatureAlgorithmFactory> checksumTypes = new HashMap<>();
+        checksumTypes.put( GpgSignatureAlgorithmFactory.NAME, gpg );
+        return Collections.unmodifiableMap( checksumTypes );
+    }
+
+    @Provides
+    @Singleton
     Map<String, NameMapper> provideNameMappers(
             @Named( StaticNameMapper.NAME ) NameMapper staticNameMapper,
             @Named( GAVNameMapper.NAME ) NameMapper gavNameMapper,
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index d0b3de9..e95a011 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -34,12 +34,15 @@ import javax.inject.Singleton;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
+import org.eclipse.aether.internal.impl.signature.DefaultSignatureAlgorithmFactorySelector;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySelector;
 import org.eclipse.aether.transfer.NoRepositoryLayoutException;
 import org.eclipse.aether.util.ConfigUtils;
 
@@ -55,14 +58,21 @@ public final class Maven2RepositoryLayoutFactory
 {
 
     static final String CONFIG_PROP_SIGNATURE_CHECKSUMS = "aether.checksums.forSignature";
+
     static final String CONFIG_PROP_CHECKSUMS_ALGORITHMS = "aether.checksums.algorithms";
 
     static final String DEFAULT_CHECKSUMS_ALGORITHMS = "SHA-1,MD5";
 
+    static final String CONFIG_PROP_SIGNATURE_ALGORITHMS = "aether.signatures.algorithms";
+
+    static final String DEFAULT_SIGNATURE_ALGORITHMS = "GPG";
+
     private float priority;
 
     private final ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector;
 
+    private final SignatureAlgorithmFactorySelector signatureAlgorithmFactorySelector;
+
     public float getPriority()
     {
         return priority;
@@ -74,13 +84,15 @@ public final class Maven2RepositoryLayoutFactory
     @Deprecated
     public Maven2RepositoryLayoutFactory()
     {
-        this( new DefaultChecksumAlgorithmFactorySelector() );
+        this( new DefaultChecksumAlgorithmFactorySelector(), new DefaultSignatureAlgorithmFactorySelector() );
     }
 
     @Inject
-    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector )
+    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector,
+                                          SignatureAlgorithmFactorySelector signatureAlgorithmFactorySelector )
     {
         this.checksumAlgorithmFactorySelector = requireNonNull( checksumAlgorithmFactorySelector );
+        this.signatureAlgorithmFactorySelector = requireNonNull( signatureAlgorithmFactorySelector );
     }
 
     /**
@@ -118,20 +130,37 @@ public final class Maven2RepositoryLayoutFactory
             checksumsAlgorithms.add( checksumAlgorithmFactorySelector.select( checksumsAlgorithmName ) );
         }
 
+        // no need for order here
+        List<String> signatureAlgorithmNames = Arrays.asList(
+                ConfigUtils.getString(
+                        session, DEFAULT_SIGNATURE_ALGORITHMS, CONFIG_PROP_SIGNATURE_ALGORITHMS
+                ).split( "," )
+        );
+
+        List<SignatureAlgorithmFactory> signatureAlgorithms = new ArrayList<>( signatureAlgorithmNames.size() );
+        for ( String signatureAlgorithmName : signatureAlgorithmNames )
+        {
+            signatureAlgorithms.add( signatureAlgorithmFactorySelector.select( signatureAlgorithmName ) );
+        }
+
         return forSignature
-                ? new Maven2RepositoryLayout( checksumsAlgorithms )
-                : new Maven2RepositoryLayoutEx( checksumsAlgorithms );
+                ? new Maven2RepositoryLayout( checksumsAlgorithms, signatureAlgorithms )
+                : new Maven2RepositoryLayoutEx( checksumsAlgorithms, signatureAlgorithms );
     }
 
     private static class Maven2RepositoryLayout
             implements RepositoryLayout
     {
 
-        private final List<ChecksumAlgorithmFactory> checksumAlgorithms;
+        protected final List<ChecksumAlgorithmFactory> checksumAlgorithms;
 
-        protected Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms )
+        protected final List<SignatureAlgorithmFactory> signatureAlgorithms;
+
+        protected Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms,
+                                          List<SignatureAlgorithmFactory> signatureAlgorithms )
         {
             this.checksumAlgorithms = Collections.unmodifiableList( checksumAlgorithms );
+            this.signatureAlgorithms = Collections.unmodifiableList( signatureAlgorithms );
         }
 
         private URI toUri( String path )
@@ -153,6 +182,12 @@ public final class Maven2RepositoryLayoutFactory
         }
 
         @Override
+        public List<SignatureAlgorithmFactory> getSignatureAlgorithmFactories()
+        {
+            return signatureAlgorithms;
+        }
+
+        @Override
         public URI getLocation( Artifact artifact, boolean upload )
         {
             StringBuilder path = new StringBuilder( 128 );
@@ -206,6 +241,10 @@ public final class Maven2RepositoryLayoutFactory
         @Override
         public List<ChecksumLocation> getChecksumLocations( Artifact artifact, boolean upload, URI location )
         {
+            if ( isChecksum( artifact.getExtension() ) )
+            {
+                return Collections.emptyList();
+            }
             return getChecksumLocations( location );
         }
 
@@ -225,15 +264,20 @@ public final class Maven2RepositoryLayoutFactory
             return checksumLocations;
         }
 
+        private boolean isChecksum( String extension )
+        {
+            return checksumAlgorithms.stream().anyMatch( a -> extension.endsWith( "." + a.getFileExtension() ) );
+        }
     }
 
     private static class Maven2RepositoryLayoutEx
             extends Maven2RepositoryLayout
     {
 
-        protected Maven2RepositoryLayoutEx( List<ChecksumAlgorithmFactory> checksumAlgorithms )
+        protected Maven2RepositoryLayoutEx( List<ChecksumAlgorithmFactory> checksumAlgorithms,
+                                            List<SignatureAlgorithmFactory> signatureAlgorithms )
         {
-            super( checksumAlgorithms );
+            super( checksumAlgorithms, signatureAlgorithms );
         }
 
         @Override
@@ -248,7 +292,7 @@ public final class Maven2RepositoryLayoutFactory
 
         private boolean isSignature( String extension )
         {
-            return extension.endsWith( ".asc" );
+            return signatureAlgorithms.stream().anyMatch( a -> extension.endsWith( "." + a.getFileExtension() ) );
         }
 
     }
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/DefaultSignatureAlgorithmFactorySelector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/DefaultSignatureAlgorithmFactorySelector.java
new file mode 100644
index 0000000..2455d52
--- /dev/null
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/DefaultSignatureAlgorithmFactorySelector.java
@@ -0,0 +1,89 @@
+package org.eclipse.aether.internal.impl.signature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySelector;
+
+import static java.util.Objects.requireNonNull;
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Default implementation.
+ *
+ * @since 1.8.0
+ */
+@Singleton
+@Named
+public class DefaultSignatureAlgorithmFactorySelector
+        implements SignatureAlgorithmFactorySelector
+{
+    private final Map<String, SignatureAlgorithmFactory> factories;
+
+    /**
+     * Default ctor for SL.
+     */
+    @Deprecated
+    public DefaultSignatureAlgorithmFactorySelector()
+    {
+        this.factories = new HashMap<>();
+        this.factories.put( GpgSignatureAlgorithmFactory.NAME, new GpgSignatureAlgorithmFactory() );
+    }
+
+    @Inject
+    public DefaultSignatureAlgorithmFactorySelector( Map<String, SignatureAlgorithmFactory> factories )
+    {
+        this.factories = requireNonNull( factories );
+    }
+
+    @Override
+    public SignatureAlgorithmFactory select( String algorithmName )
+    {
+        requireNonNull( algorithmName, "algorithmMame must not be null" );
+        SignatureAlgorithmFactory factory = factories.get( algorithmName );
+        if ( factory == null )
+        {
+            throw new IllegalArgumentException(
+                    String.format( "Unsupported signature algorithm %s, supported ones are %s",
+                            algorithmName,
+                            getSignatureAlgorithmFactories().stream()
+                                    .map( SignatureAlgorithmFactory::getName )
+                                    .collect( toList() )
+                    )
+            );
+        }
+        return factory;
+    }
+
+    @Override
+    public List<SignatureAlgorithmFactory> getSignatureAlgorithmFactories()
+    {
+        return new ArrayList<>( factories.values() );
+    }
+}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/GpgSignatureAlgorithmFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/GpgSignatureAlgorithmFactory.java
new file mode 100644
index 0000000..2f7ac67
--- /dev/null
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/GpgSignatureAlgorithmFactory.java
@@ -0,0 +1,52 @@
+package org.eclipse.aether.internal.impl.signature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithm;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySupport;
+
+/**
+ * The GPG signature type.
+ *
+ * @since 1.8.0
+ */
+@Singleton
+@Named( GpgSignatureAlgorithmFactory.NAME )
+public class GpgSignatureAlgorithmFactory
+        extends SignatureAlgorithmFactorySupport
+{
+    public static final String NAME = "GPG";
+
+    @Inject
+    public GpgSignatureAlgorithmFactory()
+    {
+        super( NAME, "asc" );
+    }
+
+    @Override
+    public SignatureAlgorithm getAlgorithm()
+    {
+        throw new IllegalStateException( "not implemented" );
+    }
+}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
index 4a02b06..f461560 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
@@ -27,6 +27,7 @@ import static java.util.Objects.requireNonNull;
 import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
+import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
 
 /**
  * The layout for a remote repository whose artifacts/metadata can be addressed via URIs.
@@ -134,6 +135,13 @@ public interface RepositoryLayout
     List<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories();
 
     /**
+     * Returns immutable list of {@link SignatureAlgorithmFactory} this instance of layout uses, never {@code null}.
+     *
+     * @since 1.8.0
+     */
+    List<SignatureAlgorithmFactory> getSignatureAlgorithmFactories();
+
+    /**
      * Gets the location within a remote repository where the specified artifact resides. The URI is relative to the
      * root directory of the repository.
      *
@@ -164,7 +172,8 @@ public interface RepositoryLayout
      *                 being uploaded/created.
      * @param location The relative URI to the artifact within the repository as previously obtained from
      *                 {@link #getLocation(Artifact, boolean)}, must not be {@code null}.
-     * @return The checksum files for the given artifact, possibly empty but never {@code null}.
+     * @return The checksum files for the given artifact, possibly empty but never {@code null}. If empty, that means
+     * that this layout does not provide checksums for given artifact.
      */
     List<ChecksumLocation> getChecksumLocations( Artifact artifact, boolean upload, URI location );
 
@@ -177,7 +186,8 @@ public interface RepositoryLayout
      *                 being uploaded/created.
      * @param location The relative URI to the metadata within the repository as previously obtained from
      *                 {@link #getLocation(Metadata, boolean)}, must not be {@code null}.
-     * @return The checksum files for the given metadata, possibly empty but never {@code null}.
+     * @return The checksum files for the given metadata, possibly empty but never {@code null}. If empty, that means
+     * that this layout does not provide checksums for given artifact.
      */
     List<ChecksumLocation> getChecksumLocations( Metadata metadata, boolean upload, URI location );
 
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithm.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithm.java
new file mode 100644
index 0000000..4ab960f
--- /dev/null
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithm.java
@@ -0,0 +1,38 @@
+package org.eclipse.aether.spi.connector.signature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Closeable;
+import java.nio.ByteBuffer;
+
+/**
+ * Implementation performing signature calculation for specific algorithm. Instances of this interface are stateful,
+ * non-thread safe, and should not be reused.
+ *
+ * @since 1.8.0
+ */
+public interface SignatureAlgorithm extends Closeable
+{
+    /**
+     * Updates the checksum algorithm inner state with input.
+     * TODO: figure out some API for this to suit signing.
+     */
+    void update( ByteBuffer input );
+}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactory.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactory.java
new file mode 100644
index 0000000..0c7bf7c
--- /dev/null
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactory.java
@@ -0,0 +1,49 @@
+package org.eclipse.aether.spi.connector.signature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A component representing a signature factory: provides {@link SignatureAlgorithm} instances, name and extension to be
+ * used with this algorithm. While directly injecting components of this type is possible, it is not recommended. To
+ * obtain factory instances use {@link SignatureAlgorithmFactorySelector} instead.
+ *
+ * @since 1.8.0
+ */
+public interface SignatureAlgorithmFactory
+{
+    /**
+     * Returns the algorithm name, usually used as key, never {@code null} value. The name is a standard name of
+     * algorithm (if applicable) or any other designator that is algorithm commonly referred with. Example: "GPG".
+     */
+    String getName();
+
+    /**
+     * Returns the file extension to be used for given signature file (without leading dot), never {@code null}. The
+     * extension should be file and URL path friendly, and may differ from value returned by {@link #getName()}.
+     * Example: "asc".
+     */
+    String getFileExtension();
+
+    /**
+     * Each invocation of this method returns a new instance of algorithm, never {@code null} value.
+     * TODO: figure out some API for this to suit signing.
+     */
+    SignatureAlgorithm getAlgorithm();
+}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
new file mode 100644
index 0000000..27b04d0
--- /dev/null
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
@@ -0,0 +1,45 @@
+package org.eclipse.aether.spi.connector.signature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collection;
+
+/**
+ * Component performing selection of {@link SignatureAlgorithmFactory} based on known factory names.
+ *
+ * @since 1.8.0
+ */
+public interface SignatureAlgorithmFactorySelector
+{
+    /**
+     * Returns factory for given algorithm name, or throws if algorithm not supported.
+     *
+     * @throws IllegalArgumentException if asked algorithm name is not supported.
+     */
+    SignatureAlgorithmFactory select( String algorithmName );
+
+    /**
+     * Returns a collection of supported algorithm names. This set represents ALL the algorithms supported by Resolver,
+     * and is NOT in any relation to given repository layout used signatures, returned by method {@link
+     * org.eclipse.aether.spi.connector.layout.RepositoryLayout#getSignatureAlgorithmFactories()} (in fact, is super set
+     * of it).
+     */
+    Collection<SignatureAlgorithmFactory> getSignatureAlgorithmFactories();
+}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySupport.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySupport.java
new file mode 100644
index 0000000..2c6c7e3
--- /dev/null
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySupport.java
@@ -0,0 +1,59 @@
+package org.eclipse.aether.spi.connector.signature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Support class for {@link SignatureAlgorithmFactory} implementations.
+ *
+ * @since 1.8.0
+ */
+public abstract class SignatureAlgorithmFactorySupport
+    implements SignatureAlgorithmFactory
+{
+    private final String name;
+
+    private final String fileExtension;
+
+    public SignatureAlgorithmFactorySupport( String name, String fileExtension )
+    {
+        this.name = requireNonNull( name );
+        this.fileExtension = requireNonNull( fileExtension );
+    }
+
+    /**
+     * Returns the algorithm name, usually used as key, never {@code null} value.
+     */
+    @Override
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * Returns the file extension to be used for given signature algorithm (without leading dot), never {@code null}.
+     */
+    @Override
+    public String getFileExtension()
+    {
+        return fileExtension;
+    }
+}

[maven-resolver] 11/19: Refactor: it is layout matter, does an artifact has checksums or not.

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit b6b613a004c67f5a6c76282c7d4690923d94804b
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Mar 13 00:39:44 2022 +0100

    Refactor: it is layout matter, does an artifact has checksums or not.
    
    This is about REMOTE_EXTERNAL checksums, that ARE part of layout.
---
 .../eclipse/aether/impl/guice/AetherModule.java    |  5 --
 .../impl/Maven2RepositoryLayoutFactory.java        | 50 ++++++++----
 .../DefaultArtifactChecksumFilterFactory.java      | 90 ----------------------
 .../impl/Maven2RepositoryLayoutFactoryTest.java    |  5 +-
 .../connector/checksum/ArtifactChecksumFilter.java | 44 -----------
 .../checksum/ArtifactChecksumFilterFactory.java    | 36 ---------
 .../spi/connector/layout/RepositoryLayout.java     | 18 +++++
 7 files changed, 55 insertions(+), 193 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
index bf6e5ab..9629dc9 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
@@ -43,7 +43,6 @@ import org.eclipse.aether.impl.RepositoryEventDispatcher;
 import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
 import org.eclipse.aether.internal.impl.FileProvidedChecksumsSource;
 import org.eclipse.aether.internal.impl.TrackingFileManager;
-import org.eclipse.aether.internal.impl.checksum.DefaultArtifactChecksumFilterFactory;
 import org.eclipse.aether.internal.impl.checksum.Md5ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha1ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha256ChecksumAlgorithmFactory;
@@ -85,7 +84,6 @@ import org.eclipse.aether.internal.impl.Maven2RepositoryLayoutFactory;
 import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
 import org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory;
 import org.eclipse.aether.named.providers.NoopNamedLockFactory;
-import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilterFactory;
 import org.eclipse.aether.spi.connector.checksum.ProvidedChecksumsSource;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
@@ -172,9 +170,6 @@ public class AetherModule
                 .to( EnhancedLocalRepositoryManagerFactory.class ).in( Singleton.class );
         bind( TrackingFileManager.class ).to( DefaultTrackingFileManager.class ).in( Singleton.class );
 
-        bind( ArtifactChecksumFilterFactory.class )
-                .to( DefaultArtifactChecksumFilterFactory.class ).in( Singleton.class );
-
         bind( ProvidedChecksumsSource.class ).annotatedWith( Names.named( FileProvidedChecksumsSource.NAME ) ) //
             .to( FileProvidedChecksumsSource.class ).in( Singleton.class );
 
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index 202fe3c..f2433cc 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -26,6 +26,8 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -33,12 +35,9 @@ import javax.inject.Singleton;
 
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.internal.impl.checksum.DefaultArtifactChecksumFilterFactory;
 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
-import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilterFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
@@ -59,14 +58,17 @@ public final class Maven2RepositoryLayoutFactory
 
     public static final String CONFIG_PROP_CHECKSUMS_ALGORITHMS = "aether.checksums.algorithms";
 
-    static final String DEFAULT_CHECKSUMS_ALGORITHMS = "SHA-1,MD5";
+    private static final String DEFAULT_CHECKSUMS_ALGORITHMS = "SHA-1,MD5";
+
+    public static final String CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS =
+            "aether.checksums.omitChecksumsForExtensions";
+
+    private static final String DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS = ".asc";
 
     private float priority;
 
     private final ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector;
 
-    private final ArtifactChecksumFilterFactory artifactChecksumFilterFactory;
-
     public float getPriority()
     {
         return priority;
@@ -78,15 +80,13 @@ public final class Maven2RepositoryLayoutFactory
     @Deprecated
     public Maven2RepositoryLayoutFactory()
     {
-        this( new DefaultChecksumAlgorithmFactorySelector(), new DefaultArtifactChecksumFilterFactory() );
+        this( new DefaultChecksumAlgorithmFactorySelector() );
     }
 
     @Inject
-    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector,
-                                          ArtifactChecksumFilterFactory artifactChecksumFilterFactory )
+    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector )
     {
         this.checksumAlgorithmFactorySelector = requireNonNull( checksumAlgorithmFactorySelector );
-        this.artifactChecksumFilterFactory = requireNonNull( artifactChecksumFilterFactory );
     }
 
     /**
@@ -123,9 +123,15 @@ public final class Maven2RepositoryLayoutFactory
             checksumsAlgorithms.add( checksumAlgorithmFactorySelector.select( checksumsAlgorithmName ) );
         }
 
+        // ensure uniqueness of (potentially user set) extension list
+        Set<String> omitChecksumsForExtensions = Arrays.stream( ConfigUtils.getString(
+                        session, DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS, CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS )
+                .split( "," )
+        ).filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toSet() );
+
         return new Maven2RepositoryLayout(
                 checksumsAlgorithms,
-                artifactChecksumFilterFactory.newInstance( session, repository )
+                omitChecksumsForExtensions
         );
     }
 
@@ -135,13 +141,13 @@ public final class Maven2RepositoryLayoutFactory
 
         private final List<ChecksumAlgorithmFactory> checksumAlgorithms;
 
-        private final ArtifactChecksumFilter artifactChecksumFilter;
+        private final Set<String> extensionsWithoutChecksums;
 
         private Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms,
-                                          ArtifactChecksumFilter artifactChecksumFilter )
+                                        Set<String> extensionsWithoutChecksums )
         {
             this.checksumAlgorithms = Collections.unmodifiableList( checksumAlgorithms );
-            this.artifactChecksumFilter = artifactChecksumFilter;
+            this.extensionsWithoutChecksums = requireNonNull( extensionsWithoutChecksums );
         }
 
         private URI toUri( String path )
@@ -163,6 +169,20 @@ public final class Maven2RepositoryLayoutFactory
         }
 
         @Override
+        public boolean hasChecksums( Artifact artifact )
+        {
+            String artifactExtension = artifact.getExtension(); // ie. pom.asc
+            for ( String extensionWithoutChecksums : extensionsWithoutChecksums )
+            {
+                if ( artifactExtension.endsWith( extensionWithoutChecksums ) )
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        @Override
         public URI getLocation( Artifact artifact, boolean upload )
         {
             StringBuilder path = new StringBuilder( 128 );
@@ -216,7 +236,7 @@ public final class Maven2RepositoryLayoutFactory
         @Override
         public List<ChecksumLocation> getChecksumLocations( Artifact artifact, boolean upload, URI location )
         {
-            if ( artifactChecksumFilter.omitChecksumsFor( artifact ) || isChecksum( artifact.getExtension() ) )
+            if ( !hasChecksums( artifact ) || isChecksum( artifact.getExtension() ) )
             {
                 return Collections.emptyList();
             }
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/DefaultArtifactChecksumFilterFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/DefaultArtifactChecksumFilterFactory.java
deleted file mode 100644
index a7bea4c..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/DefaultArtifactChecksumFilterFactory.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.aether.internal.impl.checksum;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import java.util.Arrays;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
-import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilterFactory;
-import org.eclipse.aether.util.ConfigUtils;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * Default implementation that implements default resolver strategy: filters by known (user configured) extensions,
- * or by default only for GPG signature.
- *
- * @since 1.8.0
- */
-@Singleton
-@Named
-public class DefaultArtifactChecksumFilterFactory
-        implements ArtifactChecksumFilterFactory
-{
-    public static final String CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS =
-            "aether.checksums.omitChecksumsForExtensions";
-
-    private static final String DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS = ".asc";
-
-    @Override
-    public ArtifactChecksumFilter newInstance( RepositorySystemSession session, RemoteRepository repository )
-    {
-        // ensure uniqueness of (potentially user set) extension list
-        Set<String> omitChecksumsForExtensions = Arrays.stream( ConfigUtils.getString(
-                session, DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS, CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS )
-                .split( "," )
-        ).filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toSet() );
-
-        return new ExtensionArtifactChecksumFilter( omitChecksumsForExtensions );
-    }
-
-    private static class ExtensionArtifactChecksumFilter
-            implements ArtifactChecksumFilter
-    {
-        private final Set<String> extensionsWithoutChecksums;
-
-        private ExtensionArtifactChecksumFilter( Set<String> extensionsWithoutChecksums )
-        {
-            this.extensionsWithoutChecksums = requireNonNull( extensionsWithoutChecksums );
-        }
-
-        @Override
-        public boolean omitChecksumsFor( Artifact artifact )
-        {
-            String artifactExtension = artifact.getExtension(); // ie. pom.asc
-            for ( String extensionWithoutChecksums : extensionsWithoutChecksums )
-            {
-                if ( artifactExtension.endsWith( extensionWithoutChecksums ) )
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-}
diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
index 81c5dfb..c239165 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
@@ -28,7 +28,6 @@ import java.util.stream.Collectors;
 
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.internal.impl.checksum.DefaultArtifactChecksumFilterFactory;
 import org.eclipse.aether.internal.test.util.TestUtils;
 import org.eclipse.aether.metadata.DefaultMetadata;
 import org.eclipse.aether.metadata.Metadata;
@@ -312,7 +311,7 @@ public class Maven2RepositoryLayoutFactoryTest
     public void testSignatureChecksums_Force()
         throws Exception
     {
-        session.setConfigProperty( DefaultArtifactChecksumFilterFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, "" );
+        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, "" );
         layout = factory.newInstance( session, newRepo( "default" ) );
         DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.asc", "1.0" );
         URI uri = layout.getLocation( artifact, true );
@@ -324,7 +323,7 @@ public class Maven2RepositoryLayoutFactoryTest
     public void testCustomChecksumsIgnored()
             throws Exception
     {
-        session.setConfigProperty( DefaultArtifactChecksumFilterFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, ".asc,.foo" );
+        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, ".asc,.foo" );
         layout = factory.newInstance( session, newRepo( "default" ) );
         DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.foo", "1.0" );
         URI uri = layout.getLocation( artifact, true );
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
deleted file mode 100644
index bf19190..0000000
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.aether.spi.connector.checksum;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.eclipse.aether.artifact.Artifact;
-
-/**
- * Filter that is able to tell does artifact have expected checksums or not. Most notably, artifacts like
- * different kind of signatures will not have checksums.
- *
- * @since 1.8.0
- */
-public interface ArtifactChecksumFilter
-{
-    /**
-     * Tells whether given artifact have checksums according to current layout or not. If it returns {@code false},
-     * then layout configured checksums will be expected: on upload they will be calculated and deployed along
-     * artifact, on download they will be retrieved and validated.
-     *
-     * If it returns {@code true} the given artifacts will have checksums omitted: on upload they will not be
-     * calculated and deployed, and on download they will be not retrieved nor validated.
-     *
-     * Typical case to return {@code true} (to omit checksums) is for GPG signatures, that are already a "sub-artifact"
-     * of some main artifact (ie. a JAR), and they can be validated by some other means.
-     */
-    boolean omitChecksumsFor( Artifact artifact );
-}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilterFactory.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilterFactory.java
deleted file mode 100644
index d1df787..0000000
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilterFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.aether.spi.connector.checksum;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.RemoteRepository;
-
-/**
- * Factory component for {@link ArtifactChecksumFilter} instances.
- *
- * @since 1.8.0
- */
-public interface ArtifactChecksumFilterFactory
-{
-    /**
-     * Returns {@link ArtifactChecksumFilter} for given session and repository, never {@code null}.
-     */
-    ArtifactChecksumFilter newInstance( RepositorySystemSession session, RemoteRepository repository );
-}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
index 5db7deb..8e4bef0 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
@@ -134,6 +134,24 @@ public interface RepositoryLayout
     List<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories();
 
     /**
+     * Tells whether given artifact have remote external checksums according to current layout or not. If it returns
+     * {@code true}, then layout configured checksums will be expected: on upload they will be calculated and deployed
+     * along artifact, on download they will be retrieved and validated.
+     *
+     * If it returns {@code false} the given artifacts will have checksums omitted: on upload they will not be
+     * calculated and deployed, and on download they will be not retrieved nor validated.
+     *
+     * The result affects only layout provided checksums. See
+     * {@link org.eclipse.aether.spi.connector.checksum.ChecksumPolicy.ChecksumKind#REMOTE_EXTERNAL}.
+     * On download, the {@link org.eclipse.aether.spi.connector.layout.RepositoryLayout#getChecksumAlgorithmFactories()}
+     * layout required checksums are calculated, and non layout-provided checksums are still utilized.
+     *
+     * Typical case to return {@code true} (to omit checksums) is for artifact signatures, that are already a
+     * "sub-artifact" of some main artifact (for example a JAR), and they can be validated by some other means.
+     */
+    boolean hasChecksums( Artifact artifact );
+
+    /**
      * Gets the location within a remote repository where the specified artifact resides. The URI is relative to the
      * root directory of the repository.
      *

[maven-resolver] 06/19: Javadoc fixes

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit bfe042a3ec66164102e4715662508e9cff5bbd07
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 22 11:24:11 2022 +0100

    Javadoc fixes
---
 .../aether/spi/connector/checksum/ChecksumAlgorithmFactorySelector.java | 2 +-
 .../spi/connector/signature/SignatureAlgorithmFactorySelector.java      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ChecksumAlgorithmFactorySelector.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ChecksumAlgorithmFactorySelector.java
index 5bc0aa2..4b958a6 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ChecksumAlgorithmFactorySelector.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ChecksumAlgorithmFactorySelector.java
@@ -36,7 +36,7 @@ public interface ChecksumAlgorithmFactorySelector
     ChecksumAlgorithmFactory select( String algorithmName );
 
     /**
-     * Returns a collection of supported algorithm names. This set represents ALL the algorithms supported by Resolver,
+     * Returns a collection of supported algorithms. This set represents ALL the algorithms supported by Resolver,
      * and is NOT in any relation to given repository layout used checksums, returned by method {@link
      * org.eclipse.aether.spi.connector.layout.RepositoryLayout#getChecksumAlgorithmFactories()} (in fact, is super set
      * of it).
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
index 27b04d0..1a8ec46 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
@@ -36,7 +36,7 @@ public interface SignatureAlgorithmFactorySelector
     SignatureAlgorithmFactory select( String algorithmName );
 
     /**
-     * Returns a collection of supported algorithm names. This set represents ALL the algorithms supported by Resolver,
+     * Returns a collection of supported algorithms. This set represents ALL the algorithms supported by Resolver,
      * and is NOT in any relation to given repository layout used signatures, returned by method {@link
      * org.eclipse.aether.spi.connector.layout.RepositoryLayout#getSignatureAlgorithmFactories()} (in fact, is super set
      * of it).

[maven-resolver] 16/19: Sanitize checksums as well

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 1189c3cf3cd6c7e7ceb6257bfdea21ea17a192c9
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Mar 13 18:36:56 2022 +0100

    Sanitize checksums as well
---
 .../aether/internal/impl/Maven2RepositoryLayoutFactory.java      | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index f2433cc..860bc21 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -111,11 +111,10 @@ public final class Maven2RepositoryLayoutFactory
             throw new NoRepositoryLayoutException( repository );
         }
         // ensure order and uniqueness of (potentially user set) algorithm list
-        LinkedHashSet<String> checksumsAlgorithmNames = new LinkedHashSet<>( Arrays.asList(
-                ConfigUtils.getString(
-                        session, DEFAULT_CHECKSUMS_ALGORITHMS, CONFIG_PROP_CHECKSUMS_ALGORITHMS
-                ).split( "," ) )
-        );
+        LinkedHashSet<String> checksumsAlgorithmNames = Arrays.stream( ConfigUtils.getString(
+                        session, DEFAULT_CHECKSUMS_ALGORITHMS, CONFIG_PROP_CHECKSUMS_ALGORITHMS )
+                .split( "," )
+        ).filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toCollection( LinkedHashSet::new ) );
 
         List<ChecksumAlgorithmFactory> checksumsAlgorithms = new ArrayList<>( checksumsAlgorithmNames.size() );
         for ( String checksumsAlgorithmName : checksumsAlgorithmNames )

[maven-resolver] 14/19: Fix javadoc

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 88126818dca489347eb3340185f22c0e953f7389
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Mar 13 00:48:34 2022 +0100

    Fix javadoc
    
    The meaning has be reverted
---
 .../java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
index 796385f..8eaa5f6 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
@@ -146,7 +146,7 @@ public interface RepositoryLayout
      * On download, the {@link org.eclipse.aether.spi.connector.layout.RepositoryLayout#getChecksumAlgorithmFactories()}
      * layout required checksums are calculated, and non layout-provided checksums are still utilized.
      *
-     * Typical case to return {@code true} (to omit checksums) is for artifact signatures, that are already a
+     * Typical case to return {@code false} (to omit checksums) is for artifact signatures, that are already a
      * "sub-artifact" of some main artifact (for example a JAR), and they can be validated by some other means.
      *
      * @since 1.8.0

[maven-resolver] 13/19: Add since

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 2c0faac65bab8eb1a83a5e6ea67c985db1a67706
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Mar 13 00:47:41 2022 +0100

    Add since
---
 .../java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java  | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
index 8e4bef0..796385f 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
@@ -148,6 +148,8 @@ public interface RepositoryLayout
      *
      * Typical case to return {@code true} (to omit checksums) is for artifact signatures, that are already a
      * "sub-artifact" of some main artifact (for example a JAR), and they can be validated by some other means.
+     *
+     * @since 1.8.0
      */
     boolean hasChecksums( Artifact artifact );
 

[maven-resolver] 07/19: Refactor, drop signatures

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 7e6befa1955efa7e19cf051822ef886b44429356
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Mar 11 10:24:45 2022 +0100

    Refactor, drop signatures
    
    Resolver should not be aware of signatures at all, it merely
    should be able to decide is a checksum validation for given
    artifact expected or not.
---
 .../eclipse/aether/impl/guice/AetherModule.java    | 19 -----
 .../impl/Maven2RepositoryLayoutFactory.java        | 85 +++++----------------
 .../checksum/ArtifactExtensionChecksumFilter.java  | 62 +++++++++++++++
 .../DefaultSignatureAlgorithmFactorySelector.java  | 89 ----------------------
 .../signature/GpgSignatureAlgorithmFactory.java    | 52 -------------
 .../impl/Maven2RepositoryLayoutFactoryTest.java    | 14 +++-
 .../ArtifactChecksumFilter.java}                   | 18 ++---
 .../spi/connector/layout/RepositoryLayout.java     |  8 --
 .../signature/SignatureAlgorithmFactory.java       | 49 ------------
 .../SignatureAlgorithmFactorySelector.java         | 45 -----------
 .../SignatureAlgorithmFactorySupport.java          | 59 --------------
 src/site/markdown/configuration.md                 |  3 +-
 12 files changed, 105 insertions(+), 398 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
index 64a201b..9629dc9 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
@@ -48,8 +48,6 @@ import org.eclipse.aether.internal.impl.checksum.Sha1ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha256ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha512ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
-import org.eclipse.aether.internal.impl.signature.DefaultSignatureAlgorithmFactorySelector;
-import org.eclipse.aether.internal.impl.signature.GpgSignatureAlgorithmFactory;
 import org.eclipse.aether.internal.impl.synccontext.DefaultSyncContextFactory;
 import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactorySelector;
 import org.eclipse.aether.internal.impl.synccontext.named.SimpleNamedLockFactorySelector;
@@ -92,8 +90,6 @@ import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.transport.TransporterProvider;
 import org.eclipse.aether.spi.io.FileProcessor;
 import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
@@ -188,11 +184,6 @@ public class AetherModule
         bind( ChecksumAlgorithmFactorySelector.class )
                 .to( DefaultChecksumAlgorithmFactorySelector.class ).in ( Singleton.class );
 
-        bind( SignatureAlgorithmFactory.class ).annotatedWith( Names.named( GpgSignatureAlgorithmFactory.NAME ) )
-                .to( GpgSignatureAlgorithmFactory.class );
-        bind( SignatureAlgorithmFactorySelector.class )
-                .to( DefaultSignatureAlgorithmFactorySelector.class ).in ( Singleton.class );
-
         bind( NamedLockFactorySelector.class ).to( SimpleNamedLockFactorySelector.class ).in( Singleton.class );
         bind( SyncContextFactory.class ).to( DefaultSyncContextFactory.class ).in( Singleton.class );
         bind( org.eclipse.aether.impl.SyncContextFactory.class )
@@ -250,16 +241,6 @@ public class AetherModule
 
     @Provides
     @Singleton
-    Map<String, SignatureAlgorithmFactory> provideSignatureTypes(
-            @Named( GpgSignatureAlgorithmFactory.NAME ) SignatureAlgorithmFactory gpg )
-    {
-        Map<String, SignatureAlgorithmFactory> checksumTypes = new HashMap<>();
-        checksumTypes.put( GpgSignatureAlgorithmFactory.NAME, gpg );
-        return Collections.unmodifiableMap( checksumTypes );
-    }
-
-    @Provides
-    @Singleton
     Map<String, NameMapper> provideNameMappers(
             @Named( StaticNameMapper.NAME ) NameMapper staticNameMapper,
             @Named( GAVNameMapper.NAME ) NameMapper gavNameMapper,
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index cf30963..869b718 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -26,6 +26,8 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -33,16 +35,15 @@ import javax.inject.Singleton;
 
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.internal.impl.checksum.ArtifactExtensionChecksumFilter;
 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
-import org.eclipse.aether.internal.impl.signature.DefaultSignatureAlgorithmFactorySelector;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySelector;
 import org.eclipse.aether.transfer.NoRepositoryLayoutException;
 import org.eclipse.aether.util.ConfigUtils;
 
@@ -57,22 +58,18 @@ public final class Maven2RepositoryLayoutFactory
         implements RepositoryLayoutFactory
 {
 
-    static final String CONFIG_PROP_SIGNATURE_CHECKSUMS = "aether.checksums.forSignature";
-
     static final String CONFIG_PROP_CHECKSUMS_ALGORITHMS = "aether.checksums.algorithms";
 
     static final String DEFAULT_CHECKSUMS_ALGORITHMS = "SHA-1,MD5";
 
-    static final String CONFIG_PROP_SIGNATURE_ALGORITHMS = "aether.signatures.algorithms";
+    static final String CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS = "aether.checksums.omitChecksumsForExtensions";
 
-    static final String DEFAULT_SIGNATURE_ALGORITHMS = "GPG";
+    static final String DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS = ".asc";
 
     private float priority;
 
     private final ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector;
 
-    private final SignatureAlgorithmFactorySelector signatureAlgorithmFactorySelector;
-
     public float getPriority()
     {
         return priority;
@@ -84,15 +81,13 @@ public final class Maven2RepositoryLayoutFactory
     @Deprecated
     public Maven2RepositoryLayoutFactory()
     {
-        this( new DefaultChecksumAlgorithmFactorySelector(), new DefaultSignatureAlgorithmFactorySelector() );
+        this( new DefaultChecksumAlgorithmFactorySelector() );
     }
 
     @Inject
-    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector,
-                                          SignatureAlgorithmFactorySelector signatureAlgorithmFactorySelector )
+    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector )
     {
         this.checksumAlgorithmFactorySelector = requireNonNull( checksumAlgorithmFactorySelector );
-        this.signatureAlgorithmFactorySelector = requireNonNull( signatureAlgorithmFactorySelector );
     }
 
     /**
@@ -116,7 +111,6 @@ public final class Maven2RepositoryLayoutFactory
         {
             throw new NoRepositoryLayoutException( repository );
         }
-        boolean forSignature = ConfigUtils.getBoolean( session, false, CONFIG_PROP_SIGNATURE_CHECKSUMS );
         // ensure order and uniqueness of (potentially user set) algorithm list
         LinkedHashSet<String> checksumsAlgorithmNames = new LinkedHashSet<>( Arrays.asList(
                 ConfigUtils.getString(
@@ -130,22 +124,17 @@ public final class Maven2RepositoryLayoutFactory
             checksumsAlgorithms.add( checksumAlgorithmFactorySelector.select( checksumsAlgorithmName ) );
         }
 
-        // ensure order and uniqueness of (potentially user set) algorithm list
-        LinkedHashSet<String> signatureAlgorithmNames = new LinkedHashSet<>( Arrays.asList(
+        // ensure uniqueness of (potentially user set) extension list
+        Set<String> omitChecksumsForExtensions = Arrays.stream(
                 ConfigUtils.getString(
-                        session, DEFAULT_SIGNATURE_ALGORITHMS, CONFIG_PROP_SIGNATURE_ALGORITHMS
-                ).split( "," ) )
-        );
+                        session, DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS, CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS )
+                        .split( "," ) )
+                .filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toSet() );
 
-        List<SignatureAlgorithmFactory> signatureAlgorithms = new ArrayList<>( signatureAlgorithmNames.size() );
-        for ( String signatureAlgorithmName : signatureAlgorithmNames )
-        {
-            signatureAlgorithms.add( signatureAlgorithmFactorySelector.select( signatureAlgorithmName ) );
-        }
+        ArtifactExtensionChecksumFilter artifactChecksumFilter =
+                new ArtifactExtensionChecksumFilter( omitChecksumsForExtensions );
 
-        return forSignature
-                ? new Maven2RepositoryLayout( checksumsAlgorithms, signatureAlgorithms )
-                : new Maven2RepositoryLayoutEx( checksumsAlgorithms, signatureAlgorithms );
+        return new Maven2RepositoryLayout( checksumsAlgorithms, artifactChecksumFilter );
     }
 
     private static class Maven2RepositoryLayout
@@ -154,13 +143,13 @@ public final class Maven2RepositoryLayoutFactory
 
         protected final List<ChecksumAlgorithmFactory> checksumAlgorithms;
 
-        protected final List<SignatureAlgorithmFactory> signatureAlgorithms;
+        protected final ArtifactChecksumFilter artifactChecksumFilter;
 
         protected Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms,
-                                          List<SignatureAlgorithmFactory> signatureAlgorithms )
+                                          ArtifactChecksumFilter artifactChecksumFilter )
         {
             this.checksumAlgorithms = Collections.unmodifiableList( checksumAlgorithms );
-            this.signatureAlgorithms = Collections.unmodifiableList( signatureAlgorithms );
+            this.artifactChecksumFilter = artifactChecksumFilter;
         }
 
         private URI toUri( String path )
@@ -182,12 +171,6 @@ public final class Maven2RepositoryLayoutFactory
         }
 
         @Override
-        public List<SignatureAlgorithmFactory> getSignatureAlgorithmFactories()
-        {
-            return signatureAlgorithms;
-        }
-
-        @Override
         public URI getLocation( Artifact artifact, boolean upload )
         {
             StringBuilder path = new StringBuilder( 128 );
@@ -241,7 +224,7 @@ public final class Maven2RepositoryLayoutFactory
         @Override
         public List<ChecksumLocation> getChecksumLocations( Artifact artifact, boolean upload, URI location )
         {
-            if ( isChecksum( artifact.getExtension() ) )
+            if ( artifactChecksumFilter.omitChecksumsFor( artifact ) || isChecksum( artifact.getExtension() ) )
             {
                 return Collections.emptyList();
             }
@@ -269,32 +252,4 @@ public final class Maven2RepositoryLayoutFactory
             return checksumAlgorithms.stream().anyMatch( a -> extension.endsWith( "." + a.getFileExtension() ) );
         }
     }
-
-    private static class Maven2RepositoryLayoutEx
-            extends Maven2RepositoryLayout
-    {
-
-        protected Maven2RepositoryLayoutEx( List<ChecksumAlgorithmFactory> checksumAlgorithms,
-                                            List<SignatureAlgorithmFactory> signatureAlgorithms )
-        {
-            super( checksumAlgorithms, signatureAlgorithms );
-        }
-
-        @Override
-        public List<ChecksumLocation> getChecksumLocations( Artifact artifact, boolean upload, URI location )
-        {
-            if ( isSignature( artifact.getExtension() ) )
-            {
-                return Collections.emptyList();
-            }
-            return super.getChecksumLocations( artifact, upload, location );
-        }
-
-        private boolean isSignature( String extension )
-        {
-            return signatureAlgorithms.stream().anyMatch( a -> extension.endsWith( "." + a.getFileExtension() ) );
-        }
-
-    }
-
 }
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/ArtifactExtensionChecksumFilter.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/ArtifactExtensionChecksumFilter.java
new file mode 100644
index 0000000..ee2ae1e
--- /dev/null
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/ArtifactExtensionChecksumFilter.java
@@ -0,0 +1,62 @@
+package org.eclipse.aether.internal.impl.checksum;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.util.Set;
+
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Default implementation.
+ *
+ * @since 1.8.0
+ */
+@Singleton
+@Named
+public class ArtifactExtensionChecksumFilter
+        implements ArtifactChecksumFilter
+{
+    private final Set<String> extensionsWithoutChecksums;
+
+    public ArtifactExtensionChecksumFilter( Set<String> extensionsWithoutChecksums )
+    {
+        this.extensionsWithoutChecksums = requireNonNull( extensionsWithoutChecksums );
+    }
+
+    @Override
+    public boolean omitChecksumsFor( Artifact artifact )
+    {
+        String artifactExtension = artifact.getExtension(); // ie. pom.asc
+        for ( String extensionWithoutChecksums : extensionsWithoutChecksums )
+        {
+            if ( artifactExtension.endsWith( extensionWithoutChecksums ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/DefaultSignatureAlgorithmFactorySelector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/DefaultSignatureAlgorithmFactorySelector.java
deleted file mode 100644
index 2455d52..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/DefaultSignatureAlgorithmFactorySelector.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.aether.internal.impl.signature;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySelector;
-
-import static java.util.Objects.requireNonNull;
-import static java.util.stream.Collectors.toList;
-
-/**
- * Default implementation.
- *
- * @since 1.8.0
- */
-@Singleton
-@Named
-public class DefaultSignatureAlgorithmFactorySelector
-        implements SignatureAlgorithmFactorySelector
-{
-    private final Map<String, SignatureAlgorithmFactory> factories;
-
-    /**
-     * Default ctor for SL.
-     */
-    @Deprecated
-    public DefaultSignatureAlgorithmFactorySelector()
-    {
-        this.factories = new HashMap<>();
-        this.factories.put( GpgSignatureAlgorithmFactory.NAME, new GpgSignatureAlgorithmFactory() );
-    }
-
-    @Inject
-    public DefaultSignatureAlgorithmFactorySelector( Map<String, SignatureAlgorithmFactory> factories )
-    {
-        this.factories = requireNonNull( factories );
-    }
-
-    @Override
-    public SignatureAlgorithmFactory select( String algorithmName )
-    {
-        requireNonNull( algorithmName, "algorithmMame must not be null" );
-        SignatureAlgorithmFactory factory = factories.get( algorithmName );
-        if ( factory == null )
-        {
-            throw new IllegalArgumentException(
-                    String.format( "Unsupported signature algorithm %s, supported ones are %s",
-                            algorithmName,
-                            getSignatureAlgorithmFactories().stream()
-                                    .map( SignatureAlgorithmFactory::getName )
-                                    .collect( toList() )
-                    )
-            );
-        }
-        return factory;
-    }
-
-    @Override
-    public List<SignatureAlgorithmFactory> getSignatureAlgorithmFactories()
-    {
-        return new ArrayList<>( factories.values() );
-    }
-}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/GpgSignatureAlgorithmFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/GpgSignatureAlgorithmFactory.java
deleted file mode 100644
index 2f7ac67..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/signature/GpgSignatureAlgorithmFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.aether.internal.impl.signature;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithm;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactorySupport;
-
-/**
- * The GPG signature type.
- *
- * @since 1.8.0
- */
-@Singleton
-@Named( GpgSignatureAlgorithmFactory.NAME )
-public class GpgSignatureAlgorithmFactory
-        extends SignatureAlgorithmFactorySupport
-{
-    public static final String NAME = "GPG";
-
-    @Inject
-    public GpgSignatureAlgorithmFactory()
-    {
-        super( NAME, "asc" );
-    }
-
-    @Override
-    public SignatureAlgorithm getAlgorithm()
-    {
-        throw new IllegalStateException( "not implemented" );
-    }
-}
diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
index 108bf90..c239165 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
@@ -311,7 +311,7 @@ public class Maven2RepositoryLayoutFactoryTest
     public void testSignatureChecksums_Force()
         throws Exception
     {
-        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_SIGNATURE_CHECKSUMS, "true" );
+        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, "" );
         layout = factory.newInstance( session, newRepo( "default" ) );
         DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.asc", "1.0" );
         URI uri = layout.getLocation( artifact, true );
@@ -319,4 +319,16 @@ public class Maven2RepositoryLayoutFactoryTest
         assertChecksums( checksums, "g/i/d/a-i.d/1.0/a-i.d-1.0-cls.jar.asc", SHA1, MD5 );
     }
 
+    @Test
+    public void testCustomChecksumsIgnored()
+            throws Exception
+    {
+        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, ".asc,.foo" );
+        layout = factory.newInstance( session, newRepo( "default" ) );
+        DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.foo", "1.0" );
+        URI uri = layout.getLocation( artifact, true );
+        List<ChecksumLocation> checksums = layout.getChecksumLocations( artifact, true, uri );
+        assertEquals( 0, checksums.size() );
+    }
+
 }
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithm.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
similarity index 58%
rename from maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithm.java
rename to maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
index 4ab960f..430bd16 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithm.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
@@ -1,4 +1,4 @@
-package org.eclipse.aether.spi.connector.signature;
+package org.eclipse.aether.spi.connector.checksum;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,20 +19,20 @@ package org.eclipse.aether.spi.connector.signature;
  * under the License.
  */
 
-import java.io.Closeable;
-import java.nio.ByteBuffer;
+import org.eclipse.aether.artifact.Artifact;
 
 /**
- * Implementation performing signature calculation for specific algorithm. Instances of this interface are stateful,
- * non-thread safe, and should not be reused.
+ * Filter that is able to tell does artifact should have expected checksums or not. Most notably, artifacts like
+ * different kind of signatures will not have checksums.
  *
  * @since 1.8.0
  */
-public interface SignatureAlgorithm extends Closeable
+public interface ArtifactChecksumFilter
 {
     /**
-     * Updates the checksum algorithm inner state with input.
-     * TODO: figure out some API for this to suit signing.
+     * Returns {@code true} if the given artifact does not have expected checksums. Hence, the artifact checksums will
+     * not be validated during transport. If {@code false} returned, the artifact will have its checksums fetched and
+     * validated.
      */
-    void update( ByteBuffer input );
+    boolean omitChecksumsFor( Artifact artifact );
 }
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
index f461560..5db7deb 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
@@ -27,7 +27,6 @@ import static java.util.Objects.requireNonNull;
 import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
-import org.eclipse.aether.spi.connector.signature.SignatureAlgorithmFactory;
 
 /**
  * The layout for a remote repository whose artifacts/metadata can be addressed via URIs.
@@ -135,13 +134,6 @@ public interface RepositoryLayout
     List<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories();
 
     /**
-     * Returns immutable list of {@link SignatureAlgorithmFactory} this instance of layout uses, never {@code null}.
-     *
-     * @since 1.8.0
-     */
-    List<SignatureAlgorithmFactory> getSignatureAlgorithmFactories();
-
-    /**
      * Gets the location within a remote repository where the specified artifact resides. The URI is relative to the
      * root directory of the repository.
      *
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactory.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactory.java
deleted file mode 100644
index 0c7bf7c..0000000
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.aether.spi.connector.signature;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * A component representing a signature factory: provides {@link SignatureAlgorithm} instances, name and extension to be
- * used with this algorithm. While directly injecting components of this type is possible, it is not recommended. To
- * obtain factory instances use {@link SignatureAlgorithmFactorySelector} instead.
- *
- * @since 1.8.0
- */
-public interface SignatureAlgorithmFactory
-{
-    /**
-     * Returns the algorithm name, usually used as key, never {@code null} value. The name is a standard name of
-     * algorithm (if applicable) or any other designator that is algorithm commonly referred with. Example: "GPG".
-     */
-    String getName();
-
-    /**
-     * Returns the file extension to be used for given signature file (without leading dot), never {@code null}. The
-     * extension should be file and URL path friendly, and may differ from value returned by {@link #getName()}.
-     * Example: "asc".
-     */
-    String getFileExtension();
-
-    /**
-     * Each invocation of this method returns a new instance of algorithm, never {@code null} value.
-     * TODO: figure out some API for this to suit signing.
-     */
-    SignatureAlgorithm getAlgorithm();
-}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
deleted file mode 100644
index 1a8ec46..0000000
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySelector.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.aether.spi.connector.signature;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Collection;
-
-/**
- * Component performing selection of {@link SignatureAlgorithmFactory} based on known factory names.
- *
- * @since 1.8.0
- */
-public interface SignatureAlgorithmFactorySelector
-{
-    /**
-     * Returns factory for given algorithm name, or throws if algorithm not supported.
-     *
-     * @throws IllegalArgumentException if asked algorithm name is not supported.
-     */
-    SignatureAlgorithmFactory select( String algorithmName );
-
-    /**
-     * Returns a collection of supported algorithms. This set represents ALL the algorithms supported by Resolver,
-     * and is NOT in any relation to given repository layout used signatures, returned by method {@link
-     * org.eclipse.aether.spi.connector.layout.RepositoryLayout#getSignatureAlgorithmFactories()} (in fact, is super set
-     * of it).
-     */
-    Collection<SignatureAlgorithmFactory> getSignatureAlgorithmFactories();
-}
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySupport.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySupport.java
deleted file mode 100644
index 2c6c7e3..0000000
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/signature/SignatureAlgorithmFactorySupport.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.aether.spi.connector.signature;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * Support class for {@link SignatureAlgorithmFactory} implementations.
- *
- * @since 1.8.0
- */
-public abstract class SignatureAlgorithmFactorySupport
-    implements SignatureAlgorithmFactory
-{
-    private final String name;
-
-    private final String fileExtension;
-
-    public SignatureAlgorithmFactorySupport( String name, String fileExtension )
-    {
-        this.name = requireNonNull( name );
-        this.fileExtension = requireNonNull( fileExtension );
-    }
-
-    /**
-     * Returns the algorithm name, usually used as key, never {@code null} value.
-     */
-    @Override
-    public String getName()
-    {
-        return name;
-    }
-
-    /**
-     * Returns the file extension to be used for given signature algorithm (without leading dot), never {@code null}.
-     */
-    @Override
-    public String getFileExtension()
-    {
-        return fileExtension;
-    }
-}
diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md
index 333ffe1..3b19f01 100644
--- a/src/site/markdown/configuration.md
+++ b/src/site/markdown/configuration.md
@@ -21,9 +21,8 @@ under the License.
 Option | Type | Description | Default Value | Supports Repo ID Suffix
 --- | --- | --- | --- | ---
 `aether.artifactResolver.snapshotNormalization` | boolean | It replaces the timestamped snapshot file name with a filename containing the `SNAPSHOT` qualifier only. This only affects resolving/retrieving artifacts but not uploading those. | `true` | no
-`aether.checksums.forSignature` | boolean | Flag indicating if signature artifacts (`.asc`) should have checksums. | `false` | no
+`aether.checksums.omitChecksumsForExtensions` | String | Comma separated list of extensions (`.asc`) that should have checksums omitted. | `.asc` | no
 `aether.checksums.algorithms` | String | Comma separated list of checksum algorithms with which checksums are validated (downloaded) and generated (uploaded). Resolver by default supports following algorithms: `MD5`, `SHA-1`, `SHA-256` and `SHA-512`. New algorithms can be added by implementing `ChecksumAlgorithmFactory` component. | `"SHA-1,MD5"` | no
-`aether.signatures.algorithms` | String | Comma separated list of signature algorithms with which signatures are recognized. Resolver by default supports following algorithms: `GPG`. New algorithms can be added by implementing `SignatureAlgorithmFactory` component. | `"GPG"` | no
 `aether.conflictResolver.verbose` | boolean | Flag controlling the conflict resolver's verbose mode. | `false` | no
 `aether.connector.basic.threads` or `maven.artifact.threads` | int | Number of threads to use for uploading/downloading. | `5` | no
 `aether.connector.classpath.loader` | ClassLoader | `ClassLoader` from which resources should be retrieved which start with the `classpath:` protocol. | `Thread.currentThread().getContextClassLoader()` | no

[maven-resolver] 09/19: Componentize filter factory, expand doco for 1.7.x behaviour

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 5b9a21e4285867e98fc3ee4169f399c73d15b743
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Mar 11 12:33:07 2022 +0100

    Componentize filter factory, expand doco for 1.7.x behaviour
---
 .../eclipse/aether/impl/guice/AetherModule.java    |  5 ++
 .../impl/Maven2RepositoryLayoutFactory.java        | 34 ++++----
 .../checksum/ArtifactExtensionChecksumFilter.java  | 62 ---------------
 .../DefaultArtifactChecksumFilterFactory.java      | 90 ++++++++++++++++++++++
 .../impl/Maven2RepositoryLayoutFactoryTest.java    |  5 +-
 .../checksum/ArtifactChecksumFilterFactory.java    | 36 +++++++++
 src/site/markdown/configuration.md                 |  2 +-
 7 files changed, 148 insertions(+), 86 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
index 9629dc9..bf6e5ab 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/impl/guice/AetherModule.java
@@ -43,6 +43,7 @@ import org.eclipse.aether.impl.RepositoryEventDispatcher;
 import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
 import org.eclipse.aether.internal.impl.FileProvidedChecksumsSource;
 import org.eclipse.aether.internal.impl.TrackingFileManager;
+import org.eclipse.aether.internal.impl.checksum.DefaultArtifactChecksumFilterFactory;
 import org.eclipse.aether.internal.impl.checksum.Md5ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha1ChecksumAlgorithmFactory;
 import org.eclipse.aether.internal.impl.checksum.Sha256ChecksumAlgorithmFactory;
@@ -84,6 +85,7 @@ import org.eclipse.aether.internal.impl.Maven2RepositoryLayoutFactory;
 import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
 import org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory;
 import org.eclipse.aether.named.providers.NoopNamedLockFactory;
+import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilterFactory;
 import org.eclipse.aether.spi.connector.checksum.ProvidedChecksumsSource;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
@@ -170,6 +172,9 @@ public class AetherModule
                 .to( EnhancedLocalRepositoryManagerFactory.class ).in( Singleton.class );
         bind( TrackingFileManager.class ).to( DefaultTrackingFileManager.class ).in( Singleton.class );
 
+        bind( ArtifactChecksumFilterFactory.class )
+                .to( DefaultArtifactChecksumFilterFactory.class ).in( Singleton.class );
+
         bind( ProvidedChecksumsSource.class ).annotatedWith( Names.named( FileProvidedChecksumsSource.NAME ) ) //
             .to( FileProvidedChecksumsSource.class ).in( Singleton.class );
 
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index 7e9c4eb..202fe3c 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -26,8 +26,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -35,11 +33,12 @@ import javax.inject.Singleton;
 
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.internal.impl.checksum.ArtifactExtensionChecksumFilter;
+import org.eclipse.aether.internal.impl.checksum.DefaultArtifactChecksumFilterFactory;
 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
+import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilterFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
 import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
@@ -58,18 +57,16 @@ public final class Maven2RepositoryLayoutFactory
         implements RepositoryLayoutFactory
 {
 
-    static final String CONFIG_PROP_CHECKSUMS_ALGORITHMS = "aether.checksums.algorithms";
+    public static final String CONFIG_PROP_CHECKSUMS_ALGORITHMS = "aether.checksums.algorithms";
 
     static final String DEFAULT_CHECKSUMS_ALGORITHMS = "SHA-1,MD5";
 
-    static final String CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS = "aether.checksums.omitChecksumsForExtensions";
-
-    static final String DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS = ".asc";
-
     private float priority;
 
     private final ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector;
 
+    private final ArtifactChecksumFilterFactory artifactChecksumFilterFactory;
+
     public float getPriority()
     {
         return priority;
@@ -81,13 +78,15 @@ public final class Maven2RepositoryLayoutFactory
     @Deprecated
     public Maven2RepositoryLayoutFactory()
     {
-        this( new DefaultChecksumAlgorithmFactorySelector() );
+        this( new DefaultChecksumAlgorithmFactorySelector(), new DefaultArtifactChecksumFilterFactory() );
     }
 
     @Inject
-    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector )
+    public Maven2RepositoryLayoutFactory( ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector,
+                                          ArtifactChecksumFilterFactory artifactChecksumFilterFactory )
     {
         this.checksumAlgorithmFactorySelector = requireNonNull( checksumAlgorithmFactorySelector );
+        this.artifactChecksumFilterFactory = requireNonNull( artifactChecksumFilterFactory );
     }
 
     /**
@@ -124,17 +123,10 @@ public final class Maven2RepositoryLayoutFactory
             checksumsAlgorithms.add( checksumAlgorithmFactorySelector.select( checksumsAlgorithmName ) );
         }
 
-        // ensure uniqueness of (potentially user set) extension list
-        Set<String> omitChecksumsForExtensions = Arrays.stream(
-                ConfigUtils.getString(
-                        session, DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS, CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS )
-                        .split( "," ) )
-                .filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toSet() );
-
-        ArtifactExtensionChecksumFilter artifactChecksumFilter =
-                new ArtifactExtensionChecksumFilter( omitChecksumsForExtensions );
-
-        return new Maven2RepositoryLayout( checksumsAlgorithms, artifactChecksumFilter );
+        return new Maven2RepositoryLayout(
+                checksumsAlgorithms,
+                artifactChecksumFilterFactory.newInstance( session, repository )
+        );
     }
 
     private static class Maven2RepositoryLayout
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/ArtifactExtensionChecksumFilter.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/ArtifactExtensionChecksumFilter.java
deleted file mode 100644
index ee2ae1e..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/ArtifactExtensionChecksumFilter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.aether.internal.impl.checksum;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import java.util.Set;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * Default implementation.
- *
- * @since 1.8.0
- */
-@Singleton
-@Named
-public class ArtifactExtensionChecksumFilter
-        implements ArtifactChecksumFilter
-{
-    private final Set<String> extensionsWithoutChecksums;
-
-    public ArtifactExtensionChecksumFilter( Set<String> extensionsWithoutChecksums )
-    {
-        this.extensionsWithoutChecksums = requireNonNull( extensionsWithoutChecksums );
-    }
-
-    @Override
-    public boolean omitChecksumsFor( Artifact artifact )
-    {
-        String artifactExtension = artifact.getExtension(); // ie. pom.asc
-        for ( String extensionWithoutChecksums : extensionsWithoutChecksums )
-        {
-            if ( artifactExtension.endsWith( extensionWithoutChecksums ) )
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/DefaultArtifactChecksumFilterFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/DefaultArtifactChecksumFilterFactory.java
new file mode 100644
index 0000000..a7bea4c
--- /dev/null
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/DefaultArtifactChecksumFilterFactory.java
@@ -0,0 +1,90 @@
+package org.eclipse.aether.internal.impl.checksum;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilter;
+import org.eclipse.aether.spi.connector.checksum.ArtifactChecksumFilterFactory;
+import org.eclipse.aether.util.ConfigUtils;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Default implementation that implements default resolver strategy: filters by known (user configured) extensions,
+ * or by default only for GPG signature.
+ *
+ * @since 1.8.0
+ */
+@Singleton
+@Named
+public class DefaultArtifactChecksumFilterFactory
+        implements ArtifactChecksumFilterFactory
+{
+    public static final String CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS =
+            "aether.checksums.omitChecksumsForExtensions";
+
+    private static final String DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS = ".asc";
+
+    @Override
+    public ArtifactChecksumFilter newInstance( RepositorySystemSession session, RemoteRepository repository )
+    {
+        // ensure uniqueness of (potentially user set) extension list
+        Set<String> omitChecksumsForExtensions = Arrays.stream( ConfigUtils.getString(
+                session, DEFAULT_OMIT_CHECKSUMS_FOR_EXTENSIONS, CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS )
+                .split( "," )
+        ).filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toSet() );
+
+        return new ExtensionArtifactChecksumFilter( omitChecksumsForExtensions );
+    }
+
+    private static class ExtensionArtifactChecksumFilter
+            implements ArtifactChecksumFilter
+    {
+        private final Set<String> extensionsWithoutChecksums;
+
+        private ExtensionArtifactChecksumFilter( Set<String> extensionsWithoutChecksums )
+        {
+            this.extensionsWithoutChecksums = requireNonNull( extensionsWithoutChecksums );
+        }
+
+        @Override
+        public boolean omitChecksumsFor( Artifact artifact )
+        {
+            String artifactExtension = artifact.getExtension(); // ie. pom.asc
+            for ( String extensionWithoutChecksums : extensionsWithoutChecksums )
+            {
+                if ( artifactExtension.endsWith( extensionWithoutChecksums ) )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}
diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
index c239165..81c5dfb 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactoryTest.java
@@ -28,6 +28,7 @@ import java.util.stream.Collectors;
 
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.internal.impl.checksum.DefaultArtifactChecksumFilterFactory;
 import org.eclipse.aether.internal.test.util.TestUtils;
 import org.eclipse.aether.metadata.DefaultMetadata;
 import org.eclipse.aether.metadata.Metadata;
@@ -311,7 +312,7 @@ public class Maven2RepositoryLayoutFactoryTest
     public void testSignatureChecksums_Force()
         throws Exception
     {
-        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, "" );
+        session.setConfigProperty( DefaultArtifactChecksumFilterFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, "" );
         layout = factory.newInstance( session, newRepo( "default" ) );
         DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.asc", "1.0" );
         URI uri = layout.getLocation( artifact, true );
@@ -323,7 +324,7 @@ public class Maven2RepositoryLayoutFactoryTest
     public void testCustomChecksumsIgnored()
             throws Exception
     {
-        session.setConfigProperty( Maven2RepositoryLayoutFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, ".asc,.foo" );
+        session.setConfigProperty( DefaultArtifactChecksumFilterFactory.CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS, ".asc,.foo" );
         layout = factory.newInstance( session, newRepo( "default" ) );
         DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.foo", "1.0" );
         URI uri = layout.getLocation( artifact, true );
diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilterFactory.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilterFactory.java
new file mode 100644
index 0000000..d1df787
--- /dev/null
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilterFactory.java
@@ -0,0 +1,36 @@
+package org.eclipse.aether.spi.connector.checksum;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Factory component for {@link ArtifactChecksumFilter} instances.
+ *
+ * @since 1.8.0
+ */
+public interface ArtifactChecksumFilterFactory
+{
+    /**
+     * Returns {@link ArtifactChecksumFilter} for given session and repository, never {@code null}.
+     */
+    ArtifactChecksumFilter newInstance( RepositorySystemSession session, RemoteRepository repository );
+}
diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md
index 3b19f01..adfa9a8 100644
--- a/src/site/markdown/configuration.md
+++ b/src/site/markdown/configuration.md
@@ -21,7 +21,7 @@ under the License.
 Option | Type | Description | Default Value | Supports Repo ID Suffix
 --- | --- | --- | --- | ---
 `aether.artifactResolver.snapshotNormalization` | boolean | It replaces the timestamped snapshot file name with a filename containing the `SNAPSHOT` qualifier only. This only affects resolving/retrieving artifacts but not uploading those. | `true` | no
-`aether.checksums.omitChecksumsForExtensions` | String | Comma separated list of extensions (`.asc`) that should have checksums omitted. | `.asc` | no
+`aether.checksums.omitChecksumsForExtensions` | String | Comma separated list of extensions (`.asc`) that should have checksums omitted. Note: to achieve 1.7.x `aether.checksums.forSignature=true` behaviour, pass empty string as value for this property. | `.asc` | no
 `aether.checksums.algorithms` | String | Comma separated list of checksum algorithms with which checksums are validated (downloaded) and generated (uploaded). Resolver by default supports following algorithms: `MD5`, `SHA-1`, `SHA-256` and `SHA-512`. New algorithms can be added by implementing `ChecksumAlgorithmFactory` component. | `"SHA-1,MD5"` | no
 `aether.conflictResolver.verbose` | boolean | Flag controlling the conflict resolver's verbose mode. | `false` | no
 `aether.connector.basic.threads` or `maven.artifact.threads` | int | Number of threads to use for uploading/downloading. | `5` | no

[maven-resolver] 04/19: Fix parsing and comment

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit d1833df2735562e634d36394f89ca591a569f47c
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 22 11:21:17 2022 +0100

    Fix parsing and comment
---
 .../eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index e95a011..2e5dc22 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -117,7 +117,7 @@ public final class Maven2RepositoryLayoutFactory
             throw new NoRepositoryLayoutException( repository );
         }
         boolean forSignature = ConfigUtils.getBoolean( session, false, CONFIG_PROP_SIGNATURE_CHECKSUMS );
-        // ensure order of (potentially user set) algorithm list is kept and is unique
+        // ensure order and uniqueness of (potentially user set) algorithm list
         LinkedHashSet<String> checksumsAlgorithmNames = new LinkedHashSet<>( Arrays.asList(
                 ConfigUtils.getString(
                         session, DEFAULT_CHECKSUMS_ALGORITHMS, CONFIG_PROP_CHECKSUMS_ALGORITHMS
@@ -130,8 +130,8 @@ public final class Maven2RepositoryLayoutFactory
             checksumsAlgorithms.add( checksumAlgorithmFactorySelector.select( checksumsAlgorithmName ) );
         }
 
-        // no need for order here
-        List<String> signatureAlgorithmNames = Arrays.asList(
+        // ensure order and uniqueness of (potentially user set) algorithm list
+        LinkedHashSet<String> signatureAlgorithmNames = new LinkedHashSet<>( Arrays.asList(
                 ConfigUtils.getString(
                         session, DEFAULT_SIGNATURE_ALGORITHMS, CONFIG_PROP_SIGNATURE_ALGORITHMS
                 ).split( "," )

[maven-resolver] 08/19: Make members private, there is no more Ex instance to inherit

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 8241e83d8537f0525429dcfaf852df591f76d983
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Mar 11 10:27:47 2022 +0100

    Make members private, there is no more Ex instance to inherit
---
 .../eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index 869b718..7e9c4eb 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -141,11 +141,11 @@ public final class Maven2RepositoryLayoutFactory
             implements RepositoryLayout
     {
 
-        protected final List<ChecksumAlgorithmFactory> checksumAlgorithms;
+        private final List<ChecksumAlgorithmFactory> checksumAlgorithms;
 
-        protected final ArtifactChecksumFilter artifactChecksumFilter;
+        private final ArtifactChecksumFilter artifactChecksumFilter;
 
-        protected Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms,
+        private Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms,
                                           ArtifactChecksumFilter artifactChecksumFilter )
         {
             this.checksumAlgorithms = Collections.unmodifiableList( checksumAlgorithms );

[maven-resolver] 15/19: Improve javadoc

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 4404c9b664efd4cbcf2f735b6e05ad455efb0973
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Mar 13 00:54:17 2022 +0100

    Improve javadoc
---
 .../org/eclipse/aether/spi/connector/layout/RepositoryLayout.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
index 8eaa5f6..83b4352 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/layout/RepositoryLayout.java
@@ -127,8 +127,9 @@ public interface RepositoryLayout
 
     /**
      * Returns immutable list of {@link ChecksumAlgorithmFactory} this instance of layout uses, never {@code null}.
-     * The order represents the order how checksums are validated (hence retrieved).
+     * The order also represents the order how remote external checksums are retrieved and validated.
      *
+     * @see org.eclipse.aether.spi.connector.checksum.ChecksumPolicy.ChecksumKind
      * @since 1.8.0
      */
     List<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories();
@@ -149,6 +150,8 @@ public interface RepositoryLayout
      * Typical case to return {@code false} (to omit checksums) is for artifact signatures, that are already a
      * "sub-artifact" of some main artifact (for example a JAR), and they can be validated by some other means.
      *
+     * @see org.eclipse.aether.spi.connector.checksum.ChecksumPolicy.ChecksumKind
+     * @see #getChecksumAlgorithmFactories()
      * @since 1.8.0
      */
     boolean hasChecksums( Artifact artifact );

[maven-resolver] 05/19: missing closing bracket

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 83c7680b9f1159738d5be0417a46d53a5db0dbae
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 22 11:21:57 2022 +0100

    missing closing bracket
---
 .../org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index 2e5dc22..cf30963 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -134,7 +134,7 @@ public final class Maven2RepositoryLayoutFactory
         LinkedHashSet<String> signatureAlgorithmNames = new LinkedHashSet<>( Arrays.asList(
                 ConfigUtils.getString(
                         session, DEFAULT_SIGNATURE_ALGORITHMS, CONFIG_PROP_SIGNATURE_ALGORITHMS
-                ).split( "," )
+                ).split( "," ) )
         );
 
         List<SignatureAlgorithmFactory> signatureAlgorithms = new ArrayList<>( signatureAlgorithmNames.size() );

[maven-resolver] 17/19: Be clear about leading dots and validate input

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 22c14f00c7880b4d5d8c91ce00e08a2aaf02d9a9
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Mar 14 11:48:52 2022 +0100

    Be clear about leading dots and validate input
---
 .../aether/internal/impl/Maven2RepositoryLayoutFactory.java | 13 +++++++++++++
 src/site/markdown/configuration.md                          |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
index 860bc21..8398591 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/Maven2RepositoryLayoutFactory.java
@@ -116,6 +116,7 @@ public final class Maven2RepositoryLayoutFactory
                 .split( "," )
         ).filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toCollection( LinkedHashSet::new ) );
 
+        // validation: this loop implicitly validates the list above: selector will throw on unknown algorithm
         List<ChecksumAlgorithmFactory> checksumsAlgorithms = new ArrayList<>( checksumsAlgorithmNames.size() );
         for ( String checksumsAlgorithmName : checksumsAlgorithmNames )
         {
@@ -128,6 +129,18 @@ public final class Maven2RepositoryLayoutFactory
                 .split( "," )
         ).filter( s -> s != null && !s.trim().isEmpty() ).collect( Collectors.toSet() );
 
+        // validation: enforce that all strings in this set are having leading dot
+        if ( omitChecksumsForExtensions.stream().anyMatch( s -> !s.startsWith( "." ) ) )
+        {
+            throw new IllegalArgumentException(
+                    String.format(
+                            "The configuration %s contains illegal values: %s (all entries must start with '.' (dot)",
+                            CONFIG_PROP_OMIT_CHECKSUMS_FOR_EXTENSIONS,
+                            omitChecksumsForExtensions
+                    )
+            );
+        }
+
         return new Maven2RepositoryLayout(
                 checksumsAlgorithms,
                 omitChecksumsForExtensions
diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md
index adfa9a8..926b688 100644
--- a/src/site/markdown/configuration.md
+++ b/src/site/markdown/configuration.md
@@ -21,7 +21,7 @@ under the License.
 Option | Type | Description | Default Value | Supports Repo ID Suffix
 --- | --- | --- | --- | ---
 `aether.artifactResolver.snapshotNormalization` | boolean | It replaces the timestamped snapshot file name with a filename containing the `SNAPSHOT` qualifier only. This only affects resolving/retrieving artifacts but not uploading those. | `true` | no
-`aether.checksums.omitChecksumsForExtensions` | String | Comma separated list of extensions (`.asc`) that should have checksums omitted. Note: to achieve 1.7.x `aether.checksums.forSignature=true` behaviour, pass empty string as value for this property. | `.asc` | no
+`aether.checksums.omitChecksumsForExtensions` | String | Comma separated list of extensions with leading dot (example `.asc`) that should have checksums omitted. These are applied to sub-artifacts only. Note: to achieve 1.7.x `aether.checksums.forSignature=true` behaviour, pass empty string as value for this property. | `.asc` | no
 `aether.checksums.algorithms` | String | Comma separated list of checksum algorithms with which checksums are validated (downloaded) and generated (uploaded). Resolver by default supports following algorithms: `MD5`, `SHA-1`, `SHA-256` and `SHA-512`. New algorithms can be added by implementing `ChecksumAlgorithmFactory` component. | `"SHA-1,MD5"` | no
 `aether.conflictResolver.verbose` | boolean | Flag controlling the conflict resolver's verbose mode. | `false` | no
 `aether.connector.basic.threads` or `maven.artifact.threads` | int | Number of threads to use for uploading/downloading. | `5` | no

[maven-resolver] 03/19: Update doco

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit c1a287dbaa25c0f53d431e3d2305e8c4e17c1612
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Feb 22 10:48:08 2022 +0100

    Update doco
---
 src/site/markdown/configuration.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md
index 5480f5f..333ffe1 100644
--- a/src/site/markdown/configuration.md
+++ b/src/site/markdown/configuration.md
@@ -23,6 +23,7 @@ Option | Type | Description | Default Value | Supports Repo ID Suffix
 `aether.artifactResolver.snapshotNormalization` | boolean | It replaces the timestamped snapshot file name with a filename containing the `SNAPSHOT` qualifier only. This only affects resolving/retrieving artifacts but not uploading those. | `true` | no
 `aether.checksums.forSignature` | boolean | Flag indicating if signature artifacts (`.asc`) should have checksums. | `false` | no
 `aether.checksums.algorithms` | String | Comma separated list of checksum algorithms with which checksums are validated (downloaded) and generated (uploaded). Resolver by default supports following algorithms: `MD5`, `SHA-1`, `SHA-256` and `SHA-512`. New algorithms can be added by implementing `ChecksumAlgorithmFactory` component. | `"SHA-1,MD5"` | no
+`aether.signatures.algorithms` | String | Comma separated list of signature algorithms with which signatures are recognized. Resolver by default supports following algorithms: `GPG`. New algorithms can be added by implementing `SignatureAlgorithmFactory` component. | `"GPG"` | no
 `aether.conflictResolver.verbose` | boolean | Flag controlling the conflict resolver's verbose mode. | `false` | no
 `aether.connector.basic.threads` or `maven.artifact.threads` | int | Number of threads to use for uploading/downloading. | `5` | no
 `aether.connector.classpath.loader` | ClassLoader | `ClassLoader` from which resources should be retrieved which start with the `classpath:` protocol. | `Thread.currentThread().getContextClassLoader()` | no

[maven-resolver] 10/19: Javadoc

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 9720fdb9fed7e3e926f49e15f94d69d88a68b4be
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Mar 11 13:21:28 2022 +0100

    Javadoc
---
 .../spi/connector/checksum/ArtifactChecksumFilter.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
index 430bd16..bf19190 100644
--- a/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
+++ b/maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/checksum/ArtifactChecksumFilter.java
@@ -22,7 +22,7 @@ package org.eclipse.aether.spi.connector.checksum;
 import org.eclipse.aether.artifact.Artifact;
 
 /**
- * Filter that is able to tell does artifact should have expected checksums or not. Most notably, artifacts like
+ * Filter that is able to tell does artifact have expected checksums or not. Most notably, artifacts like
  * different kind of signatures will not have checksums.
  *
  * @since 1.8.0
@@ -30,9 +30,15 @@ import org.eclipse.aether.artifact.Artifact;
 public interface ArtifactChecksumFilter
 {
     /**
-     * Returns {@code true} if the given artifact does not have expected checksums. Hence, the artifact checksums will
-     * not be validated during transport. If {@code false} returned, the artifact will have its checksums fetched and
-     * validated.
+     * Tells whether given artifact have checksums according to current layout or not. If it returns {@code false},
+     * then layout configured checksums will be expected: on upload they will be calculated and deployed along
+     * artifact, on download they will be retrieved and validated.
+     *
+     * If it returns {@code true} the given artifacts will have checksums omitted: on upload they will not be
+     * calculated and deployed, and on download they will be not retrieved nor validated.
+     *
+     * Typical case to return {@code true} (to omit checksums) is for GPG signatures, that are already a "sub-artifact"
+     * of some main artifact (ie. a JAR), and they can be validated by some other means.
      */
     boolean omitChecksumsFor( Artifact artifact );
 }

[maven-resolver] 12/19: Rename variable, it is not location anymore

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MRESOLVER-241
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 3fce4f883fe4f49092eb65ae6396c66b3997670e
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Mar 13 00:41:48 2022 +0100

    Rename variable, it is not location anymore
---
 .../org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java b/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
index ed56549..6560537 100644
--- a/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
+++ b/maven-resolver-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
@@ -47,12 +47,12 @@ public class ChecksumCalculatorTest
 
     private ChecksumCalculator newCalculator( String... algos )
     {
-        List<ChecksumAlgorithmFactory> checksumLocations = new ArrayList<>();
+        List<ChecksumAlgorithmFactory> checksumAlgorithmFactories = new ArrayList<>();
         for ( String algo : algos )
         {
-            checksumLocations.add( selector.select( algo ) );
+            checksumAlgorithmFactories.add( selector.select( algo ) );
         }
-        return ChecksumCalculator.newInstance( file, checksumLocations );
+        return ChecksumCalculator.newInstance( file, checksumAlgorithmFactories );
     }
 
     private ByteBuffer toBuffer( String data )