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;
47 private ArrayList repositories = new ArrayList();
49 public void setBrowsable( boolean browsable )
51 this.browsable = browsable;
54 public boolean isBrowsable()
59 public void setRepositoryCachePath( String repoCachePath )
61 ArtifactRepositoryPolicy standardPolicy;
62 standardPolicy = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
63 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
65 ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
67 repoCache = artifactRepositoryFactory.createArtifactRepository( "localCache", repoCachePath, layout,
68 standardPolicy, standardPolicy );
71 public ArtifactRepository getRepositoryCache()
76 public String getRepositoryCachePath()
78 return repoCache.getBasedir();
81 public void addRepository( ProxyRepository repository )
83 repositories.add( repository );
86 public List getRepositories()
88 return Collections.unmodifiableList( repositories );
91 public void setRepositories( ArrayList repositories )
93 this.repositories = repositories;