cstamas commented on code in PR #199: URL: https://github.com/apache/maven-resolver/pull/199#discussion_r984929491
########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/CompactFileTrustedChecksumsSource.java: ########## @@ -0,0 +1,172 @@ +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.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.repository.ArtifactRepository; +import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory; +import org.eclipse.aether.util.artifact.ArtifactIdUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Compact file {@link FileTrustedChecksumsSourceSupport} implementation that use specified directory as base + * directory, where it expects a "summary" file named as "checksums.${checksumExt}" for each checksum algorithm, and + * file format is artifact ID and checksum separated by space per line. The format supports comments "#" (hash) and + * empty lines (both are ignored). + * <p> + * The source may be configured to be "origin aware", in that case it will factor in origin repository ID as well into + * file name (for example "central-checksums.sha1"). + * <p> + * The checksums file once loaded are cached in session, so in-flight file changes during lifecycle of session are NOT + * noticed. + * <p> + * The name of this implementation is "file-compact". + * + * @see ArtifactIdUtils#toId(Artifact) + * @since TBD + */ +@Singleton +@Named( CompactFileTrustedChecksumsSource.NAME ) +public final class CompactFileTrustedChecksumsSource + extends FileTrustedChecksumsSourceSupport +{ + public static final String NAME = "file-compact"; + + private static final String CHECKSUM_FILE_PREFIX = "checksums."; + + private static final String CHECKSUMS_CACHE_KEY = NAME + "-checksums"; + + private static final Logger LOGGER = LoggerFactory.getLogger( CompactFileTrustedChecksumsSource.class ); + + @Inject Review Comment: isn;t, is explicit but removed it (as guice will figure) -- 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