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.Plugin;
27 import org.apache.maven.model.PluginManagement;
28 import org.jdom2.Element;
29
30
31
32
33
34
35
36 public class JDomPluginManagement extends PluginManagement {
37 private final Element pluginManagement;
38
39
40
41
42
43
44 public JDomPluginManagement(Element pluginManagement) {
45 this.pluginManagement = pluginManagement;
46 }
47
48 @Override
49 public void addPlugin(Plugin plugin) {
50 throw new UnsupportedOperationException();
51 }
52
53 @Override
54 public List<Plugin> getPlugins() {
55 Element pluginsElm = pluginManagement.getChild("plugins", pluginManagement.getNamespace());
56 if (pluginsElm == null) {
57 return Collections.emptyList();
58 } else {
59 List<Element> pluginElms = pluginsElm.getChildren("plugin", pluginManagement.getNamespace());
60
61 List<Plugin> plugins = new ArrayList<>(pluginElms.size());
62
63 for (Element pluginElm : pluginElms) {
64 plugins.add(new JDomPlugin(pluginElm));
65 }
66
67 return plugins;
68 }
69 }
70
71 @Override
72 public void removePlugin(Plugin plugin) {
73 throw new UnsupportedOperationException();
74 }
75
76 @Override
77 public void setPlugins(List<Plugin> plugins) {
78 throw new UnsupportedOperationException();
79 }
80
81 @Override
82 public void flushPluginMap() {
83 throw new UnsupportedOperationException();
84 }
85
86 @Override
87 public Map<String, Plugin> getPluginsAsMap() {
88 throw new UnsupportedOperationException();
89 }
90 }