Class DefaultClassRealmManager

  • All Implemented Interfaces:
    ClassRealmManager

    @Named
    @Singleton
    public class DefaultClassRealmManager
    extends java.lang.Object
    implements ClassRealmManager
    Manages the class realms used by Maven. Warning: This is an internal utility class that is only public for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without prior notice.
    Author:
    Benjamin Bentmann
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String API_REALMID  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.codehaus.plexus.classworlds.realm.ClassRealm createExtensionRealm​(org.apache.maven.model.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​(org.apache.maven.model.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​(org.apache.maven.model.Model model, java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
      Creates a new class realm for the specified project and its build extensions.
      org.codehaus.plexus.classworlds.realm.ClassRealm getCoreRealm()
      Gets the class realm hosting the Maven core.
      org.codehaus.plexus.classworlds.realm.ClassRealm getMavenApiRealm()
      Gets the class realm exposing the Maven API.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultClassRealmManager

        @Inject
        public DefaultClassRealmManager​(org.codehaus.plexus.logging.Logger logger,
                                        org.codehaus.plexus.PlexusContainer container,
                                        java.util.List<ClassRealmManagerDelegate> delegates,
                                        CoreExports exports)
    • Method Detail

      • getMavenApiRealm

        public org.codehaus.plexus.classworlds.realm.ClassRealm getMavenApiRealm()
        Description copied from interface: ClassRealmManager
        Gets the class realm exposing the Maven API. This is basically a restricted view on the Maven core realm.
        Specified by:
        getMavenApiRealm in interface ClassRealmManager
        Returns:
        The class realm exposing the Maven API, never null.
      • getCoreRealm

        public org.codehaus.plexus.classworlds.realm.ClassRealm getCoreRealm()
        Description copied from interface: ClassRealmManager
        Gets the class realm hosting the Maven core.
        Specified by:
        getCoreRealm in interface ClassRealmManager
        Returns:
        The class realm hosting the Maven core, never null.
      • createProjectRealm

        public org.codehaus.plexus.classworlds.realm.ClassRealm createProjectRealm​(org.apache.maven.model.Model model,
                                                                                   java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
        Description copied from interface: ClassRealmManager
        Creates a new class realm for the specified project and its build extensions.
        Specified by:
        createProjectRealm in interface ClassRealmManager
        Parameters:
        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.
        Returns:
        The new project realm, never null.
      • createExtensionRealm

        public org.codehaus.plexus.classworlds.realm.ClassRealm createExtensionRealm​(org.apache.maven.model.Plugin plugin,
                                                                                     java.util.List<org.eclipse.aether.artifact.Artifact> artifacts)
        Description copied from interface: ClassRealmManager
        Creates a new class realm for the specified build extension.
        Specified by:
        createExtensionRealm in interface ClassRealmManager
        Parameters:
        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.
        Returns:
        The new extension realm, never null.
      • createPluginRealm

        public org.codehaus.plexus.classworlds.realm.ClassRealm createPluginRealm​(org.apache.maven.model.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)
        Description copied from interface: ClassRealmManager
        Creates a new class realm for the specified plugin.
        Specified by:
        createPluginRealm in interface ClassRealmManager
        Parameters:
        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.
        Returns:
        The new plugin realm, never null.