public abstract class DefaultRepositoryProxyHandler extends Object implements RepositoryProxyHandler
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
protected UrlFailureCache |
urlFailureCache |
Constructor and Description |
---|
DefaultRepositoryProxyHandler() |
Modifier and Type | Method and Description |
---|---|
protected String |
addParameters(String path,
RemoteRepository remoteRepository) |
void |
addPolicy(Policy policy)
Adds a policy
|
void |
addProxyConnector(ProxyConnector connector) |
StorageAsset |
fetchFromProxies(ManagedRepository repository,
ArtifactReference artifact)
Performs the artifact fetch operation against the target repositories
of the provided source repository.
|
StorageAsset |
fetchFromProxies(ManagedRepository repository,
String path)
Performs the fetch operation against the target repositories
of the provided source repository by a specific path.
|
ProxyFetchResult |
fetchMetadataFromProxies(ManagedRepository repository,
String logicalPath)
Performs the metadata fetch operation against the target repositories
of the provided source repository.
|
Map<String,DownloadErrorPolicy> |
getDownloadErrorPolicies() |
MetadataTools |
getMetadataTools() |
Map<String,NetworkProxy> |
getNetworkProxies()
Returns a map of the defined network proxies, or a empty map, if no proxy is defined.
|
NetworkProxy |
getNetworkProxy(String id)
Returns the network proxy that is defined for the given repository id.
|
Map<String,PostDownloadPolicy> |
getPostDownloadPolicies() |
Map<String,PreDownloadPolicy> |
getPreDownloadPolicies() |
List<ProxyConnector> |
getProxyConnectors(ManagedRepository repository)
TODO: Ensure that list is correctly ordered based on configuration.
|
UrlFailureCache |
getUrlFailureCache() |
boolean |
hasProxies(ManagedRepository repository)
Test if the provided ManagedRepositoryContent has any proxies configured for it.
|
void |
initialize() |
void |
removePolicy(Policy policy)
Removes a policy
|
void |
setArchivaConfiguration(ArchivaConfiguration archivaConfiguration) |
void |
setDownloadErrorPolicies(Map<String,DownloadErrorPolicy> downloadErrorPolicies) |
void |
setMetadataTools(MetadataTools metadataTools) |
void |
setNetworkProxies(Map<String,NetworkProxy> networkProxies)
Sets network proxies (normally HTTP proxies) to access the remote repositories.
|
void |
setPolicies(List<Policy> policyList)
Sets the policies that this handler should validate.
|
void |
setPostDownloadPolicies(Map<String,PostDownloadPolicy> postDownloadPolicies) |
void |
setPreDownloadPolicies(Map<String,PreDownloadPolicy> preDownloadPolicies) |
void |
setProxyConnectors(List<ProxyConnector> proxyConnectors) |
void |
setUrlFailureCache(UrlFailureCache urlFailureCache) |
abstract List<RepositoryType> |
supports() |
protected StorageAsset |
transferFile(ProxyConnector connector,
RemoteRepository remoteRepository,
String remotePath,
ManagedRepository repository,
StorageAsset resource,
Properties requestProperties,
boolean executeConsumers)
Perform the transfer of the file.
|
protected abstract void |
transferResources(ProxyConnector connector,
RemoteRepository remoteRepository,
StorageAsset tmpResource,
StorageAsset[] checksumFiles,
String url,
String remotePath,
StorageAsset resource,
Path workingDirectory,
ManagedRepository repository) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addNetworkproxy, getHandler
protected org.slf4j.Logger log
@Inject protected UrlFailureCache urlFailureCache
public DefaultRepositoryProxyHandler()
@PostConstruct public void initialize()
public StorageAsset fetchFromProxies(ManagedRepository repository, ArtifactReference artifact) throws ProxyDownloadException
RepositoryProxyHandler
If the artifact is found, it is downloaded and placed into the source repository filesystem.
fetchFromProxies
in interface RepositoryProxyHandler
repository
- the source repository to use. (must be a managed repository)artifact
- the artifact to fetch.ProxyDownloadException
- if there was a problem fetching the content from the target repositories.public StorageAsset fetchFromProxies(ManagedRepository repository, String path)
RepositoryProxyHandler
fetchFromProxies
in interface RepositoryProxyHandler
repository
- the source repository to use. (must be a managed repository)path
- the path of the resource to fetchpublic ProxyFetchResult fetchMetadataFromProxies(ManagedRepository repository, String logicalPath)
RepositoryProxyHandler
If the metadata is found, it is downloaded and placed into the source repository filesystem.
fetchMetadataFromProxies
in interface RepositoryProxyHandler
repository
- the source repository to use. (must be a managed repository)logicalPath
- the metadata to fetch.public boolean hasProxies(ManagedRepository repository)
hasProxies
in interface RepositoryProxyHandler
repository
- protected StorageAsset transferFile(ProxyConnector connector, RemoteRepository remoteRepository, String remotePath, ManagedRepository repository, StorageAsset resource, Properties requestProperties, boolean executeConsumers) throws ProxyException, NotModifiedException
connector
- the connector configuration to use.remoteRepository
- the remote repository get the resource from.remotePath
- the path in the remote repository to the resource to get.repository
- the managed repository that will hold the fileresource
- the path relative to the repository storage where the file should be downloaded torequestProperties
- the request properties to utilize for policy handling.executeConsumers
- whether to execute the consumers after proxyingNotFoundException
- if the file was not found on the remote repository.NotModifiedException
- if the localFile was present, and the resource was present on remote repository, but
the remote resource is not newer than the local File.ProxyException
- if transfer was unsuccessful.protected abstract void transferResources(ProxyConnector connector, RemoteRepository remoteRepository, StorageAsset tmpResource, StorageAsset[] checksumFiles, String url, String remotePath, StorageAsset resource, Path workingDirectory, ManagedRepository repository) throws ProxyException
ProxyException
public List<ProxyConnector> getProxyConnectors(ManagedRepository repository)
getProxyConnectors
in interface RepositoryProxyHandler
repository
- ProxyConnector
objects.protected String addParameters(String path, RemoteRepository remoteRepository)
public void setArchivaConfiguration(ArchivaConfiguration archivaConfiguration)
public MetadataTools getMetadataTools()
public void setMetadataTools(MetadataTools metadataTools)
public UrlFailureCache getUrlFailureCache()
public void setUrlFailureCache(UrlFailureCache urlFailureCache)
public Map<String,PreDownloadPolicy> getPreDownloadPolicies()
public void setPreDownloadPolicies(Map<String,PreDownloadPolicy> preDownloadPolicies)
public Map<String,PostDownloadPolicy> getPostDownloadPolicies()
public void setPostDownloadPolicies(Map<String,PostDownloadPolicy> postDownloadPolicies)
public Map<String,DownloadErrorPolicy> getDownloadErrorPolicies()
public void setDownloadErrorPolicies(Map<String,DownloadErrorPolicy> downloadErrorPolicies)
public void setNetworkProxies(Map<String,NetworkProxy> networkProxies)
RepositoryProxyHandler
setNetworkProxies
in interface RepositoryProxyHandler
networkProxies
- A map of (repository id, network proxy) where the repository id must be the id of an
existing remote repository.public NetworkProxy getNetworkProxy(String id)
RepositoryProxyHandler
getNetworkProxy
in interface RepositoryProxyHandler
id
- The remote repository idnull
if no one is defined for this id.public Map<String,NetworkProxy> getNetworkProxies()
RepositoryProxyHandler
getNetworkProxies
in interface RepositoryProxyHandler
public abstract List<RepositoryType> supports()
supports
in interface RepositoryProxyHandler
public void setPolicies(List<Policy> policyList)
RepositoryProxyHandler
setPolicies
in interface RepositoryProxyHandler
public void addPolicy(Policy policy)
RepositoryProxyHandler
addPolicy
in interface RepositoryProxyHandler
public void removePolicy(Policy policy)
RepositoryProxyHandler
removePolicy
in interface RepositoryProxyHandler
public void addProxyConnector(ProxyConnector connector)
addProxyConnector
in interface RepositoryProxyHandler
public void setProxyConnectors(List<ProxyConnector> proxyConnectors)
setProxyConnectors
in interface RepositoryProxyHandler
Copyright © 2006–2019 The Apache Software Foundation. All rights reserved.