KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > project > api > WebProjectCreateData


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.project.api;
21
22 import java.io.File JavaDoc;
23 import org.openide.filesystems.FileObject;
24
25 /**
26  * Encapsulates data required for creating a new empty web project
27  * or for creating a web project from existing sources.
28  *
29  * @author Radko Najman
30  */

31 public class WebProjectCreateData {
32
33     //common to create and import project
34
private File JavaDoc projectDir;
35     private String JavaDoc name;
36     private String JavaDoc serverInstanceID;
37     private String JavaDoc javaEEVersion;
38     private String JavaDoc sourceLevel;
39     private String JavaDoc javaPlatformName;
40     
41     //only for create project
42
private String JavaDoc contextPath;
43     private String JavaDoc sourceStructure;
44     
45     //only for import project
46
//(in the future we will need to add dd location and probably also conf dir
47
// and setup dir locations)
48
private FileObject wmFO;
49     private File JavaDoc[] sourceFolders;
50     private File JavaDoc[] testFolders;
51     private FileObject docBase;
52     private FileObject libFolder;
53     private String JavaDoc buildfile;
54     private boolean javaSourceBased = true;
55     
56     /**
57      * Creates a new instance of WebProjectCreateData
58      */

59     public WebProjectCreateData() {
60     }
61
62     /**
63      * Gets the project directory
64      * @return the project directory
65      */

66     public File JavaDoc getProjectDir() {
67         return projectDir;
68     }
69
70     /**
71      * Sets the project directory.
72      * @param projectDir the project directory. Cannot be null.
73      */

74     public void setProjectDir(File JavaDoc projectDir) {
75         this.projectDir = projectDir;
76     }
77
78     /**
79      * Gets the project name
80      * @return the project name
81      */

82     public String JavaDoc getName() {
83         return name;
84     }
85
86     /**
87      * Sets the project name
88      * @param name the project name. Cannot be null.
89      */

90     public void setName(String JavaDoc name) {
91         this.name = name;
92     }
93
94     /**
95      * Gets the server instance ID
96      * @return the server instance ID
97      */

98     public String JavaDoc getServerInstanceID() {
99         return serverInstanceID;
100     }
101
102     /**
103      * Sets the server instance ID
104      * @param serverInstanceID the server instance ID. Cannot be null.
105      */

106     public void setServerInstanceID(String JavaDoc serverInstanceID) {
107         this.serverInstanceID = serverInstanceID;
108     }
109
110     /**
111      * Gets Java EE version
112      * @return Java EE version
113      */

114     public String JavaDoc getJavaEEVersion() {
115         return javaEEVersion;
116     }
117
118     /**
119      * Sets Java EE version
120      * @param javaEEVersion Java EE version. Cannot be null.
121      */

122     public void setJavaEEVersion(String JavaDoc javaEEVersion) {
123         this.javaEEVersion = javaEEVersion;
124     }
125
126     /**
127      * Gets the context path
128      * @return the context path
129      */

130     public String JavaDoc getContextPath() {
131         return contextPath;
132     }
133
134     /**
135      * Sets the context path
136      * @param contextPath the context path
137      */

138     public void setContextPath(String JavaDoc contextPath) {
139         this.contextPath = contextPath;
140     }
141
142     /**
143      * Gets the source structure
144      * @return the source structure ({@link WebProjectUtilities#SRC_STRUCT_BLUEPRINTS}
145      * or {@link WebProjectUtilities#SRC_STRUCT_JAKARTA})
146      */

147     public String JavaDoc getSourceStructure() {
148         return sourceStructure;
149     }
150
151     /**
152      * Sets the source structure
153      * @param sourceStructure the source structure ({@link WebProjectUtilities#SRC_STRUCT_BLUEPRINTS}
154      * or {@link WebProjectUtilities#SRC_STRUCT_JAKARTA}). Cannot be null.
155      */

156     public void setSourceStructure(String JavaDoc sourceStructure) {
157         this.sourceStructure = sourceStructure;
158     }
159
160     /**
161      * Gets the file object representation of the imported web project location
162      * @return the file object representation of the imported web project location
163      */

164     public FileObject getWebModuleFO() {
165         return wmFO;
166     }
167
168     /**
169      * Sets the file object representation of the imported web project location
170      * @param wmFO the file object representation of the imported web project location. Cannot be null.
171      */

172     public void setWebModuleFO(FileObject wmFO) {
173         this.wmFO = wmFO;
174     }
175
176     /**
177      * Gets the array of source folders
178      * @return the array of source folders
179      */

180     public File JavaDoc[] getSourceFolders() {
181         return sourceFolders;
182     }
183
184     /**
185      * Sets the array of source folders
186      * @param sourceFolders the array of source folders. Cannot be null.
187      */

188     public void setSourceFolders(File JavaDoc[] sourceFolders) {
189         this.sourceFolders = sourceFolders;
190     }
191
192     /**
193      * Gets the array of test folders
194      * @return the array of test folders
195      */

196     public File JavaDoc[] getTestFolders() {
197         return testFolders;
198     }
199
200     /**
201      * Sets the array of test folders
202      * @param testFolders the array of test folders
203      */

204     public void setTestFolders(File JavaDoc[] testFolders) {
205         this.testFolders = testFolders;
206     }
207
208     /**
209      * Gets the location of web pages
210      * @return the location of web pages
211      */

212     public FileObject getDocBase() {
213         return docBase;
214     }
215
216     /**
217      * Sets the location of web pages
218      * @param docBase the location of web pages. Cannot be null.
219      */

220     public void setDocBase(FileObject docBase) {
221         this.docBase = docBase;
222     }
223
224     /**
225      * Gets the libraries folder
226      * @return the libraries folder
227      */

228     public FileObject getLibFolder() {
229         return libFolder;
230     }
231
232     /**
233      * Sets the libraries folder
234      * @param libFolder the libraries folder
235      */

236     public void setLibFolder(FileObject libFolder) {
237         this.libFolder = libFolder;
238     }
239
240     /**
241      * Gets the build script file name
242      * @return the build script file name
243      */

244     public String JavaDoc getBuildfile() {
245         return buildfile;
246     }
247
248     /**
249      * Sets the build script file name
250      * @param buildfile the build script file name
251      */

252     public void setBuildfile(String JavaDoc buildfile) {
253         this.buildfile = buildfile;
254     }
255     
256     /**
257      * Gets the source level
258      * @return the source level (e.g. 1.4, 1.5)
259      */

260     public String JavaDoc getSourceLevel() {
261         return sourceLevel;
262     }
263
264     /**
265      * Sets the source level
266      * @param sourceLevel the source level (e.g. 1.4, 1.5)
267      */

268     public void setSourceLevel(String JavaDoc sourceLevel) {
269         this.sourceLevel = sourceLevel;
270     }
271
272     /**
273      * Gets Java platform name
274      * @return Java platform name (from Java Platform Manager)
275      */

276     public String JavaDoc getJavaPlatformName() {
277         return javaPlatformName;
278     }
279
280     /**
281      * Sets Java platform name
282      * @param javaPlatformName Java platform name (from Java Platform Manager)
283      */

284     public void setJavaPlatformName(String JavaDoc javaPlatformName) {
285         this.javaPlatformName = javaPlatformName;
286     }
287
288 // //Just a debug method to display how the properties are set.
289
// public void log() {
290
// System.out.println("\nCREATE & IMPORT");
291
// System.out.println(" projectDir: " + (projectDir == null ? "-" : projectDir.getPath()));
292
// System.out.println(" name: " + name);
293
// System.out.println(" serverInstanceID: " + serverInstanceID);
294
// System.out.println(" javaEEVersion: " + javaEEVersion);
295
// System.out.println(" contextPath: " + contextPath);
296
// System.out.println(" sourceLevel: " + sourceLevel);
297
// System.out.println(" javaPlatformName: " + javaPlatformName);
298
//
299
// System.out.println("\nCREATE");
300
// System.out.println(" sourceStructure: " + sourceStructure);
301
//
302
// System.out.println("\nIMPORT");
303
// System.out.println(" wmFO: " + (wmFO == null ? "-" : wmFO.getPath()));
304
// if (sourceFolders != null) {
305
// System.out.println(" sourceFolders: ");
306
// for (int i = 0; i < sourceFolders.length; i++)
307
// System.out.print(sourceFolders[i].getPath() + ", ");
308
// }
309
// if (testFolders != null) {
310
// System.out.println(" testFolders: ");
311
// for (int i = 0; i < testFolders.length; i++)
312
// System.out.print(testFolders[i].getPath() + ", ");
313
// }
314
// System.out.println(" docBase: " + (docBase == null ? "-" : docBase.getPath()));
315
// System.out.println(" libFolder: " + (libFolder == null ? "-" : libFolder.getPath()));
316
// System.out.println(" buildfile: " + buildfile);
317
// }
318

319     /**
320      * Indicate whether the project is being created from java sources.
321      * @param b should the user be able to extend this project with additional
322      * source elements
323      */

324     public void setJavaSourceBased(boolean b) {
325         this.javaSourceBased = b;
326     }
327     
328     /**
329      * Determine whether the project was created from java sources.
330      * @return if the project supports the addition of java source files
331      */

332     public boolean getJavaSourceBased() {
333         return this.javaSourceBased;
334     }
335
336 }
337
Popular Tags