001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.repository; 020 021import java.io.File; 022import java.nio.file.Path; 023import java.util.List; 024 025import org.eclipse.aether.artifact.Artifact; 026 027/** 028 * Manages a repository backed by the IDE workspace, a build session or a similar ad-hoc collection of artifacts. 029 * 030 * @see org.eclipse.aether.RepositorySystemSession#getWorkspaceReader() 031 */ 032public interface WorkspaceReader { 033 034 /** 035 * Gets a description of the workspace repository. 036 * 037 * @return The repository description, never {@code null}. 038 */ 039 WorkspaceRepository getRepository(); 040 041 /** 042 * Locates the specified artifact. 043 * 044 * @param artifact The artifact to locate, must not be {@code null}. 045 * @return The path to the artifact or {@code null} if the artifact is not available. 046 */ 047 File findArtifact(Artifact artifact); 048 049 /** 050 * Locates the specified artifact. 051 * 052 * @param artifact The artifact to locate, must not be {@code null}. 053 * @return The path to the artifact or {@code null} if the artifact is not available. 054 * @since 2.0.0 055 */ 056 default Path findArtifactPath(Artifact artifact) { 057 File file = findArtifact(artifact); 058 return file != null ? file.toPath() : null; 059 } 060 061 /** 062 * Determines all available versions of the specified artifact. 063 * 064 * @param artifact The artifact whose versions should be listed, must not be {@code null}. 065 * @return The available versions of the artifact, must not be {@code null}. 066 */ 067 List<String> findVersions(Artifact artifact); 068}