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.repository.proxy.repository.ProxyRepository;
20 import org.apache.maven.wagon.proxy.ProxyInfo;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
28 * Class to represent the configuration file for the proxy
30 * @author Edwin Punzalan
31 * @plexus.component role="org.apache.maven.repository.proxy.configuration.ProxyConfiguration"
32 * @todo investigate how these should be set - probably plexus configuration
34 public class ProxyConfiguration
36 public static final String ROLE = ProxyConfiguration.class.getName();
38 private List repositories = new ArrayList();
40 private String cachePath;
42 private String layout;
44 private ProxyInfo httpProxy;
47 * Used to set the location where the proxy should cache the configured repositories
51 public void setRepositoryCachePath( String path )
53 cachePath = new File( path ).getAbsolutePath();
57 * Used to retrieved the absolute path of the repository cache
59 * @return path to the proxy cache
61 public String getRepositoryCachePath()
66 public void setHttpProxy( ProxyInfo httpProxy )
68 this.httpProxy = httpProxy;
71 public void setHttpProxy( String host, int port )
73 ProxyInfo proxyInfo = new ProxyInfo();
74 proxyInfo.setHost( host );
75 proxyInfo.setPort( port );
77 httpProxy = proxyInfo;
80 public void setHttpProxy( String host, int port, String username, String password )
82 setHttpProxy( host, port );
83 httpProxy.setUserName( username );
84 httpProxy.setPassword( password );
87 public void setHttpProxy( String host, int port, String username, String password, String ntlmHost,
90 setHttpProxy( host, port );
91 httpProxy.setUserName( username );
92 httpProxy.setPassword( password );
93 httpProxy.setNtlmHost( ntlmHost );
94 httpProxy.setNtlmDomain( ntlmDomain );
97 public ProxyInfo getHttpProxy()
103 * Used to add proxied repositories.
105 * @param repository the repository to be proxied
107 public void addRepository( ProxyRepository repository )
109 repositories.add( repository );
113 * Used to retrieve an unmodifyable list of proxied repositories. They returned list determines the search sequence
114 * for retrieving artifacts.
116 * @return a list of ProxyRepository objects representing proxied repositories
118 public List getRepositories()
120 return Collections.unmodifiableList( repositories );
124 * Used to set the list of repositories to be proxied. This replaces any repositories already added to this
125 * configuraion instance. Useful for re-arranging an existing proxied list.
127 * @param repositories
129 public void setRepositories( List repositories )
131 this.repositories = repositories;
134 public String getLayout()
136 if ( layout == null )
144 public void setLayout( String layout )
146 this.layout = layout;