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:38 UTC
[maven-resolver] 07/19: Refactor, drop signatures
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