@Named @Singleton public class DefaultClassRealmManager extends java.lang.Object implements ClassRealmManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
API_REALMID |
private org.codehaus.plexus.classworlds.realm.ClassRealm |
containerRealm |
private java.util.List<ClassRealmManagerDelegate> |
delegates |
private org.codehaus.plexus.logging.Logger |
logger |
private org.codehaus.plexus.classworlds.realm.ClassRealm |
mavenApiRealm |
private static java.lang.ClassLoader |
PARENT_CLASSLOADER
During normal command line build, ClassWorld is loaded by jvm system classloader, which only includes
plexus-classworlds jar and possibly javaagent classes, see https://issues.apache.org/jira/browse/MNG-4747.
|
private java.util.Set<java.lang.String> |
providedArtifacts
Patterns of artifacts provided by maven core and exported via maven api realm.
|
private org.codehaus.plexus.classworlds.ClassWorld |
world |
Constructor and Description |
---|
DefaultClassRealmManager(org.codehaus.plexus.logging.Logger logger,
org.codehaus.plexus.PlexusContainer container,
java.util.List<ClassRealmManagerDelegate> delegates,
CoreExports exports) |
Modifier and Type | Method and Description |
---|---|
private void |
callDelegates(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm,
ClassRealmRequest.RealmType type,
java.lang.ClassLoader parent,
java.util.List<java.lang.String> parentImports,
java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports,
java.util.List<ClassRealmConstituent> constituents) |
org.codehaus.plexus.classworlds.realm.ClassRealm |
createExtensionRealm(Plugin plugin,
java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
Creates a new class realm for the specified build extension.
|
org.codehaus.plexus.classworlds.realm.ClassRealm |
createPluginRealm(Plugin plugin,
java.lang.ClassLoader parent,
java.util.List<java.lang.String> parentImports,
java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports,
java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
Creates a new class realm for the specified plugin.
|
org.codehaus.plexus.classworlds.realm.ClassRealm |
createProjectRealm(Model model,
java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
Creates a new class realm for the specified project and its build extensions.
|
private org.codehaus.plexus.classworlds.realm.ClassRealm |
createRealm(java.lang.String baseRealmId,
ClassRealmRequest.RealmType type,
java.lang.ClassLoader parent,
java.util.List<java.lang.String> parentImports,
java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports,
java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
Creates a new class realm with the specified parent and imports.
|
org.codehaus.plexus.classworlds.realm.ClassRealm |
getCoreRealm()
Gets the class realm hosting the Maven core.
|
private static java.lang.String |
getId(org.eclipse.aether.artifact.Artifact artifact) |
private java.lang.String |
getId(java.lang.ClassLoader classLoader) |
private static java.lang.String |
getId(ClassRealmConstituent constituent) |
private static java.lang.String |
getId(java.lang.String gid,
java.lang.String aid,
java.lang.String type,
java.lang.String cls,
java.lang.String ver) |
private static java.lang.String |
getKey(Model model) |
private static java.lang.String |
getKey(Plugin plugin,
boolean extension) |
org.codehaus.plexus.classworlds.realm.ClassRealm |
getMavenApiRealm()
Gets the class realm exposing the Maven API.
|
private boolean |
isProvidedArtifact(org.eclipse.aether.artifact.Artifact artifact) |
private org.codehaus.plexus.classworlds.realm.ClassRealm |
newRealm(java.lang.String id) |
private java.util.Set<java.lang.String> |
populateRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm,
java.util.List<ClassRealmConstituent> constituents) |
private void |
wireRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm,
java.util.List<java.lang.String> parentImports,
java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports) |
public static final java.lang.String API_REALMID
private static final java.lang.ClassLoader PARENT_CLASSLOADER
Using ClassWorld to determine plugin/extensions realm parent classloaders gives m2e and integration test harness flexibility to load multiple version of maven into dedicated classloaders without assuming state of jvm system classloader.
private final org.codehaus.plexus.logging.Logger logger
private final org.codehaus.plexus.classworlds.ClassWorld world
private final org.codehaus.plexus.classworlds.realm.ClassRealm containerRealm
private final java.util.List<ClassRealmManagerDelegate> delegates
private final org.codehaus.plexus.classworlds.realm.ClassRealm mavenApiRealm
private final java.util.Set<java.lang.String> providedArtifacts
@Inject public DefaultClassRealmManager(org.codehaus.plexus.logging.Logger logger, org.codehaus.plexus.PlexusContainer container, java.util.List<ClassRealmManagerDelegate> delegates, CoreExports exports)
private org.codehaus.plexus.classworlds.realm.ClassRealm newRealm(java.lang.String id)
public org.codehaus.plexus.classworlds.realm.ClassRealm getMavenApiRealm()
ClassRealmManager
getMavenApiRealm
in interface ClassRealmManager
null
.private org.codehaus.plexus.classworlds.realm.ClassRealm createRealm(java.lang.String baseRealmId, ClassRealmRequest.RealmType type, java.lang.ClassLoader parent, java.util.List<java.lang.String> parentImports, java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports, java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
baseRealmId
- The base id to use for the new realm, must not be null
.type
- The type of the class realm, must not be null
.parent
- The parent realm for the new realm, may be null
.parentImports
- The packages/types to import from the parent realm, may be null
.foreignImports
- The packages/types to import from foreign realms, may be null
.artifacts
- The artifacts to add to the realm, may be null
. Unresolved artifacts (i.e. with a
missing file) will automatically be excluded from the realm.null
.public org.codehaus.plexus.classworlds.realm.ClassRealm getCoreRealm()
ClassRealmManager
getCoreRealm
in interface ClassRealmManager
null
.public org.codehaus.plexus.classworlds.realm.ClassRealm createProjectRealm(Model model, java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
ClassRealmManager
createProjectRealm
in interface ClassRealmManager
model
- The model of the project for which to create a realm, must not be null
.artifacts
- The artifacts to add to the class realm, may be null
. Unresolved artifacts (i.e. with a
missing file) will automatically be excluded from the realm.null
.private static java.lang.String getKey(Model model)
public org.codehaus.plexus.classworlds.realm.ClassRealm createExtensionRealm(Plugin plugin, java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
ClassRealmManager
createExtensionRealm
in interface ClassRealmManager
plugin
- The extension plugin for which to create a realm, must not be null
.artifacts
- The artifacts to add to the class realm, may be null
. Unresolved artifacts (i.e. with a
missing file) will automatically be excluded from the realm.null
.private boolean isProvidedArtifact(org.eclipse.aether.artifact.Artifact artifact)
public org.codehaus.plexus.classworlds.realm.ClassRealm createPluginRealm(Plugin plugin, java.lang.ClassLoader parent, java.util.List<java.lang.String> parentImports, java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports, java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
ClassRealmManager
createPluginRealm
in interface ClassRealmManager
plugin
- The plugin for which to create a realm, must not be null
.parent
- The parent realm for the new realm, may be null
.parentImports
- The packages/types to import from the parent realm, may be null
.foreignImports
- The packages/types to import from foreign realms, may be null
.artifacts
- The artifacts to add to the class realm, may be null
. Unresolved artifacts (i.e. with a
missing file) will automatically be excluded from the realm.null
.private static java.lang.String getKey(Plugin plugin, boolean extension)
private static java.lang.String getId(org.eclipse.aether.artifact.Artifact artifact)
private static java.lang.String getId(ClassRealmConstituent constituent)
private static java.lang.String getId(java.lang.String gid, java.lang.String aid, java.lang.String type, java.lang.String cls, java.lang.String ver)
private void callDelegates(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm, ClassRealmRequest.RealmType type, java.lang.ClassLoader parent, java.util.List<java.lang.String> parentImports, java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports, java.util.List<ClassRealmConstituent> constituents)
private java.util.Set<java.lang.String> populateRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm, java.util.List<ClassRealmConstituent> constituents)
private void wireRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm, java.util.List<java.lang.String> parentImports, java.util.Map<java.lang.String,java.lang.ClassLoader> foreignImports)
private java.lang.String getId(java.lang.ClassLoader classLoader)