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      public Settings read(Reader reader, boolean strict) throws IOException, XmlPullParserException {
68          try {
69              return new Settings(delegate.read(reader, strict, null));
70          } catch (XMLStreamException e) {
71              throw new XmlPullParserException(e.getMessage(), null, e);
72          }
73      }
74  
75      public Settings read(Reader reader) throws IOException, XmlPullParserException {
76          try {
77              return new Settings(delegate.read(reader));
78          } catch (XMLStreamException e) {
79              throw new XmlPullParserException(e.getMessage(), null, e);
80          }
81      }
82  
83      public Settings read(InputStream in, boolean strict) throws IOException, XmlPullParserException {
84          try {
85              return new Settings(delegate.read(in, strict, null));
86          } catch (XMLStreamException e) {
87              throw new XmlPullParserException(e.getMessage(), null, e);
88          }
89      }
90  
91      public Settings read(InputStream in) throws IOException, XmlPullParserException {
92          try {
93              return new Settings(delegate.read(in));
94          } catch (XMLStreamException e) {
95              throw new XmlPullParserException(e.getMessage(), null, e);
96          }
97      }
98  
99      public Settings read(XMLStreamReader parser, boolean strict) throws IOException, XmlPullParserException {
100         try {
101             return new Settings(delegate.read(parser, strict, null));
102         } catch (XMLStreamException e) {
103             throw new XmlPullParserException(e.getMessage(), null, e);
104         }
105     }
106 
107     public interface ContentTransformer {
108         
109 
110 
111 
112 
113 
114 
115         String transform(String source, String fieldName);
116     }
117 }