1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck.maven;
19
20 import java.io.IOException;
21 import java.io.OutputStream;
22 import java.io.OutputStreamWriter;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.apache.maven.doxia.logging.Log;
26 import org.apache.maven.doxia.sink.Sink;
27 import org.apache.maven.doxia.sink.SinkEventAttributes;
28
29
30
31
32
33 public class MySink implements Sink {
34
35 private OutputStreamWriter out = null;
36
37 public MySink(OutputStream os) {
38 out = new OutputStreamWriter(os);
39
40 }
41
42 private void writeTag(String tag) {
43 try {
44 out.write(tag);
45 } catch (IOException ex) {
46 Logger.getLogger(MySink.class.getName()).log(Level.SEVERE, "Error writing a tag; unable to generate the report");
47 Logger.getLogger(MySink.class.getName()).log(Level.FINE, null, ex);
48 }
49 }
50
51 public void head() {
52 writeTag("<head>");
53 }
54
55 public void head_() {
56 writeTag("</head>");
57 }
58
59 public void title() {
60 writeTag("<title>");
61 }
62
63 public void title_() {
64 writeTag("</title>");
65 }
66
67 public void author() {
68 writeTag("<author>");
69 }
70
71 public void author_() {
72 writeTag("</author>");
73 }
74
75 public void date() {
76 writeTag("<time>");
77 }
78
79 public void date_() {
80 writeTag("</time>");
81 }
82
83 public void body() {
84 writeTag("<body>");
85 }
86
87 public void body_() {
88 writeTag("</body>");
89 }
90
91 public void sectionTitle() {
92 writeTag("<h1>");
93 }
94
95 public void sectionTitle_() {
96 writeTag("</h1>");
97 }
98
99 public void section1() {
100 writeTag("<div>");
101 }
102
103 public void section1_() {
104 writeTag("</div>");
105 }
106
107 public void sectionTitle1() {
108 writeTag("<h2>");
109 }
110
111 public void sectionTitle1_() {
112 writeTag("</h2>");
113 }
114
115 public void section2() {
116 writeTag("<div>");
117 }
118
119 public void section2_() {
120 writeTag("</div>");
121 }
122
123 public void sectionTitle2() {
124 writeTag("<h3>");
125 }
126
127 public void sectionTitle2_() {
128 writeTag("</h3>");
129 }
130
131 public void section3() {
132 writeTag("<div>");
133 }
134
135 public void section3_() {
136 writeTag("</div>");
137 }
138
139 public void sectionTitle3() {
140 writeTag("<h4>");
141 }
142
143 public void sectionTitle3_() {
144 writeTag("</h4>");
145 }
146
147 public void section4() {
148 writeTag("<div>");
149 }
150
151 public void section4_() {
152 writeTag("</div>");
153 }
154
155 public void sectionTitle4() {
156 writeTag("<h5>");
157 }
158
159 public void sectionTitle4_() {
160 writeTag("</h5>");
161 }
162
163 public void section5() {
164 writeTag("<div>");
165 }
166
167 public void section5_() {
168 writeTag("</div>");
169 }
170
171 public void sectionTitle5() {
172 writeTag("<h6>");
173 }
174
175 public void sectionTitle5_() {
176 writeTag("</h6>");
177 }
178
179 public void list() {
180 writeTag("<ul>");
181 }
182
183 public void list_() {
184 writeTag("</ul>");
185 }
186
187 public void listItem() {
188 writeTag("<li>");
189 }
190
191 public void listItem_() {
192 writeTag("</li>");
193 }
194
195 public void numberedList(int numbering) {
196 writeTag("<ol>");
197 }
198
199 public void numberedList_() {
200 writeTag("</ol>");
201 }
202
203 public void numberedListItem() {
204 writeTag("<li>");
205 }
206
207 public void numberedListItem_() {
208 writeTag("</li>");
209 }
210
211 public void definitionList() {
212 writeTag("<dl>");
213 }
214
215 public void definitionList_() {
216 writeTag("</dl>");
217 }
218
219 public void definitionListItem() {
220 writeTag("<dt>");
221 }
222
223 public void definitionListItem_() {
224 writeTag("</dt>");
225 }
226
227 public void definition() {
228 writeTag("<dd>");
229 }
230
231 public void definition_() {
232 writeTag("</dd>");
233 }
234
235 public void definedTerm() {
236 writeTag("<dt>");
237 }
238
239 public void definedTerm_() {
240 writeTag("</dt>");
241 }
242
243 public void figure() {
244 throw new UnsupportedOperationException("Not supported yet.");
245 }
246
247 public void figure_() {
248 throw new UnsupportedOperationException("Not supported yet.");
249 }
250
251 public void figureCaption() {
252 throw new UnsupportedOperationException("Not supported yet.");
253 }
254
255 public void figureCaption_() {
256 throw new UnsupportedOperationException("Not supported yet.");
257 }
258
259 public void figureGraphics(String name) {
260 throw new UnsupportedOperationException("Not supported yet.");
261 }
262
263 public void table() {
264 writeTag("<table>");
265 }
266
267 public void table_() {
268 writeTag("</table>");
269 }
270
271 public void tableRows(int[] justification, boolean grid) {
272 writeTag("<tr>");
273 }
274
275 public void tableRows_() {
276 writeTag("</tr>");
277 }
278
279 public void tableRow() {
280 writeTag("<tr>");
281 }
282
283 public void tableRow_() {
284 writeTag("</tr>");
285 }
286
287 public void tableCell() {
288 writeTag("<td>");
289 }
290
291 public void tableCell(String width) {
292 writeTag("<td>");
293 }
294
295 public void tableCell_() {
296 writeTag("</td>");
297 }
298
299 public void tableHeaderCell() {
300 writeTag("<th>");
301 }
302
303 public void tableHeaderCell(String width) {
304 writeTag("<th>");
305 }
306
307 public void tableHeaderCell_() {
308 writeTag("</th>");
309 }
310
311 public void tableCaption() {
312 writeTag("<caption>");
313 }
314
315 public void tableCaption_() {
316 writeTag("</caption>");
317 }
318
319 public void paragraph() {
320 writeTag("<p>");
321 }
322
323 public void paragraph_() {
324 writeTag("</p>");
325 }
326
327 public void verbatim(boolean boxed) {
328 writeTag("<pre>");
329 }
330
331 public void verbatim_() {
332 writeTag("</pre>");
333 }
334
335 public void horizontalRule() {
336 writeTag("<hr/>");
337 }
338
339 public void pageBreak() {
340 writeTag("<br/>");
341 }
342
343 public void anchor(String name) {
344 writeTag("<a href=\"" + name + "\">");
345 }
346
347 public void anchor_() {
348 writeTag("</a>");
349 }
350
351 public void link(String name) {
352 writeTag("<link href=\"" + name + "\">");
353 }
354
355 public void link_() {
356 writeTag("</link>");
357 }
358
359 public void italic() {
360 writeTag("<i>");
361 }
362
363 public void italic_() {
364 writeTag("</i>");
365 }
366
367 public void bold() {
368 writeTag("<b>");
369 }
370
371 public void bold_() {
372 writeTag("</b>");
373 }
374
375 public void monospaced() {
376 writeTag("<pre>");
377 }
378
379 public void monospaced_() {
380 writeTag("</pre>");
381 }
382
383 public void lineBreak() {
384 writeTag("<br>");
385 }
386
387 public void nonBreakingSpace() {
388 writeTag(" ");
389 }
390
391 public void text(String text) {
392 try {
393
394 out.write(text);
395 } catch (IOException ex) {
396 Logger.getLogger(MySink.class.getName()).log(Level.SEVERE, "Error writing a text; unable to generate the report");
397 Logger.getLogger(MySink.class.getName()).log(Level.FINE, null, ex);
398 }
399 }
400
401 public void rawText(String text) {
402 try {
403 out.write(text);
404 } catch (IOException ex) {
405 Logger.getLogger(MySink.class.getName()).log(Level.SEVERE, "Error writing raw text; unable to generate the report");
406 Logger.getLogger(MySink.class.getName()).log(Level.FINE, null, ex);
407 }
408 }
409
410 public void flush() {
411 try {
412 out.flush();
413 } catch (IOException ex) {
414 Logger.getLogger(MySink.class.getName()).log(Level.FINEST, null, ex);
415 }
416 }
417
418 public void close() {
419 flush();
420 try {
421 out.close();
422 } catch (IOException ex) {
423 Logger.getLogger(MySink.class.getName()).log(Level.FINEST, null, ex);
424 }
425 }
426
427 @Override
428 public void head(SinkEventAttributes sea) {
429 throw new UnsupportedOperationException("Not supported yet.");
430 }
431
432 @Override
433 public void title(SinkEventAttributes sea) {
434 throw new UnsupportedOperationException("Not supported yet.");
435 }
436
437 @Override
438 public void author(SinkEventAttributes sea) {
439 throw new UnsupportedOperationException("Not supported yet.");
440 }
441
442 @Override
443 public void date(SinkEventAttributes sea) {
444 throw new UnsupportedOperationException("Not supported yet.");
445 }
446
447 @Override
448 public void body(SinkEventAttributes sea) {
449 throw new UnsupportedOperationException("Not supported yet.");
450 }
451
452 @Override
453 public void section(int i, SinkEventAttributes sea) {
454 throw new UnsupportedOperationException("Not supported yet.");
455 }
456
457 @Override
458 public void section_(int i) {
459 throw new UnsupportedOperationException("Not supported yet.");
460 }
461
462 @Override
463 public void sectionTitle(int i, SinkEventAttributes sea) {
464 throw new UnsupportedOperationException("Not supported yet.");
465 }
466
467 @Override
468 public void sectionTitle_(int i) {
469 throw new UnsupportedOperationException("Not supported yet.");
470 }
471
472 @Override
473 public void list(SinkEventAttributes sea) {
474 throw new UnsupportedOperationException("Not supported yet.");
475 }
476
477 @Override
478 public void listItem(SinkEventAttributes sea) {
479 throw new UnsupportedOperationException("Not supported yet.");
480 }
481
482 @Override
483 public void numberedList(int i, SinkEventAttributes sea) {
484 throw new UnsupportedOperationException("Not supported yet.");
485 }
486
487 @Override
488 public void numberedListItem(SinkEventAttributes sea) {
489 throw new UnsupportedOperationException("Not supported yet.");
490 }
491
492 @Override
493 public void definitionList(SinkEventAttributes sea) {
494 throw new UnsupportedOperationException("Not supported yet.");
495 }
496
497 @Override
498 public void definitionListItem(SinkEventAttributes sea) {
499 throw new UnsupportedOperationException("Not supported yet.");
500 }
501
502 @Override
503 public void definition(SinkEventAttributes sea) {
504 throw new UnsupportedOperationException("Not supported yet.");
505 }
506
507 @Override
508 public void definedTerm(SinkEventAttributes sea) {
509 throw new UnsupportedOperationException("Not supported yet.");
510 }
511
512 @Override
513 public void figure(SinkEventAttributes sea) {
514 throw new UnsupportedOperationException("Not supported yet.");
515 }
516
517 @Override
518 public void figureCaption(SinkEventAttributes sea) {
519 throw new UnsupportedOperationException("Not supported yet.");
520 }
521
522 @Override
523 public void figureGraphics(String string, SinkEventAttributes sea) {
524 throw new UnsupportedOperationException("Not supported yet.");
525 }
526
527 @Override
528 public void table(SinkEventAttributes sea) {
529 throw new UnsupportedOperationException("Not supported yet.");
530 }
531
532 @Override
533 public void tableRow(SinkEventAttributes sea) {
534 throw new UnsupportedOperationException("Not supported yet.");
535 }
536
537 @Override
538 public void tableCell(SinkEventAttributes sea) {
539 throw new UnsupportedOperationException("Not supported yet.");
540 }
541
542 @Override
543 public void tableHeaderCell(SinkEventAttributes sea) {
544 throw new UnsupportedOperationException("Not supported yet.");
545 }
546
547 @Override
548 public void tableCaption(SinkEventAttributes sea) {
549 throw new UnsupportedOperationException("Not supported yet.");
550 }
551
552 @Override
553 public void paragraph(SinkEventAttributes sea) {
554 throw new UnsupportedOperationException("Not supported yet.");
555 }
556
557 @Override
558 public void verbatim(SinkEventAttributes sea) {
559 throw new UnsupportedOperationException("Not supported yet.");
560 }
561
562 @Override
563 public void horizontalRule(SinkEventAttributes sea) {
564 throw new UnsupportedOperationException("Not supported yet.");
565 }
566
567 @Override
568 public void anchor(String string, SinkEventAttributes sea) {
569 throw new UnsupportedOperationException("Not supported yet.");
570 }
571
572 @Override
573 public void link(String string, SinkEventAttributes sea) {
574 throw new UnsupportedOperationException("Not supported yet.");
575 }
576
577 @Override
578 public void lineBreak(SinkEventAttributes sea) {
579 throw new UnsupportedOperationException("Not supported yet.");
580 }
581
582 @Override
583 public void text(String string, SinkEventAttributes sea) {
584 throw new UnsupportedOperationException("Not supported yet.");
585 }
586
587 @Override
588 public void comment(String string) {
589 throw new UnsupportedOperationException("Not supported yet.");
590 }
591
592 @Override
593 public void unknown(String string, Object[] os, SinkEventAttributes sea) {
594 throw new UnsupportedOperationException("Not supported yet.");
595 }
596
597 @Override
598 public void enableLogging(Log log) {
599 throw new UnsupportedOperationException("Not supported yet.");
600 }
601 }