1 package org.apache.maven.extension.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.HashSet;
25 import java.util.LinkedHashMap;
26 import java.util.Map;
27 import java.util.Set;
28
29 import org.codehaus.plexus.classworlds.realm.ClassRealm;
30
31
32
33
34
35
36
37 public class CoreExports
38 {
39 private final Set<String> artifacts;
40
41 private final Map<String, ClassLoader> packages;
42
43 public CoreExports( CoreExtensionEntry entry )
44 {
45 this( entry.getClassRealm(), entry.getExportedArtifacts(), entry.getExportedPackages() );
46 }
47
48 public CoreExports( ClassRealm realm, Set<String> exportedArtifacts, Set<String> exportedPackages )
49 {
50 Map<String, ClassLoader> packages = new LinkedHashMap<>();
51 for ( String pkg : exportedPackages )
52 {
53 packages.put( pkg, realm );
54 }
55 this.artifacts = Collections.unmodifiableSet( new HashSet<>( exportedArtifacts ) );
56 this.packages = Collections.unmodifiableMap( new HashMap<>( packages ) );
57 }
58
59
60
61
62
63 public Set<String> getExportedArtifacts()
64 {
65 return artifacts;
66 }
67
68
69
70
71 public Map<String, ClassLoader> getExportedPackages()
72 {
73 return packages;
74 }
75 }