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.artifact.repository;
20
21 import java.nio.file.Path;
22 import java.nio.file.Paths;
23 import java.util.List;
24
25 import org.apache.maven.artifact.Artifact;
26 import org.apache.maven.artifact.metadata.ArtifactMetadata;
27 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
28 import org.apache.maven.repository.Proxy;
29
30 /**
31 * Abstraction of an artifact repository. Artifact repositories can be remote, local, or even build reactor or
32 * IDE workspace.
33 *
34 * @deprecated Avoid use of this type, if you need access to local repository use repository system classes instead.
35 */
36 @Deprecated
37 public interface ArtifactRepository {
38 String pathOf(Artifact artifact);
39
40 String pathOfRemoteRepositoryMetadata(ArtifactMetadata artifactMetadata);
41
42 String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository);
43
44 String getUrl();
45
46 void setUrl(String url);
47
48 String getBasedir();
49
50 default Path getBasedirPath() {
51 return Paths.get(getBasedir());
52 }
53
54 String getProtocol();
55
56 String getId();
57
58 void setId(String id);
59
60 ArtifactRepositoryPolicy getSnapshots();
61
62 void setSnapshotUpdatePolicy(ArtifactRepositoryPolicy policy);
63
64 ArtifactRepositoryPolicy getReleases();
65
66 void setReleaseUpdatePolicy(ArtifactRepositoryPolicy policy);
67
68 ArtifactRepositoryLayout getLayout();
69
70 void setLayout(ArtifactRepositoryLayout layout);
71
72 String getKey();
73
74 @Deprecated
75 boolean isUniqueVersion();
76
77 @Deprecated
78 boolean isBlacklisted();
79
80 @Deprecated
81 void setBlacklisted(boolean blackListed);
82
83 /**
84 * @return whether the repository is blocked
85 * @since 3.8.1
86 **/
87 boolean isBlocked();
88
89 /**
90 * @param blocked block the repository?
91 * @since 3.8.1
92 **/
93 void setBlocked(boolean blocked);
94
95 //
96 // New interface methods for the repository system.
97 //
98 /**
99 *
100 * @param artifact an artifact
101 * @return found artifact
102 * @since 3.0-alpha-3
103 */
104 Artifact find(Artifact artifact);
105
106 /**
107 * Finds the versions of the specified artifact that are available in this repository.
108 *
109 * @param artifact The artifact whose available versions should be determined, must not be {@code null}.
110 * @return The available versions of the artifact or an empty list if none, never {@code null}.
111 * @since 3.0-alpha-3
112 */
113 List<String> findVersions(Artifact artifact);
114
115 /**
116 * Indicates whether this repository is backed by actual projects. For instance, the build reactor or IDE workspace
117 * are examples of such repositories.
118 *
119 * @return {@code true} if the repository is backed by actual projects, {@code false} otherwise.
120 * @since 3.0-beta-1
121 */
122 boolean isProjectAware();
123
124 /**
125 * @param authentication authentication
126 * @since 3.0-alpha-3
127 */
128 void setAuthentication(Authentication authentication);
129
130 /**
131 * @return repository authentication
132 * @since 3.0-alpha-3
133 */
134 Authentication getAuthentication();
135
136 /**
137 * @param proxy proxy
138 * @since 3.0-alpha-3
139 */
140 void setProxy(Proxy proxy);
141
142 /**
143 * @since 3.0-alpha-3
144 * @return repository proxy
145 */
146 Proxy getProxy();
147
148 /**
149 * @since 3.0.3
150 * @return the repositories mirrored by the actual one
151 */
152 List<ArtifactRepository> getMirroredRepositories();
153
154 /**
155 * @since 3.0.3
156 * @param mirroredRepositories the repositories that the actual one mirrors
157 */
158 void setMirroredRepositories(List<ArtifactRepository> mirroredRepositories);
159 }