001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.eclipse.aether.spi.version;
020
021import java.util.Map;
022
023import org.eclipse.aether.RepositorySystemSession;
024import org.eclipse.aether.version.VersionScheme;
025
026/**
027 * Selects a version scheme from the installed version schemes.
028 *
029 * @noimplement This interface is not intended to be implemented by clients.
030 * @noextend This interface is not intended to be extended by clients.
031 * @since 2.0.0
032 */
033public interface VersionSchemeSelector {
034    /**
035     * Tries to select a version scheme from the specified scheme name.
036     *
037     * @param schemeName The schemeName to select scheme for, must not be {@code null}.
038     * @return The scheme selected, never {@code null}.
039     * @throws IllegalArgumentException if asked scheme name is not supported.
040     * @throws NullPointerException if passed in names is {@code null}.
041     */
042    VersionScheme selectVersionScheme(String schemeName);
043
044    /**
045     * Tries to select a version scheme from the specified scheme name.
046     *
047     * @param session The repository system session from which to configure the scheme, must not be {@code null}.
048     * @return The scheme selected, never {@code null}.
049     * @throws IllegalArgumentException If none of the installed schemes cannot be selected.
050     * @throws NullPointerException if passed in session is {@code null}.
051     */
052    VersionScheme selectVersionScheme(RepositorySystemSession session);
053
054    /**
055     * Returns immutable map of all supported version schemes (maps scheme name to scheme instance). This represents
056     * ALL the schemes supported by Resolver, either provided out of the box, or extension installed.
057     */
058    Map<String, VersionScheme> getVersionSchemes();
059}