View Javadoc
1   package org.codehaus.mojo.rmic;
2   
3   /*
4    * Copyright (c) 2012-2017, Codehaus.org
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy of
7    * this software and associated documentation files (the "Software"), to deal in
8    * the Software without restriction, including without limitation the rights to
9    * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10   * of the Software, and to permit persons to whom the Software is furnished to do
11   * so, subject to the following conditions:
12   *
13   * The above copyright notice and this permission notice shall be included in all
14   * copies or substantial portions of the Software.
15   *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22   * SOFTWARE.
23   */
24  
25  import java.io.File;
26  import java.util.Collections;
27  import java.util.HashSet;
28  import java.util.LinkedList;
29  import java.util.List;
30  import java.util.Set;
31  
32  /**
33   * Based on CompilerConfiguration, but since that class has too much javac-specific properties,
34   * create an custom version.
35   * 
36   * @author Robert Scholte
37   * @since 1.3
38   */
39  public class RmiCompilerConfiguration
40  {
41      private String outputLocation;
42  
43      private List<String> classpathEntries = new LinkedList<String>();
44  
45      // ----------------------------------------------------------------------
46      // Source Files
47      // ----------------------------------------------------------------------
48  
49      private Set<File> sourceFiles = new HashSet<File>();
50  
51      private List<String> sourceLocations = new LinkedList<String>();
52  
53      private Set<String> includes = new HashSet<String>();
54  
55      private Set<String> excludes = new HashSet<String>();
56      
57  
58      // ----------------------------------------------------------------------
59      // Compiler Settings
60      // ----------------------------------------------------------------------
61      
62      private String version;
63      
64      private boolean iiop;
65      
66      private boolean poa;
67      
68      private boolean noLocalStubs;
69      
70      private boolean idl;
71      
72      private boolean noValueMethods;
73      
74      private boolean keep;
75      
76      private boolean verbose;
77      
78      private boolean nowarn;
79      
80      // ----------------------------------------------------------------------
81      //
82      // ----------------------------------------------------------------------
83  
84      public void setOutputLocation( String outputLocation )
85      {
86          this.outputLocation = outputLocation;
87      }
88  
89      public String getOutputLocation()
90      {
91          return outputLocation;
92      }
93      
94      // ----------------------------------------------------------------------
95      // Class path
96      // ----------------------------------------------------------------------
97  
98      public void addClasspathEntry( String classpathEntry )
99      {
100         classpathEntries.add( classpathEntry );
101     }
102 
103     public void setClasspathEntries( List<String> classpathEntries )
104     {
105         if ( classpathEntries == null )
106         {
107             this.classpathEntries = Collections.emptyList();
108         }
109         else
110         {
111             this.classpathEntries = new LinkedList<String>( classpathEntries );
112         }
113     }
114 
115     public List<String> getClasspathEntries()
116     {
117         return Collections.unmodifiableList( classpathEntries );
118     }
119     
120  // ----------------------------------------------------------------------
121     // Source files
122     // ----------------------------------------------------------------------
123 
124     public void setSourceFiles( Set<File> sourceFiles )
125     {
126         if ( sourceFiles == null )
127         {
128             this.sourceFiles = Collections.emptySet();
129         }
130         else
131         {
132             this.sourceFiles = new HashSet<File>( sourceFiles );
133         }
134     }
135 
136     public Set<File> getSourceFiles()
137     {
138         return sourceFiles;
139     }
140 
141     public void addSourceLocation( String sourceLocation )
142     {
143         sourceLocations.add( sourceLocation );
144     }
145 
146     public void setSourceLocations( List<String> sourceLocations )
147     {
148         if ( sourceLocations == null )
149         {
150             this.sourceLocations = Collections.emptyList();
151         }
152         else
153         {
154             this.sourceLocations = new LinkedList<String>( sourceLocations );
155         }
156     }
157 
158     public List<String> getSourceLocations()
159     {
160         return Collections.unmodifiableList( sourceLocations );
161     }
162 
163     public void addInclude( String include )
164     {
165         includes.add( include );
166     }
167 
168     public void setIncludes( Set<String> includes )
169     {
170         if ( includes == null )
171         {
172             this.includes = Collections.emptySet();
173         }
174         else
175         {
176             this.includes = new HashSet<String>( includes );
177         }
178     }
179 
180     public Set<String> getIncludes()
181     {
182         return Collections.unmodifiableSet( includes );
183     }
184 
185     public void addExclude( String exclude )
186     {
187         excludes.add( exclude );
188     }
189 
190     public void setExcludes( Set<String> excludes )
191     {
192         if ( excludes == null )
193         {
194             this.excludes = Collections.emptySet();
195         }
196         else
197         {
198             this.excludes = new HashSet<String>( excludes );
199         }
200     }
201 
202     public Set<String> getExcludes()
203     {
204         return Collections.unmodifiableSet( excludes );
205     }
206     
207     // ----------------------------------------------------------------------
208     // Compiler Settings
209     // ----------------------------------------------------------------------
210     
211     public void setVersion( String version )
212     {
213         this.version = version;
214     }
215     
216     public String getVersion()
217     {
218         return version;
219     }
220     
221     public void setIiop( boolean iiop )
222     {
223         this.iiop = iiop;
224     }
225     
226     public boolean isIiop()
227     {
228         return iiop;
229     }
230     
231     public void setPoa( boolean poa )
232     {
233         this.poa = poa;
234     }
235     
236     public boolean isPoa()
237     {
238         return poa;
239     }
240     
241     public void setNoLocalStubs( boolean noLocalStubs )
242     {
243         this.noLocalStubs = noLocalStubs;
244     }
245     
246     public boolean isNoLocalStubs()
247     {
248         return noLocalStubs;
249     }
250     
251     public void setIdl( boolean idl )
252     {
253         this.idl = idl;
254     }
255     
256     public boolean isIdl()
257     {
258         return idl;
259     }
260     
261     public void setNoValueMethods( boolean noValueMethods )
262     {
263         this.noValueMethods = noValueMethods;
264     }
265     
266     public boolean isNoValueMethods()
267     {
268         return noValueMethods;
269     }
270     
271     public void setKeep( boolean keep )
272     {
273         this.keep = keep;
274     }
275     
276     public boolean isKeep()
277     {
278         return keep;
279     }
280     
281     public void setVerbose( boolean verbose )
282     {
283         this.verbose = verbose;
284     }
285     
286     public boolean isVerbose()
287     {
288         return verbose;
289     }
290     
291     public void setNowarn( boolean nowarn )
292     {
293         this.nowarn = nowarn;
294     }
295     
296     public boolean isNowarn()
297     {
298         return nowarn;
299     }
300 }