View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   // Generated by Modello 2.1.2,
3   // any modifications will be overwritten.
4   // ==============================================================
5   
6   package org.apache.maven.model;
7   
8   /**
9    * A repository contains the information needed for establishing
10   * connections with
11   *         remote repository.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings( "all" )
16  public class RepositoryBase
17      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
18  {
19  
20        //--------------------------/
21       //- Class/Member Variables -/
22      //--------------------------/
23  
24      /**
25       * 
26       *             
27       *             A unique identifier for a repository. This is
28       * used to match the repository
29       *             to configuration in the
30       * <code>settings.xml</code> file, for example. Furthermore,
31       * the identifier is
32       *             used during POM inheritance and profile
33       * injection to detect repositories that should be merged.
34       *             
35       *           
36       */
37      private String id;
38  
39      /**
40       * Human readable name of the repository.
41       */
42      private String name;
43  
44      /**
45       * 
46       *             
47       *             The url of the repository, in the form
48       * <code>protocol://hostname/path</code>.
49       *             
50       *           
51       */
52      private String url;
53  
54      /**
55       * 
56       *             
57       *             The type of layout this repository uses for
58       * locating and storing artifacts -
59       *             can be <code>legacy</code> or
60       * <code>default</code>.
61       *             
62       *           
63       */
64      private String layout = "default";
65  
66      /**
67       * Field locations.
68       */
69      private java.util.Map<Object, InputLocation> locations;
70  
71      /**
72       * Field location.
73       */
74      private InputLocation location;
75  
76      /**
77       * Field idLocation.
78       */
79      private InputLocation idLocation;
80  
81      /**
82       * Field nameLocation.
83       */
84      private InputLocation nameLocation;
85  
86      /**
87       * Field urlLocation.
88       */
89      private InputLocation urlLocation;
90  
91      /**
92       * Field layoutLocation.
93       */
94      private InputLocation layoutLocation;
95  
96  
97        //-----------/
98       //- Methods -/
99      //-----------/
100 
101     /**
102      * Method clone.
103      * 
104      * @return RepositoryBase
105      */
106     public RepositoryBase clone()
107     {
108         try
109         {
110             RepositoryBase copy = (RepositoryBase) super.clone();
111 
112             if ( copy.locations != null )
113             {
114                 copy.locations = new java.util.LinkedHashMap( copy.locations );
115             }
116 
117             return copy;
118         }
119         catch ( java.lang.Exception ex )
120         {
121             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
122                 + " does not support clone()" ).initCause( ex );
123         }
124     } //-- RepositoryBase clone()
125 
126     /**
127      * Method equals.
128      * 
129      * @param other a other object.
130      * @return boolean
131      */
132     public boolean equals( Object other )
133     {
134         if ( this == other )
135         {
136             return true;
137         }
138 
139         if ( !( other instanceof RepositoryBase ) )
140         {
141             return false;
142         }
143 
144         RepositoryBase that = (RepositoryBase) other;
145         boolean result = true;
146 
147         result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
148 
149         return result;
150     } //-- boolean equals( Object )
151 
152     /**
153      * Get a unique identifier for a repository. This is used to
154      * match the repository
155      *             to configuration in the
156      * <code>settings.xml</code> file, for example. Furthermore,
157      * the identifier is
158      *             used during POM inheritance and profile
159      * injection to detect repositories that should be merged.
160      * 
161      * @return String
162      */
163     public String getId()
164     {
165         return this.id;
166     } //-- String getId()
167 
168     /**
169      * Get the type of layout this repository uses for locating and
170      * storing artifacts -
171      *             can be <code>legacy</code> or
172      * <code>default</code>.
173      * 
174      * @return String
175      */
176     public String getLayout()
177     {
178         return this.layout;
179     } //-- String getLayout()
180 
181     /**
182      * 
183      * 
184      * @param key a key object.
185      * @return InputLocation
186      */
187     public InputLocation getLocation( Object key )
188     {
189         if ( key instanceof String )
190         {
191             switch ( ( String ) key )
192             {
193                 case "" :
194                 {
195                     return this.location;
196                 }
197                 case "id" :
198                 {
199                     return idLocation;
200                 }
201                 case "name" :
202                 {
203                     return nameLocation;
204                 }
205                 case "url" :
206                 {
207                     return urlLocation;
208                 }
209                 case "layout" :
210                 {
211                     return layoutLocation;
212                 }
213                 default :
214                 {
215                     return getOtherLocation( key );
216                 }
217                 }
218             }
219             else
220             {
221                 return getOtherLocation( key );
222             }
223     } //-- InputLocation getLocation( Object )
224 
225     /**
226      * Get human readable name of the repository.
227      * 
228      * @return String
229      */
230     public String getName()
231     {
232         return this.name;
233     } //-- String getName()
234 
235     /**
236      * 
237      * 
238      * @param key a key object.
239      * @param location a location object.
240      */
241     public void setLocation( Object key, InputLocation location )
242     {
243         if ( key instanceof String )
244         {
245             switch ( ( String ) key )
246             {
247                 case "" :
248                 {
249                     this.location = location;
250                     return;
251                 }
252                 case "id" :
253                 {
254                     idLocation = location;
255                     return;
256                 }
257                 case "name" :
258                 {
259                     nameLocation = location;
260                     return;
261                 }
262                 case "url" :
263                 {
264                     urlLocation = location;
265                     return;
266                 }
267                 case "layout" :
268                 {
269                     layoutLocation = location;
270                     return;
271                 }
272                 default :
273                 {
274                     setOtherLocation( key, location );
275                     return;
276                 }
277             }
278         }
279         else
280         {
281             setOtherLocation( key, location );
282         }
283     } //-- void setLocation( Object, InputLocation )
284 
285     /**
286      * 
287      * 
288      * @param key a key object.
289      * @param location a location object.
290      */
291     public void setOtherLocation( Object key, InputLocation location )
292     {
293         if ( location != null )
294         {
295             if ( this.locations == null )
296             {
297                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
298             }
299             this.locations.put( key, location );
300         }
301     } //-- void setOtherLocation( Object, InputLocation )
302 
303     /**
304      * 
305      * 
306      * @param key a key object.
307      * @return InputLocation
308      */
309     private InputLocation getOtherLocation( Object key )
310     {
311         return ( locations != null ) ? locations.get( key ) : null;
312     } //-- InputLocation getOtherLocation( Object )
313 
314     /**
315      * Get the url of the repository, in the form
316      * <code>protocol://hostname/path</code>.
317      * 
318      * @return String
319      */
320     public String getUrl()
321     {
322         return this.url;
323     } //-- String getUrl()
324 
325     /**
326      * Method hashCode.
327      * 
328      * @return int
329      */
330     public int hashCode()
331     {
332         int result = 17;
333 
334         result = 37 * result + ( id != null ? id.hashCode() : 0 );
335 
336         return result;
337     } //-- int hashCode()
338 
339     /**
340      * Set a unique identifier for a repository. This is used to
341      * match the repository
342      *             to configuration in the
343      * <code>settings.xml</code> file, for example. Furthermore,
344      * the identifier is
345      *             used during POM inheritance and profile
346      * injection to detect repositories that should be merged.
347      * 
348      * @param id a id object.
349      */
350     public void setId( String id )
351     {
352         this.id = id;
353     } //-- void setId( String )
354 
355     /**
356      * Set the type of layout this repository uses for locating and
357      * storing artifacts -
358      *             can be <code>legacy</code> or
359      * <code>default</code>.
360      * 
361      * @param layout a layout object.
362      */
363     public void setLayout( String layout )
364     {
365         this.layout = layout;
366     } //-- void setLayout( String )
367 
368     /**
369      * Set human readable name of the repository.
370      * 
371      * @param name a name object.
372      */
373     public void setName( String name )
374     {
375         this.name = name;
376     } //-- void setName( String )
377 
378     /**
379      * Set the url of the repository, in the form
380      * <code>protocol://hostname/path</code>.
381      * 
382      * @param url a url object.
383      */
384     public void setUrl( String url )
385     {
386         this.url = url;
387     } //-- void setUrl( String )
388 
389     /**
390      * Method toString.
391      * 
392      * @return String
393      */
394     public java.lang.String toString()
395     {
396         StringBuilder buf = new StringBuilder( 128 );
397 
398         buf.append( "id = '" );
399         buf.append( getId() );
400         buf.append( "'" );
401 
402         return buf.toString();
403     } //-- java.lang.String toString()
404 
405 }