001/** 002 * Copyright (C) 2006-2026 Talend Inc. - www.talend.com 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.talend.sdk.component.api.service.dependency; 017 018import java.util.function.Predicate; 019 020public interface ClassLoaderDefinition { 021 022 /** 023 * 024 * @return the parent classloader to use for the classloader to create. 025 */ 026 ClassLoader getParent(); 027 028 /** 029 * 030 * @return a filter to apply on the classes to load from the classloader to create. If the filter returns false for 031 * a class, the classloader to create will try to load it from its parent. 032 */ 033 Predicate<String> getClassesFilter(); 034 035 /** 036 * 037 * @return a filter to apply on the classes to load from the parent classloader. If the filter returns false for a 038 * class, the classloader to create will try to load it by itself instead of delegating to its parent. 039 */ 040 Predicate<String> getParentClassesFilter(); 041 042 /** 043 * 044 * @return a filter to apply on the resources to load from the parent classloader. The {@link String} argument of 045 * the predicate is the path of the resource as obtained from {@code URL#getFile()} (i.e. the full URL/file path), 046 * not the logical resource name used in {@link ClassLoader#getResource(String)}. If the filter returns 047 * {@code false} for a resource, the classloader to create will try to load it by itself instead of delegating to 048 * its parent. 049 */ 050 Predicate<String> getParentResourcesFilter(); 051 052 /** 053 * 054 * @return true if the classloader to create should support resource dependencies (i.e. the dependencies.txt can 055 * also list resources to load and not only classes). Note that if this is true, the classloader to create will try 056 * to load resources by itself instead of delegating to its parent. 057 * 058 */ 059 boolean isSupportsResourceDependencies(); 060 061 /** 062 * 063 * @return the resource path to the plugins mapping file ("TALEND-INF/plugins.properties"). 064 */ 065 String getNestedPluginMappingResource(); 066}