This project has retired. For details please refer to its
Attic page.
AbstractRepositoryConnector xref
1 package org.apache.archiva.admin.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.archiva.admin.model.beans.PropertyEntry;
22
23 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28
29
30
31
32
33 public abstract class AbstractRepositoryConnector
34 implements Serializable
35 {
36
37
38
39 private String sourceRepoId;
40
41
42
43
44 private String targetRepoId;
45
46
47
48
49 private String proxyId;
50
51
52
53
54 private List<String> blackListPatterns;
55
56
57
58
59 private List<String> whiteListPatterns;
60
61
62
63
64 private Map<String, String> policies;
65
66
67
68
69
70
71 private List<PropertyEntry> policiesEntries;
72
73
74
75
76 private Map<String, String> properties;
77
78
79
80
81
82
83 private List<PropertyEntry> propertiesEntries;
84
85
86
87
88 private boolean disabled = false;
89
90
91
92
93
94
95
96
97
98
99 public void addBlackListPattern( String string )
100 {
101 getBlackListPatterns().add( string );
102 }
103
104
105
106
107
108
109
110 public void addPolicy( String key, String value )
111 {
112 getPolicies().put( key, value );
113 }
114
115
116
117
118
119
120
121 public void addProperty( String key, String value )
122 {
123 getProperties().put( key, value );
124 }
125
126
127
128
129
130
131 public void addWhiteListPattern( String string )
132 {
133 getWhiteListPatterns().add( string );
134 }
135
136
137
138
139
140
141 public List<String> getBlackListPatterns()
142 {
143 if ( this.blackListPatterns == null )
144 {
145 this.blackListPatterns = new ArrayList<>( 0 );
146 }
147
148 return this.blackListPatterns;
149 }
150
151
152
153
154
155
156 public Map<String, String> getPolicies()
157 {
158 if ( this.policies == null )
159 {
160 this.policies = new HashMap<>();
161 }
162
163 return this.policies;
164 }
165
166
167
168
169
170
171 public Map<String, String> getProperties()
172 {
173 if ( this.properties == null )
174 {
175 this.properties = new HashMap<>();
176 }
177
178 return this.properties;
179 }
180
181
182
183
184
185
186 public String getProxyId()
187 {
188 return this.proxyId;
189 }
190
191
192
193
194
195
196 public String getSourceRepoId()
197 {
198 return this.sourceRepoId;
199 }
200
201
202
203
204
205
206 public String getTargetRepoId()
207 {
208 return this.targetRepoId;
209 }
210
211
212
213
214
215
216 public List<String> getWhiteListPatterns()
217 {
218 if ( this.whiteListPatterns == null )
219 {
220 this.whiteListPatterns = new ArrayList<>( 0 );
221 }
222
223 return this.whiteListPatterns;
224 }
225
226
227
228
229
230
231
232 public boolean isDisabled()
233 {
234 return this.disabled;
235 }
236
237
238
239
240
241
242 public void removeBlackListPattern( String string )
243 {
244 getBlackListPatterns().remove( string );
245 }
246
247
248
249
250
251
252 public void removeWhiteListPattern( String string )
253 {
254 getWhiteListPatterns().remove( string );
255 }
256
257
258
259
260
261
262 public void setBlackListPatterns( List<String> blackListPatterns )
263 {
264 this.blackListPatterns = blackListPatterns;
265 }
266
267
268
269
270
271
272
273
274 public void setDisabled( boolean disabled )
275 {
276 this.disabled = disabled;
277 }
278
279
280
281
282
283
284 public void setPolicies( Map<String, String> policies )
285 {
286 this.policies = policies;
287 }
288
289
290
291
292
293
294 public void setProperties( Map<String, String> properties )
295 {
296 this.properties = properties;
297 }
298
299
300
301
302
303
304 public void setProxyId( String proxyId )
305 {
306 this.proxyId = proxyId;
307 }
308
309
310
311
312
313
314 public void setSourceRepoId( String sourceRepoId )
315 {
316 this.sourceRepoId = sourceRepoId;
317 }
318
319
320
321
322
323
324 public void setTargetRepoId( String targetRepoId )
325 {
326 this.targetRepoId = targetRepoId;
327 }
328
329
330
331
332
333
334
335
336 public void setWhiteListPatterns( List<String> whiteListPatterns )
337 {
338 this.whiteListPatterns = whiteListPatterns;
339 }
340
341
342
343
344
345
346
347
348
349 public String getPolicy( String policyId, String defaultValue )
350 {
351 if ( this.getPolicies() == null )
352 {
353 return null;
354 }
355
356 String value = this.getPolicies().get( policyId );
357
358 if ( value == null )
359 {
360 return defaultValue;
361 }
362
363 return value;
364 }
365
366 public List<PropertyEntry> getPoliciesEntries()
367 {
368 policiesEntries = new ArrayList<>( getPolicies().size() );
369 for ( Map.Entry<String, String> entry : getPolicies().entrySet() )
370 {
371 policiesEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
372 }
373 return policiesEntries;
374 }
375
376 public void setPoliciesEntries( List<PropertyEntry> policiesEntries )
377 {
378 for ( PropertyEntry propertyEntry : policiesEntries )
379 {
380 addPolicy( propertyEntry.getKey(), propertyEntry.getValue() );
381 }
382 }
383
384 public List<PropertyEntry> getPropertiesEntries()
385 {
386 propertiesEntries = new ArrayList<>( getProperties().size() );
387 for ( Map.Entry<String, String> entry : getProperties().entrySet() )
388 {
389 propertiesEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
390 }
391 return propertiesEntries;
392 }
393
394 public void setPropertiesEntries( List<PropertyEntry> propertiesEntries )
395 {
396 for ( PropertyEntry propertyEntry : propertiesEntries )
397 {
398 addProperty( propertyEntry.getKey(), propertyEntry.getValue() );
399 }
400 }
401
402 @Override
403 public boolean equals( Object o )
404 {
405 if ( this == o )
406 {
407 return true;
408 }
409 if ( o == null || getClass() != o.getClass() )
410 {
411 return false;
412 }
413
414 AbstractRepositoryConnectorapache/archiva/admin/model/AbstractRepositoryConnector.html#AbstractRepositoryConnector">AbstractRepositoryConnector that = (AbstractRepositoryConnector) o;
415
416 if ( sourceRepoId != null ? !sourceRepoId.equals( that.sourceRepoId ) : that.sourceRepoId != null )
417 {
418 return false;
419 }
420 if ( targetRepoId != null ? !targetRepoId.equals( that.targetRepoId ) : that.targetRepoId != null )
421 {
422 return false;
423 }
424
425 return true;
426 }
427
428 @Override
429 public int hashCode()
430 {
431 int result = sourceRepoId != null ? sourceRepoId.hashCode() : 0;
432 result = 31 * result + ( targetRepoId != null ? targetRepoId.hashCode() : 0 );
433 return result;
434 }
435
436 @Override
437 public String toString()
438 {
439 final StringBuilder sb = new StringBuilder();
440 sb.append( "AbstractRepositoryConnector" );
441 sb.append( "{sourceRepoId='" ).append( sourceRepoId ).append( '\'' );
442 sb.append( ", targetRepoId='" ).append( targetRepoId ).append( '\'' );
443 sb.append( ", proxyId='" ).append( proxyId ).append( '\'' );
444 sb.append( ", blackListPatterns=" ).append( blackListPatterns );
445 sb.append( ", whiteListPatterns=" ).append( whiteListPatterns );
446 sb.append( ", policies=" ).append( policies );
447 sb.append( ", properties=" ).append( properties );
448 sb.append( ", disabled=" ).append( disabled );
449 sb.append( '}' );
450 return sb.toString();
451 }
452 }
453