1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.api.services;
20
21 import java.nio.file.Path;
22
23 import org.apache.maven.api.Artifact;
24 import org.apache.maven.api.LocalRepository;
25 import org.apache.maven.api.RemoteRepository;
26 import org.apache.maven.api.Service;
27 import org.apache.maven.api.Session;
28 import org.apache.maven.api.annotations.Experimental;
29 import org.apache.maven.api.annotations.Nonnull;
30
31 /**
32 *
33 * @since 4.0.0
34 */
35 @Experimental
36 public interface LocalRepositoryManager extends Service {
37
38 /**
39 * Gets the relative path for a locally installed artifact.
40 * Note that the artifact need not actually exist yet at
41 * the returned location, the path merely indicates where
42 * the artifact would eventually be stored.
43 *
44 * @param session The session to use, must not be {@code null}.
45 * @param artifact The artifact for which to determine the path, must not be {@code null}.
46 * @return The path, resolved against the local repository's base directory.
47 */
48 @Nonnull
49 Path getPathForLocalArtifact(@Nonnull Session session, @Nonnull LocalRepository local, @Nonnull Artifact artifact);
50
51 /**
52 * Gets the relative path for an artifact cached from a remote repository.
53 * Note that the artifact need not actually exist yet at the returned location,
54 * the path merely indicates where the artifact would eventually be stored.
55 *
56 * @param session The session to use, must not be {@code null}.
57 * @param local The local repository, must not be {@code null}.
58 * @param artifact The artifact for which to determine the path, must not be {@code null}.
59 * @param remote – The source repository of the artifact, must not be {@code null}.
60 * @return The path, relative to the local repository's base directory.
61 */
62 @Nonnull
63 Path getPathForRemoteArtifact(
64 @Nonnull Session session,
65 @Nonnull LocalRepository local,
66 @Nonnull RemoteRepository remote,
67 @Nonnull Artifact artifact);
68 }