michael-o commented on code in PR #199:
URL: https://github.com/apache/maven-resolver/pull/199#discussion_r985076402


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/FileTrustedChecksumsSourceSupport.java:
##########
@@ -0,0 +1,154 @@
+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 java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.repository.ArtifactRepository;
+import org.eclipse.aether.spi.checksums.TrustedChecksumsSource;
+import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
+import org.eclipse.aether.util.ConfigUtils;
+import org.eclipse.aether.util.DirectoryUtils;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Support class for implementing {@link TrustedChecksumsSource} backed by 
local filesystem. It implements basic support
+ * like basedir calculation, "enabled" flag and "originAware" flag.
+ * <p>
+ * The configuration keys supported:
+ * <ul>
+ *     <li><pre>aether.trustedChecksumsSource.${name}.enabled</pre> (boolean) 
must be explicitly set to "true"
+ *     to become enabled</li>
+ *     <li><pre>aether.trustedChecksumsSource.${name}.basedir</pre> (string, 
path) directory from where implementation
+ *     can use files. May be relative path (the is resolved from local 
repository basedir) or absolute. If unset,
+ *     default value is ".checksums" and is resolved from local repository 
basedir.</li>
+ *     <li><pre>aether.trustedChecksumsSource.${name}.originAware</pre> 
(boolean) whether to make implementation
+ *     "originAware", to factor in origin repository ID as well or not.</li>
+ * </ul>
+ * <p>
+ * This implementation ensures that implementations have "name" property, used 
in configuration properties above.
+ *
+ * @since TBD
+ */
+abstract class FileTrustedChecksumsSourceSupport
+        implements TrustedChecksumsSource
+{
+    private static final String CONFIG_PROP_PREFIX = 
"aether.trustedChecksumsSource.";
+
+    private static final String CONF_NAME_ENABLED = "enabled";
+
+    private static final String CONF_NAME_BASEDIR = "basedir";
+
+    private static final String CONF_NAME_ORIGIN_AWARE = "originAware";
+
+    /**
+     * Visible for testing.
+     */
+    static final String LOCAL_REPO_PREFIX = ".checksums";

Review Comment:
   This should rather be `LOCAL_REPO_PREFIX_DIR` since it stands as a dir name .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to