View Javadoc
1   package org.eclipse.aether.spi.connector.checksum;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.Collection;
23  import java.util.List;
24  
25  /**
26   * Component performing selection of {@link ChecksumAlgorithmFactory} based on known factory names.
27   * Note: this component is NOT meant to be implemented or extended by client, is exposed ONLY to make clients
28   * able to get {@link ChecksumAlgorithmFactory} instances.
29   *
30   * @noimplement This interface is not intended to be implemented by clients.
31   * @noextend This interface is not intended to be extended by clients.
32   * @since 1.8.0
33   */
34  public interface ChecksumAlgorithmFactorySelector
35  {
36      /**
37       * Returns factory for given algorithm name, or throws if algorithm not supported.
38       *
39       * @throws IllegalArgumentException if asked algorithm name is not supported.
40       */
41      ChecksumAlgorithmFactory select( String algorithmName );
42  
43      /**
44       * Returns a list of factories for given algorithm names in order as collection is ordered, or throws if any of the
45       * algorithm name is not supported. The returned list has equal count of elements as passed in collection of names,
46       * and if names contains duplicated elements, the returned list of algorithms will have duplicates as well.
47       *
48       * @throws IllegalArgumentException if any asked algorithm name is not supported.
49       * @throws NullPointerException if passed in list of names is {@code null}.
50       * @since 1.9.0
51       */
52      List<ChecksumAlgorithmFactory> selectList( Collection<String> algorithmNames );
53  
54      /**
55       * Returns a collection of supported algorithms. This set represents ALL the algorithms supported by Resolver,
56       * and is NOT in any relation to given repository layout used checksums, returned by method {@link
57       * org.eclipse.aether.spi.connector.layout.RepositoryLayout#getChecksumAlgorithmFactories()} (in fact, is super set
58       * of it).
59       */
60      Collection<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories();
61  }