1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.artifact.repository.metadata.io.xpp3;
20
21 import javax.xml.stream.XMLStreamException;
22 import javax.xml.stream.XMLStreamReader;
23
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.Reader;
27
28 import org.apache.maven.artifact.repository.metadata.Metadata;
29 import org.apache.maven.metadata.v4.MetadataStaxReader;
30 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
31
32
33
34
35
36
37 @Deprecated
38 public class MetadataXpp3Reader {
39
40 private final MetadataStaxReader delegate;
41
42
43
44
45 public MetadataXpp3Reader() {
46 delegate = new MetadataStaxReader();
47 }
48
49
50
51
52
53
54 public MetadataXpp3Reader(ContentTransformer contentTransformer) {
55 delegate = new MetadataStaxReader(contentTransformer::transform);
56 }
57
58
59
60
61
62
63 public boolean getAddDefaultEntities() {
64 return delegate.getAddDefaultEntities();
65 }
66
67
68
69
70
71
72 public void setAddDefaultEntities(boolean addDefaultEntities) {
73 delegate.setAddDefaultEntities(addDefaultEntities);
74 }
75
76
77
78
79
80
81
82
83
84
85
86 public Metadata read(Reader reader, boolean strict) throws IOException, XmlPullParserException {
87 try {
88 return new Metadata(delegate.read(reader, strict));
89 } catch (XMLStreamException e) {
90 throw new XmlPullParserException(e.getMessage(), null, e);
91 }
92 }
93
94
95
96
97
98
99
100
101
102
103 public Metadata read(Reader reader) throws IOException, XmlPullParserException {
104 try {
105 return new Metadata(delegate.read(reader));
106 } catch (XMLStreamException e) {
107 throw new XmlPullParserException(e.getMessage(), null, e);
108 }
109 }
110
111
112
113
114
115
116
117
118
119
120
121 public Metadata read(InputStream in, boolean strict) throws IOException, XmlPullParserException {
122 try {
123 return new Metadata(delegate.read(in, strict));
124 } catch (XMLStreamException e) {
125 throw new XmlPullParserException(e.getMessage(), null, e);
126 }
127 }
128
129
130
131
132
133
134
135
136
137
138 public Metadata read(InputStream in) throws IOException, XmlPullParserException {
139 try {
140 return new Metadata(delegate.read(in));
141 } catch (XMLStreamException e) {
142 throw new XmlPullParserException(e.getMessage(), null, e);
143 }
144 }
145
146
147
148
149
150
151
152
153
154
155
156 public Metadata read(XMLStreamReader parser, boolean strict) throws IOException, XmlPullParserException {
157 try {
158 return new Metadata(delegate.read(parser, strict));
159 } catch (XMLStreamException e) {
160 throw new XmlPullParserException(e.getMessage(), null, e);
161 }
162 }
163
164
165
166
167 public interface ContentTransformer {
168
169
170
171
172
173
174
175
176 String transform(String source, String fieldName);
177 }
178 }