View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.eclipse.writers;
20  
21  import java.io.File;
22  import java.util.List;
23  import java.util.Map;
24  
25  import org.apache.maven.artifact.repository.ArtifactRepository;
26  import org.apache.maven.plugin.eclipse.EclipsePlugin;
27  import org.apache.maven.plugin.eclipse.EclipseSourceDir;
28  import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
29  import org.apache.maven.plugin.ide.IdeDependency;
30  import org.apache.maven.project.MavenProject;
31  
32  /**
33   * @author Fabrizio Giustina
34   * @version $Id: EclipseWriterConfig.java 1173952 2011-09-22 05:53:22Z baerrach $
35   */
36  public class EclipseWriterConfig
37  {
38      /**
39       * The maven project.
40       */
41      private MavenProject project;
42  
43      /**
44       * The maven project packaging.
45       */
46      private String packaging;
47  
48      /**
49       * Eclipse project dir.
50       */
51      private File eclipseProjectDirectory;
52  
53      /**
54       * The name of the project in eclipse.
55       */
56      private String eclipseProjectName;
57  
58      /**
59       * Base project dir.
60       */
61      private File projectBaseDir;
62  
63      /**
64       * List of IDE dependencies.
65       */
66      private IdeDependency[] deps = new IdeDependency[0];
67  
68      /**
69       * Source directories.
70       */
71      private EclipseSourceDir[] sourceDirs;
72  
73      /**
74       * Local maven repo.
75       */
76      private ArtifactRepository localRepository;
77  
78      /**
79       * Build output directory for eclipse.
80       */
81      private File buildOutputDirectory;
82  
83      /**
84       * Manifest file.
85       */
86      private File osgiManifestFile;
87  
88      /**
89       * PDE mode.
90       */
91      private boolean pde;
92  
93      /**
94       * Project natures.
95       */
96      private List projectnatures;
97  
98      /**
99       * Project facets.
100      */
101     private Map projectFacets;
102 
103     /**
104      * Build commands. List<BuildCommand>
105      */
106     private List buildCommands;
107 
108     /**
109      * Classpath containers.
110      */
111     private List classpathContainers;
112 
113     /**
114      * Appends the version number to the project name if <tt>true</tt>.
115      * 
116      * @deprecated use {@link #projectNameTemplate}
117      */
118     private boolean addVersionToProjectName;
119 
120     /**
121      * @see EclipsePlugin#getProjectNameTemplate()
122      */
123     private String projectNameTemplate;
124 
125     /**
126      * @see EclipsePlugin#deployName()
127      */
128 
129     private String contextName;
130 
131     /**
132      * @see EclipsePlugin#wtpapplicationxml()
133      */
134     private boolean wtpapplicationxml;
135 
136     /**
137      * @see EclipsePlugin#getWtpversion()
138      */
139     private float wtpVersion;
140 
141     private float ajdtVersion;
142 
143     private WorkspaceConfiguration workspaceConfiguration;
144 
145     private List linkedResources;
146     
147     /**
148      * @See {@link EclipsePlugin#classpathContainersLast}
149      */
150     private boolean classpathContainersLast;
151     
152     /**
153      * @see {@link EclipsePlugin#jeeversion}
154      */
155     private String jeeVersion;
156 
157     public WorkspaceConfiguration getWorkspaceConfiguration()
158     {
159         return workspaceConfiguration;
160     }
161 
162     public void setWorkspaceConfiguration( WorkspaceConfiguration workspaceConfiguration )
163     {
164         this.workspaceConfiguration = workspaceConfiguration;
165     }
166 
167     /**
168      * Getter for <code>deps</code>.
169      * 
170      * @return Returns the deps.
171      */
172     public IdeDependency[] getDeps()
173     {
174         return deps;
175     }
176 
177     /**
178      * Setter for <code>deps</code>.
179      * 
180      * @param deps The deps to set.
181      */
182     public void setDeps( IdeDependency[] deps )
183     {
184         this.deps = deps;
185     }
186 
187     /**
188      * Getter for <code>eclipseProjectDir</code>.
189      * 
190      * @return Returns the eclipseProjectDir.
191      */
192     public File getEclipseProjectDirectory()
193     {
194         return eclipseProjectDirectory;
195     }
196 
197     /**
198      * Setter for <code>eclipseProjectDir</code>.
199      * 
200      * @param eclipseProjectDir The eclipseProjectDir to set.
201      */
202     public void setEclipseProjectDirectory( File eclipseProjectDir )
203     {
204         eclipseProjectDirectory = eclipseProjectDir;
205     }
206 
207     /**
208      * Getter for <code>eclipseProjectName</code>.
209      * 
210      * @return Returns the project name used in eclipse.
211      */
212     public String getEclipseProjectName()
213     {
214         return eclipseProjectName;
215     }
216 
217     /**
218      * Setter for <code>eclipseProjectName</code>.
219      * 
220      * @param eclipseProjectName the project name used in eclipse.
221      */
222     public void setEclipseProjectName( String eclipseProjectName )
223     {
224         this.eclipseProjectName = eclipseProjectName;
225     }
226 
227     /**
228      * Getter for <code>project</code>.
229      * 
230      * @return Returns the project.
231      */
232     public MavenProject getProject()
233     {
234         return project;
235     }
236 
237     /**
238      * Setter for <code>project</code>.
239      * 
240      * @param project The project to set.
241      */
242     public void setProject( MavenProject project )
243     {
244         this.project = project;
245     }
246 
247     /**
248      * Getter for <code>sourceDirs</code>.
249      * 
250      * @return Returns the sourceDirs.
251      */
252     public EclipseSourceDir[] getSourceDirs()
253     {
254         return sourceDirs;
255     }
256 
257     /**
258      * Setter for <code>sourceDirs</code>.
259      * 
260      * @param sourceDirs The sourceDirs to set.
261      */
262     public void setSourceDirs( EclipseSourceDir[] sourceDirs )
263     {
264         this.sourceDirs = sourceDirs;
265     }
266 
267     /**
268      * Getter for <code>buildOutputDirectory</code>.
269      * 
270      * @return Returns the buildOutputDirectory.
271      */
272     public File getBuildOutputDirectory()
273     {
274         return buildOutputDirectory;
275     }
276 
277     /**
278      * Setter for <code>buildOutputDirectory</code>.
279      * 
280      * @param buildOutputDirectory The buildOutputDirectory to set.
281      */
282     public void setBuildOutputDirectory( File buildOutputDirectory )
283     {
284         this.buildOutputDirectory = buildOutputDirectory;
285     }
286 
287     /**
288      * Getter for <code>localRepository</code>.
289      * 
290      * @return Returns the localRepository.
291      */
292     public ArtifactRepository getLocalRepository()
293     {
294         return localRepository;
295     }
296 
297     /**
298      * Setter for <code>localRepository</code>.
299      * 
300      * @param localRepository The localRepository to set.
301      */
302     public void setLocalRepository( ArtifactRepository localRepository )
303     {
304         this.localRepository = localRepository;
305     }
306 
307     /**
308      * Getter for <code>manifestFile</code>.
309      * 
310      * @return Returns the manifestFile.
311      */
312     public File getOSGIManifestFile()
313     {
314         return osgiManifestFile;
315     }
316 
317     /**
318      * Setter for <code>manifestFile</code>.
319      * 
320      * @param manifestFile The manifestFile to set.
321      */
322     public void setOSGIManifestFile( File manifestFile )
323     {
324         this.osgiManifestFile = manifestFile;
325     }
326 
327     /**
328      * Getter for <code>classpathContainers</code>.
329      * 
330      * @return Returns the classpathContainers.
331      */
332     public List getClasspathContainers()
333     {
334         return classpathContainers;
335     }
336 
337     /**
338      * Setter for <code>classpathContainers</code>.
339      * 
340      * @param classpathContainers The classpathContainers to set.
341      */
342     public void setClasspathContainers( List classpathContainers )
343     {
344         this.classpathContainers = classpathContainers;
345     }
346 
347     /**
348      * Getter for <code>pde</code>.
349      * 
350      * @return Returns the pde.
351      */
352     public boolean isPde()
353     {
354         return pde;
355     }
356 
357     /**
358      * Setter for <code>pde</code>.
359      * 
360      * @param pde The pde to set.
361      */
362     public void setPde( boolean pde )
363     {
364         this.pde = pde;
365     }
366 
367     /**
368      * Getter for <code>buildCommands</code>.
369      * 
370      * @return Returns the buildCommands.
371      */
372     public List getBuildCommands()
373     {
374         return buildCommands;
375     }
376 
377     /**
378      * Setter for <code>buildCommands</code>.
379      * 
380      * @param buildCommands The buildCommands to set.
381      */
382     public void setBuildCommands( List buildCommands )
383     {
384         this.buildCommands = buildCommands;
385     }
386 
387     /**
388      * Getter for <code>projectnatures</code>.
389      * 
390      * @return Returns the projectnatures.
391      */
392     public List getProjectnatures()
393     {
394         return projectnatures;
395     }
396 
397     /**
398      * Setter for <code>projectnatures</code>.
399      * 
400      * @param projectnatures The projectnatures to set.
401      */
402     public void setProjectnatures( List projectnatures )
403     {
404         this.projectnatures = projectnatures;
405     }
406 
407     /**
408      * Getter for <code>projectFacets</code>.
409      * 
410      * @return Returns the projectFacets
411      */
412     public Map getProjectFacets()
413     {
414         return projectFacets;
415     }
416 
417     /**
418      * Setter for <code>projectFacets</code>
419      * 
420      * @param projectFacets The projectFacets to set.
421      */
422     public void setProjectFacets( Map projectFacets )
423     {
424         this.projectFacets = projectFacets;
425     }
426 
427     /**
428      * Getter for <code>projectBaseDir</code>.
429      * 
430      * @return Returns the projectBaseDir.
431      */
432     public File getProjectBaseDir()
433     {
434         return projectBaseDir;
435     }
436 
437     /**
438      * Setter for <code>projectBaseDir</code>.
439      * 
440      * @param projectBaseDir The projectBaseDir to set.
441      */
442     public void setProjectBaseDir( File projectBaseDir )
443     {
444         this.projectBaseDir = projectBaseDir;
445     }
446 
447     /**
448      * Getter for <code>addVersionToProjectName</code>.
449      * 
450      * @deprecated use {@link #getProjectNameTemplate()}
451      */
452     public boolean isAddVersionToProjectName()
453     {
454         return addVersionToProjectName;
455     }
456 
457     /**
458      * Setter for <code>addVersionToProjectName</code>.
459      * 
460      * @deprecated use {@link #setProjectNameTemplate(String)}
461      */
462     public void setAddVersionToProjectName( boolean addVersionToProjectName )
463     {
464         this.addVersionToProjectName = addVersionToProjectName;
465     }
466 
467     public void setProjectNameTemplate( String projectNameTemplate )
468     {
469         this.projectNameTemplate = projectNameTemplate;
470     }
471 
472     public String getProjectNameTemplate()
473     {
474         return projectNameTemplate;
475     }
476 
477     public String getContextName()
478     {
479         return contextName;
480     }
481 
482     public void setContextName( String deployName )
483     {
484         contextName = deployName;
485     }
486 
487     /**
488      * @return the packaging
489      */
490     public String getPackaging()
491     {
492         return packaging;
493     }
494 
495     /**
496      * @param packaging the packaging to set
497      */
498     public void setPackaging( String packaging )
499     {
500         this.packaging = packaging;
501     }
502 
503     /**
504      * Getter for <code>wtpapplicationxml</code>.
505      * 
506      * @return Returns the wtpapplicationxml.
507      */
508     public boolean getWtpapplicationxml()
509     {
510         return wtpapplicationxml;
511     }
512 
513     /**
514      * Setter for <code>buildCommands</code>.
515      * 
516      * @param buildCommands The buildCommands to set.
517      */
518     public void setWtpapplicationxml( boolean wtpapplicationxml )
519     {
520         this.wtpapplicationxml = wtpapplicationxml;
521     }
522 
523     /**
524      * Getter for <code>wtpVersion</code>.
525      * 
526      * @return Returns the wtpVersion.
527      */
528     public float getWtpVersion()
529     {
530         return wtpVersion;
531     }
532 
533     /**
534      * Setter for <code>wtpVersion</code>.
535      * 
536      * @param wtpVersion The wtpVersion to set.
537      */
538     public void setWtpVersion( float wtpVersion )
539     {
540         this.wtpVersion = wtpVersion;
541     }
542 
543     /**
544      * Returns the ajdtVersion.
545      * 
546      * @return the ajdtVersion.
547      */
548     public float getAjdtVersion()
549     {
550         return ajdtVersion;
551     }
552 
553     /**
554      * Sets the ajdtVersion.
555      * 
556      * @param ajdtVersion the ajdtVersion.
557      */
558     public void setAjdtVersion( float ajdtVersion )
559     {
560         this.ajdtVersion = ajdtVersion;
561     }
562 
563     /**
564      * @return the linkedResources
565      */
566     public List getLinkedResources()
567     {
568         return linkedResources;
569     }
570 
571     /**
572      * @param linkedResources the linkedResources to set
573      */
574     public void setLinkedResources( List linkedResources )
575     {
576         this.linkedResources = linkedResources;
577     }
578 
579     
580     /**
581      * Returns the classpathContainersLast.
582      * @return the classpathContainersLast
583      */
584     public boolean isClasspathContainersLast()
585     {
586         return classpathContainersLast;
587     }
588 
589     
590     /**
591      * Sets the classpathContainersLast.
592      * @param classpathContainersLast the classpathContainersLast to set
593      */
594     public void setClasspathContainersLast(boolean classpathContainersLast)
595     {
596         this.classpathContainersLast = classpathContainersLast;
597     }
598 
599     /**
600      * Sets the jeeversion.
601      * @return the jeeversion
602      */
603     public String getJeeVersion()
604     {
605         return jeeVersion;
606     }
607 
608     /**
609      * Returns the jeeversion
610      * @param jeeversion the jeeversion
611      */
612     public void setJeeVersion( String jeeVersion )
613     {
614         this.jeeVersion = jeeVersion;
615     }
616 
617 }