This project has retired. For details please refer to its Attic page.
RemoteRepositoryConfiguration xref
View Javadoc
1   package org.apache.archiva.configuration;
2   
3   /*
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
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  /**
23   * Class RemoteRepositoryConfiguration.
24   * 
25   * @version $Revision$ $Date$
26   */
27  @SuppressWarnings( "all" )
28  public class RemoteRepositoryConfiguration
29      extends AbstractRepositoryConfiguration
30      implements java.io.Serializable
31  {
32  
33        //--------------------------/
34       //- Class/Member Variables -/
35      //--------------------------/
36  
37      /**
38       * 
39       *             The URL for this repository.
40       *           
41       */
42      private String url;
43  
44      /**
45       * 
46       *             The Username for this repository.
47       *           
48       */
49      private String username;
50  
51      /**
52       * 
53       *             The Password for this repository.
54       *           
55       */
56      private String password;
57  
58      /**
59       * 
60       *             Timeout in seconds for connections to this
61       * repository
62       *           .
63       */
64      private int timeout = 60;
65  
66      /**
67       * 
68       *             When to run the refresh task.
69       *             Default is every sunday at 8H00.
70       *           
71       */
72      private String refreshCronExpression = "0 0 08 ? * SUN";
73  
74      /**
75       * 
76       *             Activate download of remote index if
77       * remoteIndexUrl is set too.
78       *           
79       */
80      private boolean downloadRemoteIndex = false;
81  
82      /**
83       * 
84       *             Remote Index Url : if not starting with http
85       * will be relative to the remote repository url.
86       *           
87       */
88      private String remoteIndexUrl;
89  
90      /**
91       * 
92       *             Id of the networkProxy to use when downloading
93       * remote index.
94       *           
95       */
96      private String remoteDownloadNetworkProxyId;
97  
98      /**
99       * 
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 }