1 package org.apache.maven.artifact.repository;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.util.List;
23
24 import org.apache.maven.artifact.Artifact;
25 import org.apache.maven.artifact.metadata.ArtifactMetadata;
26 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
27 import org.apache.maven.repository.Proxy;
28
29 /**
30 * Abstraction of an artifact repository. Artifact repositories can be remote, local, or even build reactor or
31 * IDE workspace.
32 */
33 public interface ArtifactRepository
34 {
35 String pathOf( Artifact artifact );
36
37 String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata );
38
39 String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository );
40
41 String getUrl();
42
43 void setUrl( String url );
44
45 String getBasedir();
46
47 String getProtocol();
48
49 String getId();
50
51 void setId( String id );
52
53 ArtifactRepositoryPolicy getSnapshots();
54
55 void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy );
56
57 ArtifactRepositoryPolicy getReleases();
58
59 void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy );
60
61 ArtifactRepositoryLayout getLayout();
62
63 void setLayout( ArtifactRepositoryLayout layout );
64
65 String getKey();
66
67 @Deprecated
68 boolean isUniqueVersion();
69
70 @Deprecated
71 boolean isBlacklisted();
72
73 @Deprecated
74 void setBlacklisted( boolean blackListed );
75
76 /**
77 * @return whether the repository is blocked
78 * @since 3.8.1
79 **/
80 boolean isBlocked();
81
82 /**
83 * @param blocked block the repository?
84 * @since 3.8.1
85 **/
86 void setBlocked( boolean blocked );
87
88 //
89 // New interface methods for the repository system.
90 //
91 /**
92 *
93 * @param artifact an artifact
94 * @return found artifact
95 * @since 3.0-alpha-3
96 */
97 Artifact find( Artifact artifact );
98
99 /**
100 * Finds the versions of the specified artifact that are available in this repository.
101 *
102 * @param artifact The artifact whose available versions should be determined, must not be {@code null}.
103 * @return The available versions of the artifact or an empty list if none, never {@code null}.
104 * @since 3.0-alpha-3
105 */
106 List<String> findVersions( Artifact artifact );
107
108 /**
109 * Indicates whether this repository is backed by actual projects. For instance, the build reactor or IDE workspace
110 * are examples of such repositories.
111 *
112 * @return {@code true} if the repository is backed by actual projects, {@code false} otherwise.
113 * @since 3.0-beta-1
114 */
115 boolean isProjectAware();
116
117 /**
118 * @param authentication authentication
119 * @since 3.0-alpha-3
120 */
121 void setAuthentication( Authentication authentication );
122
123 /**
124 * @return repository authentication
125 * @since 3.0-alpha-3
126 */
127 Authentication getAuthentication();
128
129 /**
130 * @param proxy proxy
131 * @since 3.0-alpha-3
132 */
133 void setProxy( Proxy proxy );
134
135 /**
136 * @since 3.0-alpha-3
137 * @return repository proxy
138 */
139 Proxy getProxy();
140
141 /**
142 * @since 3.0.3
143 * @return the repositories mirrored by the actual one
144 */
145 List<ArtifactRepository> getMirroredRepositories();
146
147 /**
148 * @since 3.0.3
149 * @param mirroredRepositories the repositories that the actual one mirrors
150 */
151 void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories );
152
153 }