001package org.apache.maven.plugin; 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.List; 023 024import org.apache.maven.model.Plugin; 025import org.apache.maven.project.MavenProject; 026import org.eclipse.aether.RepositorySystemSession; 027import org.eclipse.aether.artifact.Artifact; 028import org.eclipse.aether.graph.DependencyFilter; 029import org.eclipse.aether.repository.RemoteRepository; 030 031/** 032 * Caches plugin artifacts. <strong>Warning:</strong> This is an internal utility interface that is only public for 033 * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without 034 * prior notice. 035 * 036 * @author Igor Fedorenko 037 * @author Benjamin Bentmann 038 */ 039public interface PluginArtifactsCache 040{ 041 042 /** 043 * A cache key. 044 */ 045 interface Key 046 { 047 // marker interface for cache keys 048 } 049 050 public static class CacheRecord 051 { 052 053 public final List<Artifact> artifacts; 054 055 public final PluginResolutionException exception; 056 057 public CacheRecord( List<Artifact> artifacts ) 058 { 059 this.artifacts = artifacts; 060 this.exception = null; 061 } 062 063 public CacheRecord( PluginResolutionException exception ) 064 { 065 this.artifacts = null; 066 this.exception = exception; 067 } 068 } 069 070 Key createKey( Plugin plugin, DependencyFilter extensionFilter, List<RemoteRepository> repositories, 071 RepositorySystemSession session ); 072 073 CacheRecord get( Key key ) throws PluginResolutionException; 074 075 CacheRecord put( Key key, List<Artifact> pluginArtifacts ); 076 077 CacheRecord put( Key key, PluginResolutionException e ); 078 079 void flush(); 080 081 /** 082 * Registers the specified cache record for usage with the given project. Integrators can use the information 083 * collected from this method in combination with a custom cache implementation to dispose unused records from the 084 * cache. 085 * 086 * @param project The project that employs the plugin realm, must not be {@code null}. 087 * @param record The cache record being used for the project, must not be {@code null}. 088 */ 089 void register( MavenProject project, CacheRecord record ); 090 091}