1 package org.apache.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.archiva.repository.ManagedRepositoryContent;
23 import org.apache.archiva.repository.RemoteRepositoryContent;
24 import org.apache.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.
35 public class ProxyConnector
36 implements RepositoryConnector
38 private ManagedRepositoryContent sourceRepository;
40 private RemoteRepositoryContent targetRepository;
42 private List<String> blacklist;
44 private List<String> whitelist;
46 private String proxyId;
50 private Map<String, String> policies;
52 private boolean disabled;
54 public boolean isDisabled()
59 public void setDisabled(boolean disabled)
61 this.disabled = disabled;
64 public List<String> getBlacklist()
69 public void setBlacklist( List<String> blacklist )
71 this.blacklist = blacklist;
74 public ManagedRepositoryContent getSourceRepository()
76 return sourceRepository;
79 public void setSourceRepository( ManagedRepositoryContent sourceRepository )
81 this.sourceRepository = sourceRepository;
84 public RemoteRepositoryContent getTargetRepository()
86 return targetRepository;
89 public void setTargetRepository( RemoteRepositoryContent targetRepository )
91 this.targetRepository = targetRepository;
94 public List<String> getWhitelist()
99 public void setWhitelist( List<String> whitelist )
101 this.whitelist = whitelist;
104 public Map<String, String> getPolicies()
109 public void setPolicies( Map<String, String> policies )
111 this.policies = policies;
114 public String getProxyId()
119 public void setProxyId( String proxyId )
121 this.proxyId = proxyId;
125 public String toString()
127 StringBuilder sb = new StringBuilder();
129 sb.append( "ProxyConnector[\n" );
130 sb.append( " source: [managed] " ).append( this.sourceRepository.getRepoRoot() ).append( "\n" );
131 sb.append( " target: [remote] " ).append( this.targetRepository.getRepository().getUrl() ).append( "\n" );
132 sb.append( " proxyId:" ).append( this.proxyId ).append( "\n" );
134 Iterator<String> keys = this.policies.keySet().iterator();
135 while ( keys.hasNext() )
137 String name = keys.next();
138 sb.append( " policy[" ).append( name ).append( "]:" );
139 sb.append( this.policies.get( name ) ).append( "\n" );
144 return sb.toString();
147 public void setPolicy( String policyId, String policySetting )
149 this.policies.put( policyId, policySetting );
152 public int getOrder()
157 public void setOrder( int order )