001package org.eclipse.aether.resolution; 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 org.eclipse.aether.RepositorySystemSession; 023import org.eclipse.aether.artifact.Artifact; 024import org.eclipse.aether.metadata.Metadata; 025 026/** 027 * Controls the caching of resolution errors for artifacts/metadata from remote repositories. If caching is enabled for 028 * a given resource, a marker will be set (usually somewhere in the local repository) to suppress repeated resolution 029 * attempts for the broken resource, thereby avoiding expensive but useless network IO. The error marker is considered 030 * stale once the repository's update policy has expired at which point a future resolution attempt will be allowed. 031 * Error caching considers the current network settings such that fixes to the configuration like authentication or 032 * proxy automatically trigger revalidation with the remote side regardless of the time elapsed since the previous 033 * resolution error. 034 * 035 * @see RepositorySystemSession#getResolutionErrorPolicy() 036 */ 037public interface ResolutionErrorPolicy 038{ 039 040 /** 041 * Bit mask indicating that resolution errors should not be cached in the local repository. This forces the system 042 * to always query the remote repository for locally missing artifacts/metadata. 043 */ 044 int CACHE_DISABLED = 0x00; 045 046 /** 047 * Bit flag indicating whether missing artifacts/metadata should be cached in the local repository. If caching is 048 * enabled, resolution will not be reattempted until the update policy for the affected resource has expired. 049 */ 050 int CACHE_NOT_FOUND = 0x01; 051 052 /** 053 * Bit flag indicating whether connectivity/transfer errors (e.g. unreachable host, bad authentication) should be 054 * cached in the local repository. If caching is enabled, resolution will not be reattempted until the update policy 055 * for the affected resource has expired. 056 */ 057 int CACHE_TRANSFER_ERROR = 0x02; 058 059 /** 060 * Bit mask indicating that all resolution errors should be cached in the local repository. 061 */ 062 int CACHE_ALL = CACHE_NOT_FOUND | CACHE_TRANSFER_ERROR; 063 064 /** 065 * Gets the error policy for an artifact. 066 * 067 * @param session The repository session during which the policy is determined, must not be {@code null}. 068 * @param request The policy request holding further details, must not be {@code null}. 069 * @return The bit mask describing the desired error policy. 070 */ 071 int getArtifactPolicy( RepositorySystemSession session, ResolutionErrorPolicyRequest<Artifact> request ); 072 073 /** 074 * Gets the error policy for some metadata. 075 * 076 * @param session The repository session during which the policy is determined, must not be {@code null}. 077 * @param request The policy request holding further details, must not be {@code null}. 078 * @return The bit mask describing the desired error policy. 079 */ 080 int getMetadataPolicy( RepositorySystemSession session, ResolutionErrorPolicyRequest<Metadata> request ); 081 082}