001package org.apache.archiva.proxy.model; 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 org.apache.archiva.model.ArtifactReference; 023import org.apache.archiva.policies.ProxyDownloadException; 024import org.apache.archiva.repository.ManagedRepositoryContent; 025 026import java.io.File; 027import java.util.List; 028 029/** 030 * Handler for potential repository proxy connectors. 031 * 032 * 033 */ 034public interface RepositoryProxyConnectors 035{ 036 /** 037 * Performs the artifact fetch operation against the target repositories 038 * of the provided source repository. 039 * 040 * If the artifact is found, it is downloaded and placed into the source repository 041 * filesystem. 042 * 043 * @param repository the source repository to use. (must be a managed repository) 044 * @param artifact the artifact to fetch. 045 * @return the file that was obtained, or null if no content was obtained 046 * @throws ProxyDownloadException if there was a problem fetching the content from the target repositories. 047 */ 048 File fetchFromProxies( ManagedRepositoryContent repository, ArtifactReference artifact ) 049 throws ProxyDownloadException; 050 051 /** 052 * Performs the metadata fetch operation against the target repositories 053 * of the provided source repository. 054 * 055 * If the metadata is found, it is downloaded and placed into the source repository 056 * filesystem. 057 * 058 * @param repository the source repository to use. (must be a managed repository) 059 * @param logicalPath the metadata to fetch. 060 * @return the file that was obtained, or null if no content was obtained 061 */ 062 ProxyFetchResult fetchMetadataFromProxies( ManagedRepositoryContent repository, String logicalPath ); 063 064 /** 065 * Performs the fetch operation against the target repositories 066 * of the provided source repository. 067 * 068 * @param managedRepository the source repository to use. (must be a managed repository) 069 * @param path the path of the resource to fetch 070 * @return the file that was obtained, or null if no content was obtained 071 */ 072 File fetchFromProxies( ManagedRepositoryContent managedRepository, String path ); 073 074 /** 075 * Get the List of {@link ProxyConnector} objects of the source repository. 076 * 077 * @param repository the source repository to look for. 078 * @return the List of {@link ProxyConnector} objects. 079 */ 080 List<ProxyConnector> getProxyConnectors( ManagedRepositoryContent repository ); 081 082 /** 083 * Tests to see if the provided repository is a source repository for 084 * any {@link ProxyConnector} objects. 085 * 086 * @param repository the source repository to look for. 087 * @return true if there are proxy connectors that use the provided 088 * repository as a source repository. 089 */ 090 boolean hasProxies( ManagedRepositoryContent repository ); 091}