001package org.apache.archiva.configuration; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022/** 023 * Class RemoteRepositoryConfiguration. 024 * 025 * @version $Revision$ $Date$ 026 */ 027@SuppressWarnings( "all" ) 028public class RemoteRepositoryConfiguration 029 extends AbstractRepositoryConfiguration 030 implements java.io.Serializable 031{ 032 033 //--------------------------/ 034 //- Class/Member Variables -/ 035 //--------------------------/ 036 037 /** 038 * 039 * The URL for this repository. 040 * 041 */ 042 private String url; 043 044 /** 045 * 046 * The Username for this repository. 047 * 048 */ 049 private String username; 050 051 /** 052 * 053 * The Password for this repository. 054 * 055 */ 056 private String password; 057 058 /** 059 * 060 * Timeout in seconds for connections to this 061 * repository 062 * . 063 */ 064 private int timeout = 60; 065 066 /** 067 * 068 * When to run the refresh task. 069 * Default is every sunday at 8H00. 070 * 071 */ 072 private String refreshCronExpression = "0 0 08 ? * SUN"; 073 074 /** 075 * 076 * Activate download of remote index if 077 * remoteIndexUrl is set too. 078 * 079 */ 080 private boolean downloadRemoteIndex = false; 081 082 /** 083 * 084 * Remote Index Url : if not starting with http 085 * will be relative to the remote repository url. 086 * 087 */ 088 private String remoteIndexUrl; 089 090 /** 091 * 092 * Id of the networkProxy to use when downloading 093 * remote index. 094 * 095 */ 096 private String remoteDownloadNetworkProxyId; 097 098 /** 099 * 100 * Timeout in seconds for download remote index. 101 * Default is more long than artifact download. 102 * 103 */ 104 private int remoteDownloadTimeout = 300; 105 106 /** 107 * 108 * Schedule download of remote index when archiva 109 * start 110 * . 111 */ 112 private boolean downloadRemoteIndexOnStartup = false; 113 114 /** 115 * Field extraParameters. 116 */ 117 private java.util.Map extraParameters; 118 119 /** 120 * Field extraHeaders. 121 */ 122 private java.util.Map extraHeaders; 123 124 /** 125 * The path to check the repository availability (relative to 126 * the repository URL). Some repositories do not allow 127 * browsing, so a certain artifact must be checked. 128 */ 129 private String checkPath; 130 131 132 //-----------/ 133 //- Methods -/ 134 //-----------/ 135 136 /** 137 * Method addExtraHeader. 138 * 139 * @param key 140 * @param value 141 */ 142 public void addExtraHeader( Object key, String value ) 143 { 144 getExtraHeaders().put( key, value ); 145 } //-- void addExtraHeader( Object, String ) 146 147 /** 148 * Method addExtraParameter. 149 * 150 * @param key 151 * @param value 152 */ 153 public void addExtraParameter( Object key, String value ) 154 { 155 getExtraParameters().put( key, value ); 156 } //-- void addExtraParameter( Object, String ) 157 158 /** 159 * Get the path to check the repository availability (relative 160 * to the repository URL). Some repositories do not allow 161 * browsing, so a certain artifact must be checked. 162 * 163 * @return String 164 */ 165 public String getCheckPath() 166 { 167 return this.checkPath; 168 } //-- String getCheckPath() 169 170 /** 171 * Method getExtraHeaders. 172 * 173 * @return Map 174 */ 175 public java.util.Map getExtraHeaders() 176 { 177 if ( this.extraHeaders == null ) 178 { 179 this.extraHeaders = new java.util.HashMap(); 180 } 181 182 return this.extraHeaders; 183 } //-- java.util.Map getExtraHeaders() 184 185 /** 186 * Method getExtraParameters. 187 * 188 * @return Map 189 */ 190 public java.util.Map getExtraParameters() 191 { 192 if ( this.extraParameters == null ) 193 { 194 this.extraParameters = new java.util.HashMap(); 195 } 196 197 return this.extraParameters; 198 } //-- java.util.Map getExtraParameters() 199 200 /** 201 * Get the Password for this repository. 202 * 203 * @return String 204 */ 205 public String getPassword() 206 { 207 return this.password; 208 } //-- String getPassword() 209 210 /** 211 * Get when to run the refresh task. 212 * Default is every sunday at 8H00. 213 * 214 * @return String 215 */ 216 public String getRefreshCronExpression() 217 { 218 return this.refreshCronExpression; 219 } //-- String getRefreshCronExpression() 220 221 /** 222 * Get id of the networkProxy to use when downloading remote 223 * index. 224 * 225 * @return String 226 */ 227 public String getRemoteDownloadNetworkProxyId() 228 { 229 return this.remoteDownloadNetworkProxyId; 230 } //-- String getRemoteDownloadNetworkProxyId() 231 232 /** 233 * Get timeout in seconds for download remote index. Default is 234 * more long than artifact download. 235 * 236 * @return int 237 */ 238 public int getRemoteDownloadTimeout() 239 { 240 return this.remoteDownloadTimeout; 241 } //-- int getRemoteDownloadTimeout() 242 243 /** 244 * Get remote Index Url : if not starting with http will be 245 * relative to the remote repository url. 246 * 247 * @return String 248 */ 249 public String getRemoteIndexUrl() 250 { 251 return this.remoteIndexUrl; 252 } //-- String getRemoteIndexUrl() 253 254 /** 255 * Get timeout in seconds for connections to this repository. 256 * 257 * @return int 258 */ 259 public int getTimeout() 260 { 261 return this.timeout; 262 } //-- int getTimeout() 263 264 /** 265 * Get the URL for this repository. 266 * 267 * @return String 268 */ 269 public String getUrl() 270 { 271 return this.url; 272 } //-- String getUrl() 273 274 /** 275 * Get the Username for this repository. 276 * 277 * @return String 278 */ 279 public String getUsername() 280 { 281 return this.username; 282 } //-- String getUsername() 283 284 /** 285 * Get activate download of remote index if remoteIndexUrl is 286 * set too. 287 * 288 * @return boolean 289 */ 290 public boolean isDownloadRemoteIndex() 291 { 292 return this.downloadRemoteIndex; 293 } //-- boolean isDownloadRemoteIndex() 294 295 /** 296 * Get schedule download of remote index when archiva start. 297 * 298 * @return boolean 299 */ 300 public boolean isDownloadRemoteIndexOnStartup() 301 { 302 return this.downloadRemoteIndexOnStartup; 303 } //-- boolean isDownloadRemoteIndexOnStartup() 304 305 /** 306 * Set the path to check the repository availability (relative 307 * to the repository URL). Some repositories do not allow 308 * browsing, so a certain artifact must be checked. 309 * 310 * @param checkPath 311 */ 312 public void setCheckPath( String checkPath ) 313 { 314 this.checkPath = checkPath; 315 } //-- void setCheckPath( String ) 316 317 /** 318 * Set activate download of remote index if remoteIndexUrl is 319 * set too. 320 * 321 * @param downloadRemoteIndex 322 */ 323 public void setDownloadRemoteIndex( boolean downloadRemoteIndex ) 324 { 325 this.downloadRemoteIndex = downloadRemoteIndex; 326 } //-- void setDownloadRemoteIndex( boolean ) 327 328 /** 329 * Set schedule download of remote index when archiva start. 330 * 331 * @param downloadRemoteIndexOnStartup 332 */ 333 public void setDownloadRemoteIndexOnStartup( boolean downloadRemoteIndexOnStartup ) 334 { 335 this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup; 336 } //-- void setDownloadRemoteIndexOnStartup( boolean ) 337 338 /** 339 * Set additional http headers to add to url when requesting 340 * remote repositories. 341 * 342 * @param extraHeaders 343 */ 344 public void setExtraHeaders( java.util.Map extraHeaders ) 345 { 346 this.extraHeaders = extraHeaders; 347 } //-- void setExtraHeaders( java.util.Map ) 348 349 /** 350 * Set additionnal request parameters to add to url when 351 * requesting remote repositories. 352 * 353 * @param extraParameters 354 */ 355 public void setExtraParameters( java.util.Map extraParameters ) 356 { 357 this.extraParameters = extraParameters; 358 } //-- void setExtraParameters( java.util.Map ) 359 360 /** 361 * Set the Password for this repository. 362 * 363 * @param password 364 */ 365 public void setPassword( String password ) 366 { 367 this.password = password; 368 } //-- void setPassword( String ) 369 370 /** 371 * Set when to run the refresh task. 372 * Default is every sunday at 8H00. 373 * 374 * @param refreshCronExpression 375 */ 376 public void setRefreshCronExpression( String refreshCronExpression ) 377 { 378 this.refreshCronExpression = refreshCronExpression; 379 } //-- void setRefreshCronExpression( String ) 380 381 /** 382 * Set id of the networkProxy to use when downloading remote 383 * index. 384 * 385 * @param remoteDownloadNetworkProxyId 386 */ 387 public void setRemoteDownloadNetworkProxyId( String remoteDownloadNetworkProxyId ) 388 { 389 this.remoteDownloadNetworkProxyId = remoteDownloadNetworkProxyId; 390 } //-- void setRemoteDownloadNetworkProxyId( String ) 391 392 /** 393 * Set timeout in seconds for download remote index. Default is 394 * more long than artifact download. 395 * 396 * @param remoteDownloadTimeout 397 */ 398 public void setRemoteDownloadTimeout( int remoteDownloadTimeout ) 399 { 400 this.remoteDownloadTimeout = remoteDownloadTimeout; 401 } //-- void setRemoteDownloadTimeout( int ) 402 403 /** 404 * Set remote Index Url : if not starting with http will be 405 * relative to the remote repository url. 406 * 407 * @param remoteIndexUrl 408 */ 409 public void setRemoteIndexUrl( String remoteIndexUrl ) 410 { 411 this.remoteIndexUrl = remoteIndexUrl; 412 } //-- void setRemoteIndexUrl( String ) 413 414 /** 415 * Set timeout in seconds for connections to this repository. 416 * 417 * @param timeout 418 */ 419 public void setTimeout( int timeout ) 420 { 421 this.timeout = timeout; 422 } //-- void setTimeout( int ) 423 424 /** 425 * Set the URL for this repository. 426 * 427 * @param url 428 */ 429 public void setUrl( String url ) 430 { 431 this.url = url; 432 } //-- void setUrl( String ) 433 434 /** 435 * Set the Username for this repository. 436 * 437 * @param username 438 */ 439 public void setUsername( String username ) 440 { 441 this.username = username; 442 } //-- void setUsername( String ) 443 444 445 public String toString() 446 { 447 return "RemoteRepositoryConfiguration id:'" + getId() + "',name:'" + getName() +"'"; 448 } 449 450 451 452}