001package org.apache.maven.classrealm; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.List; 023import java.util.Map; 024 025/** 026 * Describes the requirements for a new class realm. 027 * 028 * @author Benjamin Bentmann 029 */ 030public interface ClassRealmRequest 031{ 032 033 /** 034 * The type of a class realm. 035 */ 036 enum RealmType 037 { 038 /** 039 * The class realm for the public API of the Maven core. 040 */ 041 Core, 042 043 /** 044 * A class realm for a project to aggregates its build extensions. 045 */ 046 Project, 047 048 /** 049 * A class realm for a build extension. 050 */ 051 Extension, 052 053 /** 054 * A class realm for a plugin. 055 */ 056 Plugin, 057 } 058 059 /** 060 * Gets the type of the class realm. 061 * 062 * @return The type of the class realm, never {@code null}. 063 */ 064 RealmType getType(); 065 066 /** 067 * Gets the parent class realm (if any). 068 * 069 * @return The parent class realm or {@code null} if using the default parent. 070 */ 071 ClassLoader getParent(); 072 073 /** 074 * @deprecated Use {@link #getParentImports()} instead. 075 */ 076 @Deprecated 077 List<String> getImports(); 078 079 /** 080 * Gets the packages/types to import from the parent realm. 081 * 082 * @return The modifiable list of packages/types to import from the parent realm, never {@code null}. 083 */ 084 List<String> getParentImports(); 085 086 /** 087 * Gets the packages/types to import from foreign realms. 088 * 089 * @return The modifiable map of packages/types to import from foreign realms, never {@code null}. 090 */ 091 Map<String, ClassLoader> getForeignImports(); 092 093 /** 094 * Gets the constituents for the class realm. 095 * 096 * @return The modifiable list of constituents for the class realm, never {@code null}. 097 */ 098 List<ClassRealmConstituent> getConstituents(); 099 100}