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
32 public class ProxyConfiguration
34 private List repositories = new ArrayList();
36 private String cachePath;
38 private String layout;
40 private ProxyInfo httpProxy;
43 * Used to set the location where the proxy should cache the configured repositories
47 public void setRepositoryCachePath( String path )
49 cachePath = new File( path ).getAbsolutePath();
53 * Used to retrieved the absolute path of the repository cache
55 * @return path to the proxy cache
57 public String getRepositoryCachePath()
62 public void setHttpProxy( ProxyInfo httpProxy )
64 this.httpProxy = httpProxy;
67 public void setHttpProxy( String host, int port )
69 ProxyInfo proxyInfo = new ProxyInfo();
70 proxyInfo.setHost( host );
71 proxyInfo.setPort( port );
73 httpProxy = proxyInfo;
76 public void setHttpProxy( String host, int port, String username, String password )
78 setHttpProxy( host, port );
79 httpProxy.setUserName( username );
80 httpProxy.setPassword( password );
83 public void setHttpProxy( String host, int port, String username, String password, String ntlmHost,
86 setHttpProxy( host, port );
87 httpProxy.setUserName( username );
88 httpProxy.setPassword( password );
89 httpProxy.setNtlmHost( ntlmHost );
90 httpProxy.setNtlmDomain( ntlmDomain );
93 public ProxyInfo getHttpProxy()
99 * Used to add proxied repositories.
101 * @param repository the repository to be proxied
103 public void addRepository( ProxyRepository repository )
105 repositories.add( repository );
109 * Used to retrieve an unmodifyable list of proxied repositories. They returned list determines the search sequence
110 * for retrieving artifacts.
112 * @return a list of ProxyRepository objects representing proxied repositories
114 public List getRepositories()
116 return Collections.unmodifiableList( repositories );
120 * Used to set the list of repositories to be proxied. This replaces any repositories already added to this
121 * configuraion instance. Useful for re-arranging an existing proxied list.
123 * @param repositories
125 public void setRepositories( List repositories )
127 this.repositories = repositories;
130 public String getLayout()
132 if ( layout == null )
140 public void setLayout( String layout )
142 this.layout = layout;