1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.shared.release.transform.jdom2;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.OutputStream;
24 import java.io.PrintStream;
25 import java.io.PrintWriter;
26 import java.io.Reader;
27 import java.io.Writer;
28 import java.util.Enumeration;
29 import java.util.InvalidPropertiesFormatException;
30 import java.util.Properties;
31 import java.util.Set;
32
33 import org.jdom2.Element;
34
35
36
37
38
39
40
41 public class JDomProperties extends Properties {
42 private final Element properties;
43
44
45
46
47
48
49 public JDomProperties(Element properties) {
50 this.properties = properties;
51 }
52
53 @Override
54 public synchronized Object setProperty(String key, String value) {
55 Element property = properties.getChild(key, properties.getNamespace());
56
57 JDomUtils.rewriteValue(property, value);
58
59
60 return null;
61 }
62
63 @Override
64 public synchronized void load(Reader reader) throws IOException {
65 throw new UnsupportedOperationException();
66 }
67
68 @Override
69 public synchronized void load(InputStream inStream) throws IOException {
70 throw new UnsupportedOperationException();
71 }
72
73 @SuppressWarnings("deprecation")
74 @Override
75 public void save(OutputStream out, String comments) {
76 throw new UnsupportedOperationException();
77 }
78
79 @Override
80 public void store(Writer writer, String comments) throws IOException {
81 throw new UnsupportedOperationException();
82 }
83
84 @Override
85 public void store(OutputStream out, String comments) throws IOException {
86 throw new UnsupportedOperationException();
87 }
88
89 @Override
90 public synchronized void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
91 throw new UnsupportedOperationException();
92 }
93
94 @Override
95 public void storeToXML(OutputStream os, String comment) throws IOException {
96 throw new UnsupportedOperationException();
97 }
98
99 @Override
100 public void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
101 throw new UnsupportedOperationException();
102 }
103
104 @Override
105 public String getProperty(String key) {
106 Element property = properties.getChild(key, properties.getNamespace());
107
108 if (property == null) {
109 return null;
110 } else {
111 return property.getTextTrim();
112 }
113 }
114
115 @Override
116 public String getProperty(String key, String defaultValue) {
117 throw new UnsupportedOperationException();
118 }
119
120 @Override
121 public Enumeration<?> propertyNames() {
122 throw new UnsupportedOperationException();
123 }
124
125 @Override
126 public Set<String> stringPropertyNames() {
127 throw new UnsupportedOperationException();
128 }
129
130 @Override
131 public void list(PrintStream out) {
132 throw new UnsupportedOperationException();
133 }
134
135 @Override
136 public void list(PrintWriter out) {
137 throw new UnsupportedOperationException();
138 }
139 }