You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepositoryProxyHandler.java 3.8KB

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