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

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