1 package org.apache.maven.archiva.proxy;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
23 import org.apache.maven.archiva.repository.RemoteRepositoryContent;
24 import org.apache.maven.archiva.repository.connector.RepositoryConnector;
26 import java.util.Iterator;
27 import java.util.List;
31 * This represents a connector for a repository to repository proxy.
33 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
36 public class ProxyConnector
37 implements RepositoryConnector
39 private ManagedRepositoryContent sourceRepository;
41 private RemoteRepositoryContent targetRepository;
43 private List<String> blacklist;
45 private List<String> whitelist;
47 private String proxyId;
51 private Map<String, String> policies;
53 public List<String> getBlacklist()
58 public void setBlacklist( List<String> blacklist )
60 this.blacklist = blacklist;
63 public ManagedRepositoryContent getSourceRepository()
65 return sourceRepository;
68 public void setSourceRepository( ManagedRepositoryContent sourceRepository )
70 this.sourceRepository = sourceRepository;
73 public RemoteRepositoryContent getTargetRepository()
75 return targetRepository;
78 public void setTargetRepository( RemoteRepositoryContent targetRepository )
80 this.targetRepository = targetRepository;
83 public List<String> getWhitelist()
88 public void setWhitelist( List<String> whitelist )
90 this.whitelist = whitelist;
93 public Map<String, String> getPolicies()
98 public void setPolicies( Map<String, String> policies )
100 this.policies = policies;
103 public String getProxyId()
108 public void setProxyId( String proxyId )
110 this.proxyId = proxyId;
113 public String toString()
115 StringBuffer sb = new StringBuffer();
117 sb.append( "ProxyConnector[\n" );
118 sb.append( " source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" );
119 sb.append( " target: [remote] " ).append( this.targetRepository.getRepository().getUrl() ).append( "\n" );
120 sb.append( " proxyId:" ).append( this.proxyId ).append( "\n" );
122 Iterator<String> keys = this.policies.keySet().iterator();
123 while ( keys.hasNext() )
125 String name = keys.next();
126 sb.append( " policy[" ).append( name ).append( "]:" );
127 sb.append( this.policies.get( name ) ).append( "\n" );
132 return sb.toString();
135 public void setPolicy( String policyId, String policySetting )
137 this.policies.put( policyId, policySetting );
140 public int getOrder()
145 public void setOrder( int order )