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