001package org.apache.maven.artifact.deployer; 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.Collections; 023import java.util.List; 024 025import org.apache.maven.artifact.Artifact; 026import org.apache.maven.artifact.repository.ArtifactRepository; 027import org.apache.maven.artifact.versioning.ArtifactVersion; 028import org.apache.maven.artifact.versioning.DefaultArtifactVersion; 029import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; 030import org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource; 031import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; 032import org.apache.maven.repository.legacy.metadata.ResolutionGroup; 033 034/** @author Jason van Zyl */ 035public class SimpleArtifactMetadataSource 036 implements ArtifactMetadataSource 037{ 038 public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, 039 List<ArtifactRepository> remoteRepositories ) 040 throws ArtifactMetadataRetrievalException 041 { 042 throw new UnsupportedOperationException( "Cannot retrieve metadata in this test case" ); 043 } 044 045 public List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, 046 List<ArtifactRepository> remoteRepositories ) 047 throws ArtifactMetadataRetrievalException 048 { 049 return Collections.<ArtifactVersion>singletonList( new DefaultArtifactVersion( "10.1.3" ) ); 050 } 051 052 public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, 053 ArtifactRepository localRepository, 054 ArtifactRepository remoteRepository ) 055 throws ArtifactMetadataRetrievalException 056 { 057 return Collections.<ArtifactVersion>singletonList( new DefaultArtifactVersion( "10.1.3" ) ); 058 } 059 060 public ResolutionGroup retrieve( MetadataResolutionRequest request ) 061 throws ArtifactMetadataRetrievalException 062 { 063 return retrieve( request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories() ); 064 } 065 066}