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