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.remoterepo; 020 021import org.eclipse.aether.RepositorySystemSession; 022import org.eclipse.aether.repository.RepositoryKeyFunction; 023 024/** 025 * A factory to create {@link RepositoryKeyFunction} instances. 026 * 027 * @since 2.0.14 028 */ 029public interface RepositoryKeyFunctionFactory { 030 /** 031 * Returns system-wide repository key function. 032 * 033 * @param session The repository session, must not be {@code null}. 034 * @return The repository key function. 035 * @see #repositoryKeyFunction(Class, RepositorySystemSession, String, String) 036 * @see org.eclipse.aether.ConfigurationProperties#REPOSITORY_SYSTEM_REPOSITORY_KEY_FUNCTION 037 */ 038 RepositoryKeyFunction systemRepositoryKeyFunction(RepositorySystemSession session); 039 040 /** 041 * Method that based on configuration returns the "repository key function". The returned function will be session 042 * cached if session is equipped with cache, otherwise it will be non cached. Method never returns {@code null}. 043 * Only the {@code configurationKey} parameter may be {@code null} in which case no configuration lookup happens 044 * but the {@code defaultValue} is directly used instead. 045 * 046 * @param owner The "owner" of key function (used to create cache-key), must not be {@code null}. 047 * @param session The repository session, must not be {@code null}. 048 * @param defaultValue The default value of repository key configuration, must not be {@code null}. 049 * @param configurationKey The configuration key to lookup configuration from, may be {@code null}, in which case 050 * no configuration lookup happens but the {@code defaultValue} is used to create the 051 * repository key function. 052 * @return The repository key function. 053 */ 054 RepositoryKeyFunction repositoryKeyFunction( 055 Class<?> owner, RepositorySystemSession session, String defaultValue, String configurationKey); 056}