You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemoteRepositoryConfiguration.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. package org.apache.archiva.configuration;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. /**
  21. * Class RemoteRepositoryConfiguration.
  22. *
  23. * @version $Revision$ $Date$
  24. */
  25. @SuppressWarnings( "all" )
  26. public class RemoteRepositoryConfiguration
  27. extends AbstractRepositoryConfiguration
  28. implements java.io.Serializable
  29. {
  30. //--------------------------/
  31. //- Class/Member Variables -/
  32. //--------------------------/
  33. /**
  34. *
  35. * The URL for this repository.
  36. *
  37. */
  38. private String url;
  39. /**
  40. *
  41. * The Username for this repository.
  42. *
  43. */
  44. private String username;
  45. /**
  46. *
  47. * The Password for this repository.
  48. *
  49. */
  50. private String password;
  51. /**
  52. *
  53. * Timeout in seconds for connections to this
  54. * repository
  55. * .
  56. */
  57. private int timeout = 60;
  58. /**
  59. *
  60. * When to run the refresh task.
  61. * Default is every sunday at 8H00.
  62. *
  63. */
  64. private String refreshCronExpression = "0 0 08 ? * SUN";
  65. /**
  66. *
  67. * Activate download of remote index if
  68. * remoteIndexUrl is set too.
  69. *
  70. */
  71. private boolean downloadRemoteIndex = false;
  72. /**
  73. *
  74. * Remote Index Url : if not starting with http
  75. * will be relative to the remote repository url.
  76. *
  77. */
  78. private String remoteIndexUrl;
  79. /**
  80. *
  81. * Id of the networkProxy to use when downloading
  82. * remote index.
  83. *
  84. */
  85. private String remoteDownloadNetworkProxyId;
  86. /**
  87. *
  88. * Timeout in seconds for download remote index.
  89. * Default is more long than artifact download.
  90. *
  91. */
  92. private int remoteDownloadTimeout = 300;
  93. /**
  94. *
  95. * Schedule download of remote index when archiva
  96. * start
  97. * .
  98. */
  99. private boolean downloadRemoteIndexOnStartup = false;
  100. /**
  101. * Field extraParameters.
  102. */
  103. private java.util.Map extraParameters;
  104. /**
  105. * Field extraHeaders.
  106. */
  107. private java.util.Map extraHeaders;
  108. /**
  109. * The path to check the repository availability (relative to
  110. * the repository URL). Some repositories do not allow
  111. * browsing, so a certain artifact must be checked.
  112. */
  113. private String checkPath;
  114. //-----------/
  115. //- Methods -/
  116. //-----------/
  117. /**
  118. * Method addExtraHeader.
  119. *
  120. * @param key
  121. * @param value
  122. */
  123. public void addExtraHeader( Object key, String value )
  124. {
  125. getExtraHeaders().put( key, value );
  126. } //-- void addExtraHeader( Object, String )
  127. /**
  128. * Method addExtraParameter.
  129. *
  130. * @param key
  131. * @param value
  132. */
  133. public void addExtraParameter( Object key, String value )
  134. {
  135. getExtraParameters().put( key, value );
  136. } //-- void addExtraParameter( Object, String )
  137. /**
  138. * Get the path to check the repository availability (relative
  139. * to the repository URL). Some repositories do not allow
  140. * browsing, so a certain artifact must be checked.
  141. *
  142. * @return String
  143. */
  144. public String getCheckPath()
  145. {
  146. return this.checkPath;
  147. } //-- String getCheckPath()
  148. /**
  149. * Method getExtraHeaders.
  150. *
  151. * @return Map
  152. */
  153. public java.util.Map getExtraHeaders()
  154. {
  155. if ( this.extraHeaders == null )
  156. {
  157. this.extraHeaders = new java.util.HashMap();
  158. }
  159. return this.extraHeaders;
  160. } //-- java.util.Map getExtraHeaders()
  161. /**
  162. * Method getExtraParameters.
  163. *
  164. * @return Map
  165. */
  166. public java.util.Map getExtraParameters()
  167. {
  168. if ( this.extraParameters == null )
  169. {
  170. this.extraParameters = new java.util.HashMap();
  171. }
  172. return this.extraParameters;
  173. } //-- java.util.Map getExtraParameters()
  174. /**
  175. * Get the Password for this repository.
  176. *
  177. * @return String
  178. */
  179. public String getPassword()
  180. {
  181. return this.password;
  182. } //-- String getPassword()
  183. /**
  184. * Get when to run the refresh task.
  185. * Default is every sunday at 8H00.
  186. *
  187. * @return String
  188. */
  189. public String getRefreshCronExpression()
  190. {
  191. return this.refreshCronExpression;
  192. } //-- String getRefreshCronExpression()
  193. /**
  194. * Get id of the networkProxy to use when downloading remote
  195. * index.
  196. *
  197. * @return String
  198. */
  199. public String getRemoteDownloadNetworkProxyId()
  200. {
  201. return this.remoteDownloadNetworkProxyId;
  202. } //-- String getRemoteDownloadNetworkProxyId()
  203. /**
  204. * Get timeout in seconds for download remote index. Default is
  205. * more long than artifact download.
  206. *
  207. * @return int
  208. */
  209. public int getRemoteDownloadTimeout()
  210. {
  211. return this.remoteDownloadTimeout;
  212. } //-- int getRemoteDownloadTimeout()
  213. /**
  214. * Get remote Index Url : if not starting with http will be
  215. * relative to the remote repository url.
  216. *
  217. * @return String
  218. */
  219. public String getRemoteIndexUrl()
  220. {
  221. return this.remoteIndexUrl;
  222. } //-- String getRemoteIndexUrl()
  223. /**
  224. * Get timeout in seconds for connections to this repository.
  225. *
  226. * @return int
  227. */
  228. public int getTimeout()
  229. {
  230. return this.timeout;
  231. } //-- int getTimeout()
  232. /**
  233. * Get the URL for this repository.
  234. *
  235. * @return String
  236. */
  237. public String getUrl()
  238. {
  239. return this.url;
  240. } //-- String getUrl()
  241. /**
  242. * Get the Username for this repository.
  243. *
  244. * @return String
  245. */
  246. public String getUsername()
  247. {
  248. return this.username;
  249. } //-- String getUsername()
  250. /**
  251. * Get activate download of remote index if remoteIndexUrl is
  252. * set too.
  253. *
  254. * @return boolean
  255. */
  256. public boolean isDownloadRemoteIndex()
  257. {
  258. return this.downloadRemoteIndex;
  259. } //-- boolean isDownloadRemoteIndex()
  260. /**
  261. * Get schedule download of remote index when archiva start.
  262. *
  263. * @return boolean
  264. */
  265. public boolean isDownloadRemoteIndexOnStartup()
  266. {
  267. return this.downloadRemoteIndexOnStartup;
  268. } //-- boolean isDownloadRemoteIndexOnStartup()
  269. /**
  270. * Set the path to check the repository availability (relative
  271. * to the repository URL). Some repositories do not allow
  272. * browsing, so a certain artifact must be checked.
  273. *
  274. * @param checkPath
  275. */
  276. public void setCheckPath( String checkPath )
  277. {
  278. this.checkPath = checkPath;
  279. } //-- void setCheckPath( String )
  280. /**
  281. * Set activate download of remote index if remoteIndexUrl is
  282. * set too.
  283. *
  284. * @param downloadRemoteIndex
  285. */
  286. public void setDownloadRemoteIndex( boolean downloadRemoteIndex )
  287. {
  288. this.downloadRemoteIndex = downloadRemoteIndex;
  289. } //-- void setDownloadRemoteIndex( boolean )
  290. /**
  291. * Set schedule download of remote index when archiva start.
  292. *
  293. * @param downloadRemoteIndexOnStartup
  294. */
  295. public void setDownloadRemoteIndexOnStartup( boolean downloadRemoteIndexOnStartup )
  296. {
  297. this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup;
  298. } //-- void setDownloadRemoteIndexOnStartup( boolean )
  299. /**
  300. * Set additional http headers to add to url when requesting
  301. * remote repositories.
  302. *
  303. * @param extraHeaders
  304. */
  305. public void setExtraHeaders( java.util.Map extraHeaders )
  306. {
  307. this.extraHeaders = extraHeaders;
  308. } //-- void setExtraHeaders( java.util.Map )
  309. /**
  310. * Set additionnal request parameters to add to url when
  311. * requesting remote repositories.
  312. *
  313. * @param extraParameters
  314. */
  315. public void setExtraParameters( java.util.Map extraParameters )
  316. {
  317. this.extraParameters = extraParameters;
  318. } //-- void setExtraParameters( java.util.Map )
  319. /**
  320. * Set the Password for this repository.
  321. *
  322. * @param password
  323. */
  324. public void setPassword( String password )
  325. {
  326. this.password = password;
  327. } //-- void setPassword( String )
  328. /**
  329. * Set when to run the refresh task.
  330. * Default is every sunday at 8H00.
  331. *
  332. * @param refreshCronExpression
  333. */
  334. public void setRefreshCronExpression( String refreshCronExpression )
  335. {
  336. this.refreshCronExpression = refreshCronExpression;
  337. } //-- void setRefreshCronExpression( String )
  338. /**
  339. * Set id of the networkProxy to use when downloading remote
  340. * index.
  341. *
  342. * @param remoteDownloadNetworkProxyId
  343. */
  344. public void setRemoteDownloadNetworkProxyId( String remoteDownloadNetworkProxyId )
  345. {
  346. this.remoteDownloadNetworkProxyId = remoteDownloadNetworkProxyId;
  347. } //-- void setRemoteDownloadNetworkProxyId( String )
  348. /**
  349. * Set timeout in seconds for download remote index. Default is
  350. * more long than artifact download.
  351. *
  352. * @param remoteDownloadTimeout
  353. */
  354. public void setRemoteDownloadTimeout( int remoteDownloadTimeout )
  355. {
  356. this.remoteDownloadTimeout = remoteDownloadTimeout;
  357. } //-- void setRemoteDownloadTimeout( int )
  358. /**
  359. * Set remote Index Url : if not starting with http will be
  360. * relative to the remote repository url.
  361. *
  362. * @param remoteIndexUrl
  363. */
  364. public void setRemoteIndexUrl( String remoteIndexUrl )
  365. {
  366. this.remoteIndexUrl = remoteIndexUrl;
  367. } //-- void setRemoteIndexUrl( String )
  368. /**
  369. * Set timeout in seconds for connections to this repository.
  370. *
  371. * @param timeout
  372. */
  373. public void setTimeout( int timeout )
  374. {
  375. this.timeout = timeout;
  376. } //-- void setTimeout( int )
  377. /**
  378. * Set the URL for this repository.
  379. *
  380. * @param url
  381. */
  382. public void setUrl( String url )
  383. {
  384. this.url = url;
  385. } //-- void setUrl( String )
  386. /**
  387. * Set the Username for this repository.
  388. *
  389. * @param username
  390. */
  391. public void setUsername( String username )
  392. {
  393. this.username = username;
  394. } //-- void setUsername( String )
  395. public String toString()
  396. {
  397. return "RemoteRepositoryConfiguration id:'" + getId() + "',name:'" + getName() +"'";
  398. }
  399. }