Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ChangeLog |
|
| 1.0;1 |
1 | package org.apache.maven.plugin.changelog; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import java.io.IOException; | |
23 | import java.io.InputStream; | |
24 | import java.io.Reader; | |
25 | import java.util.ArrayList; | |
26 | import java.util.List; | |
27 | ||
28 | import javax.xml.parsers.ParserConfigurationException; | |
29 | import javax.xml.parsers.SAXParser; | |
30 | import javax.xml.parsers.SAXParserFactory; | |
31 | ||
32 | import org.xml.sax.InputSource; | |
33 | import org.xml.sax.SAXException; | |
34 | ||
35 | /** | |
36 | * Change log task. It uses a ChangeLogGenerator and ChangeLogParser to create | |
37 | * a Collection of ChangeLogEntry objects, which are used to produce an XML | |
38 | * output that represents the list of changes. | |
39 | * | |
40 | * @author <a href="mailto:glenn@somanetworks.com">Glenn McAllister</a> | |
41 | * @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a> | |
42 | * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a> | |
43 | * @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a> | |
44 | * @author <a href="mailto:bodewig@apache.org">Stefan Bodewig</a> | |
45 | * @author <a href="mailto:peter@apache.org">Peter Donald</a> | |
46 | * @version $Id:ChangeLog.java 437762 2006-08-28 19:29:49 +0200 (må, 28 aug 2006) dennisl $ | |
47 | */ | |
48 | 0 | public class ChangeLog |
49 | { | |
50 | /** | |
51 | * parses a previously generated changelog xml document and return its changed sets | |
52 | * | |
53 | * @param stream the changelog xml document | |
54 | * @return changelog sets parsed from the xml document | |
55 | * @throws ParserConfigurationException when instantiation of the SAX parser failed | |
56 | * @throws SAXException when an error occurred while parsing the xml document | |
57 | * @throws IOException when an error occurred while accessing the xml document | |
58 | */ | |
59 | public static List loadChangedSets( InputStream stream ) | |
60 | throws ParserConfigurationException, SAXException, IOException | |
61 | { | |
62 | 4 | SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); |
63 | ||
64 | 4 | List changeLogSets = new ArrayList(); |
65 | ||
66 | 4 | parser.parse( stream, new ChangeLogHandler( changeLogSets ) ); |
67 | ||
68 | 4 | return changeLogSets; |
69 | } | |
70 | ||
71 | public static List loadChangedSets( Reader reader ) | |
72 | throws ParserConfigurationException, SAXException, IOException | |
73 | { | |
74 | 40 | SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); |
75 | ||
76 | 40 | List changeLogSets = new ArrayList(); |
77 | ||
78 | 40 | parser.parse( new InputSource( reader ), new ChangeLogHandler( changeLogSets ) ); |
79 | ||
80 | 40 | return changeLogSets; |
81 | } | |
82 | ||
83 | } // end of ChangeLog |