001/*
002 * JDrupes Builder
003 * Copyright (C) 2025 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.mvnrepo;
020
021import java.nio.file.Path;
022import java.util.List;
023import org.eclipse.aether.repository.RemoteRepository;
024import org.jdrupes.builder.api.ResourceFactory;
025import org.jdrupes.builder.java.JarFile;
026import static org.jdrupes.builder.mvnrepo.MvnRepoTypes.MvnRepoJarFileType;
027
028/// A [JarFile] that has been downloaded from a Maven repository.
029/// Unlike a [MvnRepoResource], a resource of this type represents a
030/// local file. This interface merely preserves information about the
031/// Maven repository resource from which it originated.
032/// 
033public interface MvnRepoJarFile extends JarFile {
034
035    /// Returns the Maven repository reference for this JAR file.
036    ///
037    /// @return the Maven repository resource
038    ///
039    MvnRepoResource reference();
040
041    /// Returns the repositories used to resolve this JAR file.
042    ///
043    /// @return the repositories
044    ///
045    List<RemoteRepository> repositories();
046
047    /// Creates a new Maven repository JAR file resource from the given values.
048    ///
049    /// @param repositories the repositories
050    /// @param coordinates the coordinates
051    /// @param path the path
052    /// @return the maven repository jar file
053    ///
054    @SuppressWarnings("PMD.ShortMethodName")
055    static MvnRepoJarFile of(List<RemoteRepository> repositories,
056            String coordinates, Path path) {
057        return ResourceFactory.create(
058            MvnRepoJarFileType, repositories, coordinates, path);
059    }
060}