1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin;
20
21 import java.util.List;
22 import java.util.Map;
23
24 import org.apache.maven.artifact.Artifact;
25 import org.apache.maven.model.Plugin;
26 import org.apache.maven.project.MavenProject;
27 import org.codehaus.plexus.classworlds.realm.ClassRealm;
28 import org.eclipse.aether.RepositorySystemSession;
29 import org.eclipse.aether.graph.DependencyFilter;
30 import org.eclipse.aether.repository.RemoteRepository;
31
32
33
34
35
36
37
38
39
40 public interface PluginRealmCache {
41
42
43
44 class CacheRecord {
45 public ClassRealm getRealm() {
46 return realm;
47 }
48
49 public List<Artifact> getArtifacts() {
50 return artifacts;
51 }
52
53 private final ClassRealm realm;
54
55 private final List<Artifact> artifacts;
56
57 public CacheRecord(ClassRealm realm, List<Artifact> artifacts) {
58 this.realm = realm;
59 this.artifacts = artifacts;
60 }
61 }
62
63
64
65
66 interface Key {
67
68 }
69
70 @FunctionalInterface
71 interface PluginRealmSupplier {
72 CacheRecord load() throws PluginResolutionException, PluginContainerException;
73 }
74
75 Key createKey(
76 Plugin plugin,
77 ClassLoader parentRealm,
78 Map<String, ClassLoader> foreignImports,
79 DependencyFilter dependencyFilter,
80 List<RemoteRepository> repositories,
81 RepositorySystemSession session);
82
83 CacheRecord get(Key key);
84
85 CacheRecord get(Key key, PluginRealmSupplier supplier) throws PluginResolutionException, PluginContainerException;
86
87 CacheRecord put(Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts);
88
89 void flush();
90
91
92
93
94
95
96
97
98
99 void register(MavenProject project, Key key, CacheRecord record);
100 }