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.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.Map;
25
26 import org.apache.maven.model.Build;
27 import org.apache.maven.model.Extension;
28 import org.apache.maven.model.Plugin;
29 import org.apache.maven.model.PluginManagement;
30 import org.apache.maven.model.Resource;
31 import org.jdom2.Element;
32
33
34
35
36
37
38
39 public class JDomBuild extends Build {
40 private final Element build;
41
42
43
44
45
46
47 public JDomBuild(Element build) {
48 this.build = build;
49 }
50
51 @Override
52 public void addExtension(Extension extension) {
53 throw new UnsupportedOperationException();
54 }
55
56 @Override
57 public List<Extension> getExtensions() {
58 Element extensionsElm = build.getChild("extensions", build.getNamespace());
59 if (extensionsElm == null) {
60 return Collections.emptyList();
61 } else {
62 List<Element> extensionElms = extensionsElm.getChildren("extension", build.getNamespace());
63
64 List<Extension> extensions = new ArrayList<>(extensionElms.size());
65 for (Element extensionElm : extensionElms) {
66 extensions.add(new JDomExtension(extensionElm));
67 }
68 return extensions;
69 }
70 }
71
72 @Override
73 public String getOutputDirectory() {
74 throw new UnsupportedOperationException();
75 }
76
77 @Override
78 public String getScriptSourceDirectory() {
79 throw new UnsupportedOperationException();
80 }
81
82 @Override
83 public String getSourceDirectory() {
84 throw new UnsupportedOperationException();
85 }
86
87 @Override
88 public String getTestOutputDirectory() {
89 throw new UnsupportedOperationException();
90 }
91
92 @Override
93 public String getTestSourceDirectory() {
94 throw new UnsupportedOperationException();
95 }
96
97 @Override
98 public void removeExtension(Extension extension) {
99 throw new UnsupportedOperationException();
100 }
101
102 @Override
103 public void setExtensions(List<Extension> extensions) {
104 throw new UnsupportedOperationException();
105 }
106
107 @Override
108 public void setOutputDirectory(String outputDirectory) {
109 throw new UnsupportedOperationException();
110 }
111
112 @Override
113 public void setScriptSourceDirectory(String scriptSourceDirectory) {
114 throw new UnsupportedOperationException();
115 }
116
117 @Override
118 public void setSourceDirectory(String sourceDirectory) {
119 throw new UnsupportedOperationException();
120 }
121
122 @Override
123 public void setTestOutputDirectory(String testOutputDirectory) {
124 throw new UnsupportedOperationException();
125 }
126
127 @Override
128 public void setTestSourceDirectory(String testSourceDirectory) {
129 throw new UnsupportedOperationException();
130 }
131
132 @Override
133 public void addFilter(String string) {
134 throw new UnsupportedOperationException();
135 }
136
137 @Override
138 public void addResource(Resource resource) {
139 throw new UnsupportedOperationException();
140 }
141
142 @Override
143 public void addTestResource(Resource resource) {
144 throw new UnsupportedOperationException();
145 }
146
147 @Override
148 public String getDefaultGoal() {
149 throw new UnsupportedOperationException();
150 }
151
152 @Override
153 public String getDirectory() {
154 throw new UnsupportedOperationException();
155 }
156
157 @Override
158 public List<String> getFilters() {
159 throw new UnsupportedOperationException();
160 }
161
162 @Override
163 public String getFinalName() {
164 throw new UnsupportedOperationException();
165 }
166
167 @Override
168 public List<Resource> getResources() {
169 throw new UnsupportedOperationException();
170 }
171
172 @Override
173 public List<Resource> getTestResources() {
174 throw new UnsupportedOperationException();
175 }
176
177 @Override
178 public void removeFilter(String string) {
179 throw new UnsupportedOperationException();
180 }
181
182 @Override
183 public void removeResource(Resource resource) {
184 throw new UnsupportedOperationException();
185 }
186
187 @Override
188 public void removeTestResource(Resource resource) {
189 throw new UnsupportedOperationException();
190 }
191
192 @Override
193 public void setDefaultGoal(String defaultGoal) {
194 throw new UnsupportedOperationException();
195 }
196
197 @Override
198 public void setDirectory(String directory) {
199 throw new UnsupportedOperationException();
200 }
201
202 @Override
203 public void setFilters(List<String> filters) {
204 throw new UnsupportedOperationException();
205 }
206
207 @Override
208 public void setFinalName(String finalName) {
209 throw new UnsupportedOperationException();
210 }
211
212 @Override
213 public void setResources(List<Resource> resources) {
214 throw new UnsupportedOperationException();
215 }
216
217 @Override
218 public void setTestResources(List<Resource> testResources) {
219 throw new UnsupportedOperationException();
220 }
221
222 @Override
223 public PluginManagement getPluginManagement() {
224 Element pluginManagementElm = build.getChild("pluginManagement", build.getNamespace());
225 if (pluginManagementElm == null) {
226 return null;
227 } else {
228 return new JDomPluginManagement(pluginManagementElm);
229 }
230 }
231
232 @Override
233 public void setPluginManagement(PluginManagement pluginManagement) {
234 throw new UnsupportedOperationException();
235 }
236
237 @Override
238 public void addPlugin(Plugin plugin) {
239 throw new UnsupportedOperationException();
240 }
241
242 @Override
243 public List<Plugin> getPlugins() {
244 Element pluginsElm = build.getChild("plugins", build.getNamespace());
245 if (pluginsElm == null) {
246 return Collections.emptyList();
247 } else {
248 List<Element> pluginElms = pluginsElm.getChildren("plugin", build.getNamespace());
249
250 List<Plugin> plugins = new ArrayList<>(pluginElms.size());
251
252 for (Element pluginElm : pluginElms) {
253 plugins.add(new JDomPlugin(pluginElm));
254 }
255
256 return plugins;
257 }
258 }
259
260 @Override
261 public void removePlugin(Plugin plugin) {
262 throw new UnsupportedOperationException();
263 }
264
265 @Override
266 public void setPlugins(List<Plugin> plugins) {
267 throw new UnsupportedOperationException();
268 }
269
270 @Override
271 public void flushPluginMap() {
272 throw new UnsupportedOperationException();
273 }
274
275 @Override
276 public Map<String, Plugin> getPluginsAsMap() {
277 throw new UnsupportedOperationException();
278 }
279 }