Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Notifier |
|
| 1.0588235294117647;1.059 |
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 | * Configures one method for notifying users/developers when a | |
15 | * build breaks. | |
16 | * | |
17 | * @version $Revision$ $Date$ | |
18 | */ | |
19 | 0 | public class Notifier implements java.io.Serializable { |
20 | ||
21 | ||
22 | //--------------------------/ | |
23 | //- Class/Member Variables -/ | |
24 | //--------------------------/ | |
25 | ||
26 | /** | |
27 | * The mechanism used to deliver notifications. | |
28 | */ | |
29 | 0 | private String type = "mail"; |
30 | ||
31 | /** | |
32 | * Whether to send notifications on error. | |
33 | */ | |
34 | 0 | private boolean sendOnError = true; |
35 | ||
36 | /** | |
37 | * Whether to send notifications on failure. | |
38 | */ | |
39 | 0 | private boolean sendOnFailure = true; |
40 | ||
41 | /** | |
42 | * Whether to send notifications on success. | |
43 | */ | |
44 | 0 | private boolean sendOnSuccess = true; |
45 | ||
46 | /** | |
47 | * Whether to send notifications on warning. | |
48 | */ | |
49 | 0 | private boolean sendOnWarning = true; |
50 | ||
51 | /** | |
52 | * | |
53 | * | |
54 | * <b>Deprecated</b>. Where to send the | |
55 | * notification to - eg email address. | |
56 | * | |
57 | * | |
58 | */ | |
59 | private String address; | |
60 | ||
61 | /** | |
62 | * Field configuration. | |
63 | */ | |
64 | private java.util.Properties configuration; | |
65 | ||
66 | ||
67 | //-----------/ | |
68 | //- Methods -/ | |
69 | //-----------/ | |
70 | ||
71 | /** | |
72 | * Method addConfiguration. | |
73 | * | |
74 | * @param key | |
75 | * @param value | |
76 | */ | |
77 | public void addConfiguration( String key, String value ) | |
78 | { | |
79 | 0 | getConfiguration().put( key, value ); |
80 | 0 | } //-- void addConfiguration( String, String ) |
81 | ||
82 | /** | |
83 | * Get | |
84 | * | |
85 | * <b>Deprecated</b>. Where to send the | |
86 | * notification to - eg email address. | |
87 | * | |
88 | * | |
89 | * | |
90 | * @return String | |
91 | */ | |
92 | public String getAddress() | |
93 | { | |
94 | 0 | return this.address; |
95 | } //-- String getAddress() | |
96 | ||
97 | /** | |
98 | * Method getConfiguration. | |
99 | * | |
100 | * @return java.util.Properties | |
101 | */ | |
102 | public java.util.Properties getConfiguration() | |
103 | { | |
104 | 0 | if ( this.configuration == null ) |
105 | { | |
106 | 0 | this.configuration = new java.util.Properties(); |
107 | } | |
108 | ||
109 | 0 | return this.configuration; |
110 | } //-- java.util.Properties getConfiguration() | |
111 | ||
112 | /** | |
113 | * Get the mechanism used to deliver notifications. | |
114 | * | |
115 | * @return String | |
116 | */ | |
117 | public String getType() | |
118 | { | |
119 | 0 | return this.type; |
120 | } //-- String getType() | |
121 | ||
122 | /** | |
123 | * Get whether to send notifications on error. | |
124 | * | |
125 | * @return boolean | |
126 | */ | |
127 | public boolean isSendOnError() | |
128 | { | |
129 | 0 | return this.sendOnError; |
130 | } //-- boolean isSendOnError() | |
131 | ||
132 | /** | |
133 | * Get whether to send notifications on failure. | |
134 | * | |
135 | * @return boolean | |
136 | */ | |
137 | public boolean isSendOnFailure() | |
138 | { | |
139 | 0 | return this.sendOnFailure; |
140 | } //-- boolean isSendOnFailure() | |
141 | ||
142 | /** | |
143 | * Get whether to send notifications on success. | |
144 | * | |
145 | * @return boolean | |
146 | */ | |
147 | public boolean isSendOnSuccess() | |
148 | { | |
149 | 0 | return this.sendOnSuccess; |
150 | } //-- boolean isSendOnSuccess() | |
151 | ||
152 | /** | |
153 | * Get whether to send notifications on warning. | |
154 | * | |
155 | * @return boolean | |
156 | */ | |
157 | public boolean isSendOnWarning() | |
158 | { | |
159 | 0 | return this.sendOnWarning; |
160 | } //-- boolean isSendOnWarning() | |
161 | ||
162 | /** | |
163 | * Set | |
164 | * | |
165 | * <b>Deprecated</b>. Where to send the | |
166 | * notification to - eg email address. | |
167 | * | |
168 | * | |
169 | * | |
170 | * @param address | |
171 | */ | |
172 | public void setAddress( String address ) | |
173 | { | |
174 | 0 | this.address = address; |
175 | 0 | } //-- void setAddress( String ) |
176 | ||
177 | /** | |
178 | * Set extended configuration specific to this notifier goes | |
179 | * here. | |
180 | * | |
181 | * @param configuration | |
182 | */ | |
183 | public void setConfiguration( java.util.Properties configuration ) | |
184 | { | |
185 | 0 | this.configuration = configuration; |
186 | 0 | } //-- void setConfiguration( java.util.Properties ) |
187 | ||
188 | /** | |
189 | * Set whether to send notifications on error. | |
190 | * | |
191 | * @param sendOnError | |
192 | */ | |
193 | public void setSendOnError( boolean sendOnError ) | |
194 | { | |
195 | 0 | this.sendOnError = sendOnError; |
196 | 0 | } //-- void setSendOnError( boolean ) |
197 | ||
198 | /** | |
199 | * Set whether to send notifications on failure. | |
200 | * | |
201 | * @param sendOnFailure | |
202 | */ | |
203 | public void setSendOnFailure( boolean sendOnFailure ) | |
204 | { | |
205 | 0 | this.sendOnFailure = sendOnFailure; |
206 | 0 | } //-- void setSendOnFailure( boolean ) |
207 | ||
208 | /** | |
209 | * Set whether to send notifications on success. | |
210 | * | |
211 | * @param sendOnSuccess | |
212 | */ | |
213 | public void setSendOnSuccess( boolean sendOnSuccess ) | |
214 | { | |
215 | 0 | this.sendOnSuccess = sendOnSuccess; |
216 | 0 | } //-- void setSendOnSuccess( boolean ) |
217 | ||
218 | /** | |
219 | * Set whether to send notifications on warning. | |
220 | * | |
221 | * @param sendOnWarning | |
222 | */ | |
223 | public void setSendOnWarning( boolean sendOnWarning ) | |
224 | { | |
225 | 0 | this.sendOnWarning = sendOnWarning; |
226 | 0 | } //-- void setSendOnWarning( boolean ) |
227 | ||
228 | /** | |
229 | * Set the mechanism used to deliver notifications. | |
230 | * | |
231 | * @param type | |
232 | */ | |
233 | public void setType( String type ) | |
234 | { | |
235 | 0 | this.type = type; |
236 | 0 | } //-- void setType( String ) |
237 | ||
238 | ||
239 | 0 | private String modelEncoding = "UTF-8"; |
240 | ||
241 | /** | |
242 | * Set an encoding used for reading/writing the model. | |
243 | * | |
244 | * @param modelEncoding the encoding used when reading/writing the model. | |
245 | */ | |
246 | public void setModelEncoding( String modelEncoding ) | |
247 | { | |
248 | 0 | this.modelEncoding = modelEncoding; |
249 | 0 | } |
250 | ||
251 | /** | |
252 | * @return the current encoding used when reading/writing this model. | |
253 | */ | |
254 | public String getModelEncoding() | |
255 | { | |
256 | 0 | return modelEncoding; |
257 | } | |
258 | } |