From bc577a44eb5d9aeb87b2ab944005ee90faa1a123 Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Wed, 14 Jun 2006 05:54:38 +0000 Subject: [PATCH] Moved releases and snapshot policies into the proxy configuration class git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@414095 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/proxy/DefaultProxyManager.java | 6 +-- .../configuration/ProxyConfiguration.java | 37 ++++++++++++++++++- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java index 06e172669..881b41e2d 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java @@ -303,14 +303,12 @@ public class DefaultProxyManager private ArtifactRepositoryPolicy getReleasesPolicy() { - //todo get policy configuration from ProxyConfiguration - return new ArtifactRepositoryPolicy(); + return config.getCacheReleasePolicy(); } private ArtifactRepositoryPolicy getSnapshotsPolicy() { - //todo get policy configuration from ProxyConfiguration - return new ArtifactRepositoryPolicy(); + return config.getCacheSnapshotPolicy(); } public URL getRepositoryCacheURL() diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java index 343792d6a..b23c89570 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java @@ -16,14 +16,15 @@ package org.apache.maven.repository.proxy.configuration; * limitations under the License. */ +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.repository.proxy.repository.ProxyRepository; import org.apache.maven.wagon.proxy.ProxyInfo; import java.io.File; import java.util.ArrayList; import java.util.Collections; -import java.util.List; import java.util.Iterator; +import java.util.List; /** * Class to represent the configuration file for the proxy @@ -40,6 +41,10 @@ public class ProxyConfiguration private ProxyInfo httpProxy; + private ArtifactRepositoryPolicy cacheReleasePolicy; + + private ArtifactRepositoryPolicy cacheSnapshotPolicy; + /** * Used to set the location where the proxy should cache the configured repositories * @@ -183,4 +188,34 @@ public class ProxyConfiguration } } } + + public ArtifactRepositoryPolicy getCacheReleasePolicy() + { + if ( cacheReleasePolicy == null ) + { + cacheReleasePolicy = new ArtifactRepositoryPolicy(); + } + + return cacheReleasePolicy; + } + + public void setCacheReleasePolicy( ArtifactRepositoryPolicy cacheReleasePolicy ) + { + this.cacheReleasePolicy = cacheReleasePolicy; + } + + public ArtifactRepositoryPolicy getCacheSnapshotPolicy() + { + if ( cacheSnapshotPolicy == null ) + { + cacheSnapshotPolicy = new ArtifactRepositoryPolicy(); + } + + return cacheSnapshotPolicy; + } + + public void setCacheSnapshotPolicy( ArtifactRepositoryPolicy cacheSnapshotPolicy ) + { + this.cacheSnapshotPolicy = cacheSnapshotPolicy; + } }