1package org.apache.maven.classrealm;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122import java.util.List;
23import java.util.Map;
2425import org.apache.maven.model.Model;
26import org.apache.maven.model.Plugin;
27import org.codehaus.plexus.classworlds.realm.ClassRealm;
28import org.sonatype.aether.artifact.Artifact;
2930/**31 * Manages the class realms used by Maven. <strong>Warning:</strong> This is an internal utility interface that is only32 * public for technical reasons, it is not part of the public API. In particular, this interface can be changed or33 * deleted without prior notice.34 * 35 * @author Benjamin Bentmann36 */37publicinterfaceClassRealmManager38 {
3940/**41 * Gets the class realm hosting the Maven core.42 * 43 * @return The class realm hosting the Maven core, never {@code null}.44 */45 ClassRealm getCoreRealm();
4647/**48 * Gets the class realm exposing the Maven API. This is basically a restricted view on the Maven core realm.49 * 50 * @return The class realm exposing the Maven API, never {@code null}.51 */52 ClassRealm getMavenApiRealm();
5354/**55 * Creates a new class realm for the specified project and its build extensions.56 * 57 * @param model The model of the project for which to create a realm, must not be {@code null}.58 * @param artifacts The artifacts to add to the class realm, may be {@code null}. Unresolved artifacts (i.e. with a59 * missing file) will automatically be excluded from the realm.60 * @return The new project realm, never {@code null}.61 */62 ClassRealm createProjectRealm( Model model, List<Artifact> artifacts );
6364/**65 * Creates a new class realm for the specified build extension.66 * 67 * @param plugin The extension plugin for which to create a realm, must not be {@code null}.68 * @param artifacts The artifacts to add to the class realm, may be {@code null}. Unresolved artifacts (i.e. with a69 * missing file) will automatically be excluded from the realm.70 * @return The new extension realm, never {@code null}.71 */72 ClassRealm createExtensionRealm( Plugin extension, List<Artifact> artifacts );
7374/**75 * Creates a new class realm for the specified plugin.76 * 77 * @param plugin The plugin for which to create a realm, must not be {@code null}.78 * @param parent The parent realm for the new realm, may be {@code null}.79 * @param parentImports The packages/types to import from the parent realm, may be {@code null}.80 * @param foreignImports The packages/types to import from foreign realms, may be {@code null}.81 * @param artifacts The artifacts to add to the class realm, may be {@code null}. Unresolved artifacts (i.e. with a82 * missing file) will automatically be excluded from the realm.83 * @return The new plugin realm, never {@code null}.84 */85 ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> parentImports,
86 Map<String, ClassLoader> foreignImports, List<Artifact> artifacts );
8788 }