001package org.apache.maven.artifact.repository;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.List;
023
024import org.apache.maven.artifact.Artifact;
025import org.apache.maven.artifact.metadata.ArtifactMetadata;
026import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
027import org.apache.maven.repository.Proxy;
028
029/**
030 * Abstraction of an artifact repository. Artifact repositories can be remote, local, or even build reactor or
031 * IDE workspace.
032 */
033public interface ArtifactRepository
034{
035    String pathOf( Artifact artifact );
036
037    String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata );
038
039    String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository );
040
041    String getUrl();
042
043    void setUrl( String url );
044
045    String getBasedir();
046
047    String getProtocol();
048
049    String getId();
050
051    void setId( String id );
052
053    ArtifactRepositoryPolicy getSnapshots();
054
055    void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy );
056
057    ArtifactRepositoryPolicy getReleases();
058
059    void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy );
060
061    ArtifactRepositoryLayout getLayout();
062
063    void setLayout( ArtifactRepositoryLayout layout );
064
065    String getKey();
066
067    @Deprecated
068    boolean isUniqueVersion();
069
070    @Deprecated
071    boolean isBlacklisted();
072
073    @Deprecated
074    void setBlacklisted( boolean blackListed );
075
076    //
077    // New interface methods for the repository system.
078    //
079    /**
080     *
081     * @param artifact
082     * @return
083     * @since 3.0-alpha-3
084     */
085    Artifact find( Artifact artifact );
086
087    /**
088     * Finds the versions of the specified artifact that are available in this repository.
089     *
090     * @param artifact The artifact whose available versions should be determined, must not be {@code null}.
091     * @return The available versions of the artifact or an empty list if none, never {@code null}.
092     * @since 3.0-alpha-3
093     */
094    List<String> findVersions( Artifact artifact );
095
096    /**
097     * Indicates whether this repository is backed by actual projects. For instance, the build reactor or IDE workspace
098     * are examples of such repositories.
099     *
100     * @return {@code true} if the repository is backed by actual projects, {@code false} otherwise.
101     * @since 3.0-beta-1
102     */
103    boolean isProjectAware();
104
105    /**
106     * @since 3.0-alpha-3
107     */
108    void setAuthentication( Authentication authentication );
109    /**
110     * @since 3.0-alpha-3
111     */
112    Authentication getAuthentication();
113
114    /**
115     * @since 3.0-alpha-3
116     */
117    void setProxy( Proxy proxy );
118    /**
119     * @since 3.0-alpha-3
120     */
121    Proxy getProxy();
122
123    /**
124     * @since 3.0.3
125     * @return the repositories mirrored by the actual one
126     */
127    List<ArtifactRepository> getMirroredRepositories();
128
129    /**
130     * @since 3.0.3
131     * @param mirroredRepositories the repositories that the actual one mirrors
132     */
133    void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories );
134
135}