001package org.apache.maven.repository.legacy.metadata;
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.repository.ArtifactRepository;
026import org.apache.maven.artifact.versioning.ArtifactVersion;
027
028/**
029 * Provides some metadata operations, like querying the remote repository for a list of versions available for an
030 * artifact.
031 *
032 * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
033 */
034public interface ArtifactMetadataSource
035{
036
037    ResolutionGroup retrieve( MetadataResolutionRequest request )
038        throws ArtifactMetadataRetrievalException;
039
040    ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
041                              List<ArtifactRepository> remoteRepositories )
042        throws ArtifactMetadataRetrievalException;
043
044    /**
045     * Get a list of available versions for an artifact in the remote repository
046     *
047     * @param artifact           artifact we are interested in. Only <code>groupid</code> and <code>artifactId</code>
048     *                           are needed, for instance the following code will work
049     *                           <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
050     * @param localRepository    local repository
051     * @param remoteRepositories remote repositories, {@link List} $lt; {@link ArtifactRepository} >
052     * @return {@link List} $lt; {@link ArtifactVersion} >
053     * @throws ArtifactMetadataRetrievalException
054     *          in case of error while retrieving repository metadata from the repository.
055     */
056    List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
057                                                     List<ArtifactRepository> remoteRepositories )
058        throws ArtifactMetadataRetrievalException;
059
060    /**
061     * Get a list of available versions for an artifact in the remote deployment repository. This ignores any update
062     * policy checks and mirrors and always retrieves the latest information from the given repository.
063     *
064     * @param artifact artifact we are interested in. Only <code>groupid</code> and <code>artifactId</code> are
065     *            needed, for instance the following code will work
066     *            <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
067     * @param localRepository    local repository
068     * @param remoteRepository   remote repository
069     * @return {@link List} $lt; {@link ArtifactVersion} >
070     * @throws ArtifactMetadataRetrievalException
071     *          in case of error while retrieving repository metadata from the repository.
072     */
073    List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
074                                                                             ArtifactRepository localRepository,
075                                                                             ArtifactRepository remoteRepository )
076        throws ArtifactMetadataRetrievalException;
077
078}