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