[
https://issues.apache.org/jira/browse/MNG-7957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17799128#comment-17799128
]
ASF GitHub Bot commented on MNG-7957:
-------------------------------------
gnodet commented on code in PR #1359:
URL: https://github.com/apache/maven/pull/1359#discussion_r1433034653
##########
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultChecksumAlgorithmService.java:
##########
@@ -0,0 +1,201 @@
+/*
+ * 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.
+ */
+package org.apache.maven.internal.impl;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import org.apache.maven.api.services.*;
+import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
+import
org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
+import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmHelper;
+
+import static org.apache.maven.internal.impl.Utils.nonNull;
+
+@Named
+@Singleton
+public class DefaultChecksumAlgorithmService implements
ChecksumAlgorithmService {
+ private final ChecksumAlgorithmFactorySelector
checksumAlgorithmFactorySelector;
+
+ @Inject
+ public DefaultChecksumAlgorithmService(ChecksumAlgorithmFactorySelector
checksumAlgorithmFactorySelector) {
+ this.checksumAlgorithmFactorySelector =
+ nonNull(checksumAlgorithmFactorySelector,
"checksumAlgorithmFactorySelector");
+ }
+
+ @Override
+ public ChecksumAlgorithm select(String algorithmName) {
+ nonNull(algorithmName, "algorithmName");
+ return new
DefaultChecksumAlgorithm(checksumAlgorithmFactorySelector.select(algorithmName));
Review Comment:
What if the algorithm is not found ?
> Expose checksum service on API
> ------------------------------
>
> Key: MNG-7957
> URL: https://issues.apache.org/jira/browse/MNG-7957
> Project: Maven
> Issue Type: Dependency upgrade
> Components: API
> Reporter: Tamas Cservenak
> Assignee: Tamas Cservenak
> Priority: Major
> Fix For: 4.0.0, 4.0.0-alpha-11
>
>
> Resolver since 1.8 has extensible checksum SPI:
> [https://maven.apache.org/resolver/about-checksums.html]
> I think it would be worth to expose that not directly, but via some sort of
> Service in new Maven 4 API?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)