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