001package org.eclipse.aether.spi.connector.checksum;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.Collection;
023import java.util.List;
024
025/**
026 * Component performing selection of {@link ChecksumAlgorithmFactory} based on known factory names.
027 * Note: this component is NOT meant to be implemented or extended by client, is exposed ONLY to make clients
028 * able to get {@link ChecksumAlgorithmFactory} instances.
029 *
030 * @noimplement This interface is not intended to be implemented by clients.
031 * @noextend This interface is not intended to be extended by clients.
032 * @since 1.8.0
033 */
034public interface ChecksumAlgorithmFactorySelector
035{
036    /**
037     * Returns factory for given algorithm name, or throws if algorithm not supported.
038     *
039     * @throws IllegalArgumentException if asked algorithm name is not supported.
040     */
041    ChecksumAlgorithmFactory select( String algorithmName );
042
043    /**
044     * Returns a list of factories for given algorithm names in order as collection is ordered, or throws if any of the
045     * algorithm name is not supported. The returned list has equal count of elements as passed in collection of names,
046     * and if names contains duplicated elements, the returned list of algorithms will have duplicates as well.
047     *
048     * @throws IllegalArgumentException if any asked algorithm name is not supported.
049     * @throws NullPointerException if passed in list of names is {@code null}.
050     * @since 1.9.0
051     */
052    List<ChecksumAlgorithmFactory> selectList( Collection<String> algorithmNames );
053
054    /**
055     * Returns a collection of supported algorithms. This set represents ALL the algorithms supported by Resolver,
056     * and is NOT in any relation to given repository layout used checksums, returned by method {@link
057     * org.eclipse.aether.spi.connector.layout.RepositoryLayout#getChecksumAlgorithmFactories()} (in fact, is super set
058     * of it).
059     */
060    Collection<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories();
061}