1 package org.apache.maven.repository.proxy.configuration;
4 * Copyright 2005-2006 The Apache Software Foundation.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import org.apache.maven.artifact.repository.ArtifactRepository;
20 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
21 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
22 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
23 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
24 import org.apache.maven.repository.proxy.repository.ProxyRepository;
26 import java.util.ArrayList;
27 import java.util.Collections;
28 import java.util.List;
31 * @author Edwin Punzalan
32 * @plexus.component role="org.apache.maven.repository.proxy.configuration.ProxyConfiguration"
34 public class ProxyConfiguration
36 public static final String ROLE = ProxyConfiguration.class.getName();
41 private ArtifactRepositoryFactory artifactRepositoryFactory;
43 private boolean browsable;
45 private ArtifactRepository repoCache;
46 private List repositories = new ArrayList();
48 public void setBrowsable( boolean browsable )
50 this.browsable = browsable;
53 public boolean isBrowsable()
58 public void setRepositoryCachePath( String repoCacheURL )
60 ArtifactRepositoryPolicy standardPolicy;
61 standardPolicy = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
62 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
64 ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
66 repoCache = artifactRepositoryFactory.createArtifactRepository( "localCache", repoCacheURL, layout,
67 standardPolicy, standardPolicy );
70 public ArtifactRepository getRepositoryCache()
75 public String getRepositoryCachePath()
77 return repoCache.getBasedir();
80 public void addRepository( ProxyRepository repository )
82 repositories.add( repository );
85 public List getRepositories()
87 return Collections.unmodifiableList( repositories );
90 public void setRepositories( List repositories )
92 this.repositories = repositories;