1
2
3
4
5
6 package org.apache.maven.model;
7
8
9
10
11
12
13 @SuppressWarnings( "all" )
14 public class PluginContainer
15 implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16 {
17
18
19
20
21
22
23
24
25 private java.util.List<Plugin> plugins;
26
27
28
29
30 private java.util.Map<Object, InputLocation> locations;
31
32
33
34
35
36
37
38
39
40
41
42 public void addPlugin( Plugin plugin )
43 {
44 getPlugins().add( plugin );
45 }
46
47
48
49
50
51
52 public PluginContainer clone()
53 {
54 try
55 {
56 PluginContainer copy = (PluginContainer) super.clone();
57
58 if ( this.plugins != null )
59 {
60 copy.plugins = new java.util.ArrayList<Plugin>();
61 for ( Plugin item : this.plugins )
62 {
63 copy.plugins.add( ( (Plugin) item).clone() );
64 }
65 }
66
67 if ( copy.locations != null )
68 {
69 copy.locations = new java.util.LinkedHashMap( copy.locations );
70 }
71
72 return copy;
73 }
74 catch ( java.lang.Exception ex )
75 {
76 throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
77 + " does not support clone()" ).initCause( ex );
78 }
79 }
80
81
82
83
84
85
86
87 public InputLocation getLocation( Object key )
88 {
89 return ( locations != null ) ? locations.get( key ) : null;
90 }
91
92
93
94
95
96
97 public java.util.List<Plugin> getPlugins()
98 {
99 if ( this.plugins == null )
100 {
101 this.plugins = new java.util.ArrayList<Plugin>();
102 }
103
104 return this.plugins;
105 }
106
107
108
109
110
111
112 public void removePlugin( Plugin plugin )
113 {
114 getPlugins().remove( plugin );
115 }
116
117
118
119
120
121
122
123 public void setLocation( Object key, InputLocation location )
124 {
125 if ( location != null )
126 {
127 if ( this.locations == null )
128 {
129 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
130 }
131 this.locations.put( key, location );
132 }
133 }
134
135
136
137
138
139
140 public void setPlugins( java.util.List<Plugin> plugins )
141 {
142 this.plugins = plugins;
143 }
144
145
146
147 java.util.Map<String, Plugin> pluginMap;
148
149
150
151
152 public synchronized void flushPluginMap()
153 {
154 this.pluginMap = null;
155 }
156
157
158
159
160
161 public synchronized java.util.Map<String, Plugin> getPluginsAsMap()
162 {
163 if ( pluginMap == null )
164 {
165 pluginMap = new java.util.LinkedHashMap<String, Plugin>();
166 if ( plugins != null )
167 {
168 for ( java.util.Iterator<Plugin> it = plugins.iterator(); it.hasNext(); )
169 {
170 Plugin plugin = (Plugin) it.next();
171 pluginMap.put( plugin.getKey(), plugin );
172 }
173 }
174 }
175
176 return pluginMap;
177 }
178
179
180 }