001/* 002 * JDrupes Builder 003 * Copyright (C) 2026 Michael N. Lipp 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <https://www.gnu.org/licenses/>. 017 */ 018 019package org.jdrupes.builder.api; 020 021import java.nio.file.Path; 022import java.util.stream.Stream; 023 024/// Implemented by [ResourceProvider]s that require resources to be 025/// available without needing them for a specific purpose. The need 026/// for this usually arises when a [ResourceProvider] is scriptable 027/// and the required resources depend on the script. 028/// 029/// Such resource providers should use the methods from this interface 030/// to register the required resources, thus ensuring a consistent 031/// API. 032/// 033public interface RequiredResourceSupport extends ResourceProvider { 034 035 /// Adds the given [Stream] of resources to the required resources. 036 /// 037 /// @param resources the resources 038 /// @return the provider 039 /// 040 RequiredResourceSupport required(Stream<? extends Resource> resources); 041 042 /// Convenience method that adds a [FileTree] to the required resources. 043 /// If `root` is relative, it is resolved against the project's 044 /// directory. 045 /// 046 /// @param root the root 047 /// @param pattern the pattern 048 /// @return the provider 049 /// 050 RequiredResourceSupport required(Path root, String pattern); 051 052 /// Convenience method that adds a [FileResource] to the required 053 /// resources. If `path` is relative, it is resolved against the 054 /// project's directory. 055 /// 056 /// @param file the file 057 /// @return the provider 058 /// 059 RequiredResourceSupport required(Path file); 060}