Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RepositoryBase |
|
| 1.3636363636363635;1.364 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package org.apache.maven.model; | |
6 | ||
7 | //---------------------------------/ | |
8 | //- Imported classes and packages -/ | |
9 | //---------------------------------/ | |
10 | ||
11 | import java.util.Date; | |
12 | ||
13 | /** | |
14 | * A repository contains the information needed for establishing | |
15 | * connections with | |
16 | * remote repository. | |
17 | * | |
18 | * @version $Revision$ $Date$ | |
19 | */ | |
20 | 0 | public class RepositoryBase implements java.io.Serializable { |
21 | ||
22 | ||
23 | //--------------------------/ | |
24 | //- Class/Member Variables -/ | |
25 | //--------------------------/ | |
26 | ||
27 | /** | |
28 | * | |
29 | * | |
30 | * A unique identifier for a repository. This is | |
31 | * used to match the repository | |
32 | * to configuration in the | |
33 | * <code>settings.xml</code> file, for example. | |
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 | 0 | private String layout = "default"; |
65 | ||
66 | ||
67 | //-----------/ | |
68 | //- Methods -/ | |
69 | //-----------/ | |
70 | ||
71 | /** | |
72 | * Get | |
73 | * | |
74 | * A unique identifier for a repository. This is | |
75 | * used to match the repository | |
76 | * to configuration in the | |
77 | * <code>settings.xml</code> file, for example. | |
78 | * | |
79 | * | |
80 | * | |
81 | * @return String | |
82 | */ | |
83 | public String getId() | |
84 | { | |
85 | 0 | return this.id; |
86 | } //-- String getId() | |
87 | ||
88 | /** | |
89 | * Get | |
90 | * | |
91 | * The type of layout this repository uses for | |
92 | * locating and storing artifacts - | |
93 | * can be <code>legacy</code> or | |
94 | * <code>default</code>. | |
95 | * | |
96 | * | |
97 | * | |
98 | * @return String | |
99 | */ | |
100 | public String getLayout() | |
101 | { | |
102 | 0 | return this.layout; |
103 | } //-- String getLayout() | |
104 | ||
105 | /** | |
106 | * Get human readable name of the repository. | |
107 | * | |
108 | * @return String | |
109 | */ | |
110 | public String getName() | |
111 | { | |
112 | 0 | return this.name; |
113 | } //-- String getName() | |
114 | ||
115 | /** | |
116 | * Get | |
117 | * | |
118 | * The url of the repository, in the form | |
119 | * <code>protocol://hostname/path</code>. | |
120 | * | |
121 | * | |
122 | * | |
123 | * @return String | |
124 | */ | |
125 | public String getUrl() | |
126 | { | |
127 | 0 | return this.url; |
128 | } //-- String getUrl() | |
129 | ||
130 | /** | |
131 | * Set | |
132 | * | |
133 | * A unique identifier for a repository. This is | |
134 | * used to match the repository | |
135 | * to configuration in the | |
136 | * <code>settings.xml</code> file, for example. | |
137 | * | |
138 | * | |
139 | * | |
140 | * @param id | |
141 | */ | |
142 | public void setId( String id ) | |
143 | { | |
144 | 0 | this.id = id; |
145 | 0 | } //-- void setId( String ) |
146 | ||
147 | /** | |
148 | * Set | |
149 | * | |
150 | * The type of layout this repository uses for | |
151 | * locating and storing artifacts - | |
152 | * can be <code>legacy</code> or | |
153 | * <code>default</code>. | |
154 | * | |
155 | * | |
156 | * | |
157 | * @param layout | |
158 | */ | |
159 | public void setLayout( String layout ) | |
160 | { | |
161 | 0 | this.layout = layout; |
162 | 0 | } //-- void setLayout( String ) |
163 | ||
164 | /** | |
165 | * Set human readable name of the repository. | |
166 | * | |
167 | * @param name | |
168 | */ | |
169 | public void setName( String name ) | |
170 | { | |
171 | 0 | this.name = name; |
172 | 0 | } //-- void setName( String ) |
173 | ||
174 | /** | |
175 | * Set | |
176 | * | |
177 | * The url of the repository, in the form | |
178 | * <code>protocol://hostname/path</code>. | |
179 | * | |
180 | * | |
181 | * | |
182 | * @param url | |
183 | */ | |
184 | public void setUrl( String url ) | |
185 | { | |
186 | 0 | this.url = url; |
187 | 0 | } //-- void setUrl( String ) |
188 | ||
189 | ||
190 | ||
191 | /** | |
192 | * @see java.lang.Object#equals(java.lang.Object) | |
193 | */ | |
194 | public boolean equals( Object obj ) | |
195 | { | |
196 | 0 | if ( obj instanceof RepositoryBase ) { |
197 | ||
198 | 0 | final RepositoryBase other = (RepositoryBase) obj; |
199 | ||
200 | 0 | if ( id != null ) |
201 | { | |
202 | 0 | return id.equals( other.id ); |
203 | } | |
204 | 0 | return super.equals(obj); |
205 | } | |
206 | ||
207 | 0 | return false; |
208 | } | |
209 | ||
210 | ||
211 | 0 | private String modelEncoding = "UTF-8"; |
212 | ||
213 | /** | |
214 | * Set an encoding used for reading/writing the model. | |
215 | * | |
216 | * @param modelEncoding the encoding used when reading/writing the model. | |
217 | */ | |
218 | public void setModelEncoding( String modelEncoding ) | |
219 | { | |
220 | 0 | this.modelEncoding = modelEncoding; |
221 | 0 | } |
222 | ||
223 | /** | |
224 | * @return the current encoding used when reading/writing this model. | |
225 | */ | |
226 | public String getModelEncoding() | |
227 | { | |
228 | 0 | return modelEncoding; |
229 | } | |
230 | } |