1 package org.apache.archiva.proxy.model;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.archiva.model.ArtifactReference;
23 import org.apache.archiva.policies.ProxyDownloadException;
24 import org.apache.archiva.repository.ManagedRepositoryContent;
25
26 import java.io.File;
27 import java.util.List;
28
29 /**
30 * Handler for potential repository proxy connectors.
31 *
32 *
33 */
34 public interface RepositoryProxyConnectors
35 {
36 /**
37 * Performs the artifact fetch operation against the target repositories
38 * of the provided source repository.
39 *
40 * If the artifact is found, it is downloaded and placed into the source repository
41 * filesystem.
42 *
43 * @param repository the source repository to use. (must be a managed repository)
44 * @param artifact the artifact to fetch.
45 * @return the file that was obtained, or null if no content was obtained
46 * @throws ProxyDownloadException if there was a problem fetching the content from the target repositories.
47 */
48 File fetchFromProxies( ManagedRepositoryContent repository, ArtifactReference artifact )
49 throws ProxyDownloadException;
50
51 /**
52 * Performs the metadata fetch operation against the target repositories
53 * of the provided source repository.
54 *
55 * If the metadata is found, it is downloaded and placed into the source repository
56 * filesystem.
57 *
58 * @param repository the source repository to use. (must be a managed repository)
59 * @param logicalPath the metadata to fetch.
60 * @return the file that was obtained, or null if no content was obtained
61 */
62 ProxyFetchResult fetchMetadataFromProxies( ManagedRepositoryContent repository, String logicalPath );
63
64 /**
65 * Performs the fetch operation against the target repositories
66 * of the provided source repository.
67 *
68 * @param managedRepository the source repository to use. (must be a managed repository)
69 * @param path the path of the resource to fetch
70 * @return the file that was obtained, or null if no content was obtained
71 */
72 File fetchFromProxies( ManagedRepositoryContent managedRepository, String path );
73
74 /**
75 * Get the List of {@link ProxyConnector} objects of the source repository.
76 *
77 * @param repository the source repository to look for.
78 * @return the List of {@link ProxyConnector} objects.
79 */
80 List<ProxyConnector> getProxyConnectors( ManagedRepositoryContent repository );
81
82 /**
83 * Tests to see if the provided repository is a source repository for
84 * any {@link ProxyConnector} objects.
85 *
86 * @param repository the source repository to look for.
87 * @return true if there are proxy connectors that use the provided
88 * repository as a source repository.
89 */
90 boolean hasProxies( ManagedRepositoryContent repository );
91 }