1 package org.apache.archiva.configuration;
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
23 * Class AbstractRepositoryConnectorConfiguration.
25 * @version $Revision$ $Date$
27 @SuppressWarnings( "all" )
28 public class AbstractRepositoryConnectorConfiguration
29 implements java.io.Serializable
32 //--------------------------/
33 //- Class/Member Variables -/
34 //--------------------------/
38 * The Repository Source for this connector.
41 private String sourceRepoId;
45 * The Repository Target for this connector.
48 private String targetRepoId;
52 * The network proxy ID to use for this connector.
55 private String proxyId;
58 * Field blackListPatterns.
60 private java.util.List<String> blackListPatterns;
63 * Field whiteListPatterns.
65 private java.util.List<String> whiteListPatterns;
70 private java.util.Map policies;
75 private java.util.Map properties;
79 * If the the repository proxy connector is
83 private boolean disabled = false;
91 * Method addBlackListPattern.
95 public void addBlackListPattern( String string )
97 getBlackListPatterns().add( string );
98 } //-- void addBlackListPattern( String )
106 public void addPolicy( String key, String value )
108 getPolicies().put( key, value );
109 } //-- void addPolicy( Object, String )
112 * Method addProperty.
117 public void addProperty( String key, String value )
119 getProperties().put( key, value );
120 } //-- void addProperty( Object, String )
123 * Method addWhiteListPattern.
127 public void addWhiteListPattern( String string )
129 getWhiteListPatterns().add( string );
130 } //-- void addWhiteListPattern( String )
133 * Method getBlackListPatterns.
137 public java.util.List<String> getBlackListPatterns()
139 if ( this.blackListPatterns == null )
141 this.blackListPatterns = new java.util.ArrayList<String>();
144 return this.blackListPatterns;
145 } //-- java.util.List<String> getBlackListPatterns()
148 * Method getPolicies.
152 public java.util.Map<String, String> getPolicies()
154 if ( this.policies == null )
156 this.policies = new java.util.HashMap();
159 return this.policies;
160 } //-- java.util.Map getPolicies()
163 * Method getProperties.
167 public java.util.Map<String, String> getProperties()
169 if ( this.properties == null )
171 this.properties = new java.util.HashMap();
174 return this.properties;
175 } //-- java.util.Map getProperties()
178 * Get the network proxy ID to use for this connector.
182 public String getProxyId()
185 } //-- String getProxyId()
188 * Get the Repository Source for this connector.
192 public String getSourceRepoId()
194 return this.sourceRepoId;
195 } //-- String getSourceRepoId()
198 * Get the Repository Target for this connector.
202 public String getTargetRepoId()
204 return this.targetRepoId;
205 } //-- String getTargetRepoId()
208 * Method getWhiteListPatterns.
212 public java.util.List<String> getWhiteListPatterns()
214 if ( this.whiteListPatterns == null )
216 this.whiteListPatterns = new java.util.ArrayList<String>();
219 return this.whiteListPatterns;
220 } //-- java.util.List<String> getWhiteListPatterns()
223 * Get if the the repository proxy connector is disabled or
228 public boolean isDisabled()
230 return this.disabled;
231 } //-- boolean isDisabled()
234 * Method removeBlackListPattern.
238 public void removeBlackListPattern( String string )
240 getBlackListPatterns().remove( string );
241 } //-- void removeBlackListPattern( String )
244 * Method removeWhiteListPattern.
248 public void removeWhiteListPattern( String string )
250 getWhiteListPatterns().remove( string );
251 } //-- void removeWhiteListPattern( String )
254 * Set the list of blacklisted patterns for this connector.
256 * @param blackListPatterns
258 public void setBlackListPatterns( java.util.List<String> blackListPatterns )
260 this.blackListPatterns = blackListPatterns;
261 } //-- void setBlackListPatterns( java.util.List )
264 * Set if the the repository proxy connector is disabled or
269 public void setDisabled( boolean disabled )
271 this.disabled = disabled;
272 } //-- void setDisabled( boolean )
275 * Set policy configuration for the connector.
279 public void setPolicies( java.util.Map policies )
281 this.policies = policies;
282 } //-- void setPolicies( java.util.Map )
285 * Set configuration for the connector.
289 public void setProperties( java.util.Map properties )
291 this.properties = properties;
292 } //-- void setProperties( java.util.Map )
295 * Set the network proxy ID to use for this connector.
299 public void setProxyId( String proxyId )
301 this.proxyId = proxyId;
302 } //-- void setProxyId( String )
305 * Set the Repository Source for this connector.
307 * @param sourceRepoId
309 public void setSourceRepoId( String sourceRepoId )
311 this.sourceRepoId = sourceRepoId;
312 } //-- void setSourceRepoId( String )
315 * Set the Repository Target for this connector.
317 * @param targetRepoId
319 public void setTargetRepoId( String targetRepoId )
321 this.targetRepoId = targetRepoId;
322 } //-- void setTargetRepoId( String )
325 * Set the list of whitelisted patterns for this connector.
327 * @param whiteListPatterns
329 public void setWhiteListPatterns( java.util.List<String> whiteListPatterns )
331 this.whiteListPatterns = whiteListPatterns;
332 } //-- void setWhiteListPatterns( java.util.List )
336 * Obtain a specific policy from the underlying connector.
338 * @param policyId the policy id to fetch.
339 * @param defaultValue the default value for the policy id.
340 * @return the configured policy value (or default value if not found).
342 public String getPolicy( String policyId, String defaultValue )
344 if ( this.getPolicies() == null )
349 Object value = this.getPolicies().get( policyId );
356 return (String) value;