View Javadoc

1   package org.apache.maven.project.overlay;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.model.Build;
23  import org.apache.maven.model.Extension;
24  import org.apache.maven.model.Plugin;
25  import org.apache.maven.model.PluginManagement;
26  import org.apache.maven.model.Resource;
27  
28  import java.util.ArrayList;
29  import java.util.List;
30  import java.util.Map;
31  
32  /**
33   * @todo why delegate? this is asking for trouble when there are additions.
34   */
35  public class BuildOverlay
36      extends Build
37  {
38      
39      private final Build build;
40      
41      private List resources;
42      private List testResources;
43  
44      public BuildOverlay( Build build )
45      {
46          if ( build == null )
47          {
48              this.build = new Build();
49              
50              this.resources = new ArrayList();
51              
52              this.testResources = new ArrayList();
53          }
54          else
55          {
56              this.build = build;
57              
58              this.resources = new ArrayList( build.getResources() );
59              
60              this.testResources = new ArrayList( build.getTestResources() );
61          }
62      }
63  
64      public void addExtension( Extension extension )
65      {
66          build.addExtension( extension );
67      }
68  
69      public void addPlugin( Plugin plugin )
70      {
71          build.addPlugin( plugin );
72      }
73  
74      public void addResource( Resource resource )
75      {
76          resources.add( resource );
77      }
78  
79      public void addTestResource( Resource resource )
80      {
81          testResources.add( resource );
82      }
83  
84      public boolean equals( Object obj )
85      {
86          return build.equals( obj );
87      }
88  
89      public void flushPluginMap()
90      {
91          build.flushPluginMap();
92      }
93  
94      public String getDefaultGoal()
95      {
96          return build.getDefaultGoal();
97      }
98  
99      public String getDirectory()
100     {
101         return build.getDirectory();
102     }
103 
104     public List getExtensions()
105     {
106         return build.getExtensions();
107     }
108 
109     public String getFinalName()
110     {
111         return build.getFinalName();
112     }
113 
114     public String getOutputDirectory()
115     {
116         return build.getOutputDirectory();
117     }
118 
119     public PluginManagement getPluginManagement()
120     {
121         return build.getPluginManagement();
122     }
123 
124     public List getPlugins()
125     {
126         return build.getPlugins();
127     }
128 
129     public Map getPluginsAsMap()
130     {
131         return build.getPluginsAsMap();
132     }
133 
134     public List getResources()
135     {
136         return resources;
137     }
138 
139     public String getScriptSourceDirectory()
140     {
141         return build.getScriptSourceDirectory();
142     }
143 
144     public String getSourceDirectory()
145     {
146         return build.getSourceDirectory();
147     }
148 
149     public String getTestOutputDirectory()
150     {
151         return build.getTestOutputDirectory();
152     }
153 
154     public List getTestResources()
155     {
156         return testResources;
157     }
158 
159     public String getTestSourceDirectory()
160     {
161         return build.getTestSourceDirectory();
162     }
163 
164     public int hashCode()
165     {
166         return build.hashCode();
167     }
168 
169     public void removeExtension( Extension extension )
170     {
171         build.removeExtension( extension );
172     }
173 
174     public void removePlugin( Plugin plugin )
175     {
176         build.removePlugin( plugin );
177     }
178 
179     public void removeResource( Resource resource )
180     {
181         resources.remove( resource );
182     }
183 
184     public void removeTestResource( Resource resource )
185     {
186         testResources.remove( resource );
187     }
188 
189     public void setDefaultGoal( String defaultGoal )
190     {
191         build.setDefaultGoal( defaultGoal );
192     }
193 
194     public void setDirectory( String directory )
195     {
196         build.setDirectory( directory );
197     }
198 
199     public void setExtensions( List extensions )
200     {
201         build.setExtensions( extensions );
202     }
203 
204     public void setFinalName( String finalName )
205     {
206         build.setFinalName( finalName );
207     }
208 
209     public void setOutputDirectory( String outputDirectory )
210     {
211         build.setOutputDirectory( outputDirectory );
212     }
213 
214     public void setPluginManagement( PluginManagement pluginManagement )
215     {
216         build.setPluginManagement( pluginManagement );
217     }
218 
219     public void setPlugins( List plugins )
220     {
221         build.setPlugins( plugins );
222     }
223 
224     public void setResources( List resources )
225     {
226         this.resources = resources;
227     }
228 
229     public void setScriptSourceDirectory( String scriptSourceDirectory )
230     {
231         build.setScriptSourceDirectory( scriptSourceDirectory );
232     }
233 
234     public void setSourceDirectory( String sourceDirectory )
235     {
236         build.setSourceDirectory( sourceDirectory );
237     }
238 
239     public void setTestOutputDirectory( String testOutputDirectory )
240     {
241         build.setTestOutputDirectory( testOutputDirectory );
242     }
243 
244     public void setTestResources( List testResources )
245     {
246         this.testResources = testResources;
247     }
248 
249     public void setTestSourceDirectory( String testSourceDirectory )
250     {
251         build.setTestSourceDirectory( testSourceDirectory );
252     }
253 
254     public String toString()
255     {
256         return build.toString();
257     }
258 
259     public void addFilter( String string )
260     {
261         build.addFilter( string );   
262     } //-- void addFilter(String)
263 
264     public List getFilters()
265     {
266         return build.getFilters();
267     } //-- java.util.List getFilters()
268 
269     public void removeFilter( String string )
270     {
271         build.removeFilter( string );
272     } //-- void removeFilter(String)
273 
274     public void setFilters( List filters )
275     {
276         build.setFilters( filters );
277     } //-- void setFilters(java.util.List)
278 }