Source Code Cross Referenced for WSCompileArguments.java in  » IDE-Netbeans » web.core » org » netbeans » modules » websvc » registry » jaxrpc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » web.core » org.netbeans.modules.websvc.registry.jaxrpc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.websvc.registry.jaxrpc;
043:
044:        import java.io.*;
045:        import java.util.*;
046:
047:        import org.openide.util.NbBundle;
048:
049:        public class WSCompileArguments {
050:            protected String additionalClasspath;
051:            private List features = new ArrayList(); // List<String>
052:
053:            /** Holds value of property classpath. */
054:            private String classpath;
055:
056:            /** Holds value of property outputDirectory. */
057:            private String outputDirectory;
058:
059:            /** What sort of thing to generate: "client", "server", "both". */
060:            private String gen;
061:
062:            /** Holds value of property keep. */
063:            private boolean keep = true;
064:
065:            /** Holds value of property nonclassOutputDirectory. */
066:            private String nonclassOutputDirectory;
067:
068:            /** Holds value of property sourceOutputDirectory. */
069:            private String sourceOutputDirectory;
070:
071:            /** Holds value of property define. */
072:            private boolean define;
073:
074:            /** Holds value of property importGen. */
075:            private boolean importGen;
076:
077:            /** Holds value of property verbose. */
078:            private boolean verbose;
079:
080:            private String mappingFile;
081:
082:            /** Holds value of property configuration. */
083:            private Configuration configuration;
084:
085:            private List extraArguments = new LinkedList();
086:
087:            // The argument type needs no parameters.
088:            public final static int TYPE_NEED_NO_PARAM = 0;
089:            // The argument type needs parameters.
090:            public final static int TYPE_NEED_PARAM = 1;
091:            // The argument type is uncommon.
092:            public final static int TYPE_INTERNAL = 0x010;
093:            // The argument type will cause things to not compile.
094:            public final static int TYPE_NON_COMPILE = 0x100;
095:
096:            /**
097:             * The direct calling of this constructor is discouraged.  Use
098:             * JAXRPCFactory.getWSCompileArguments instead.
099:             */
100:            public WSCompileArguments() {
101:            }
102:
103:            /**
104:             * The direct calling of this constructor is discouraged.  Use
105:             * JAXRPCFactory.getWSCompileArguments instead.
106:             */
107:            public WSCompileArguments(String additionalClasspath) {
108:                this .additionalClasspath = additionalClasspath;
109:            }
110:
111:            public void addArgument(String arg) {
112:                addArgument(arg, null);
113:            }
114:
115:            /**
116:             * Add an argument to the command line.
117:             * @param arg the argument
118:             * @param param any additional parameter to arg.
119:             */
120:            public void addArgument(String arg, String param) {
121:                arg = arg.intern();
122:                if (arg == "-gen")
123:                    setGen("");
124:                else if (arg.startsWith("-gen:"))
125:                    setGen(arg.substring(5, arg.length()));
126:                else if (arg == "-define")
127:                    setDefine(true);
128:                else if (arg == "-import")
129:                    setImportGen(true);
130:                else if (arg == "-classpath")
131:                    setClasspath(param);
132:                else if (arg == "-d")
133:                    setOutputDirectory(param);
134:                else if (arg == "-nd")
135:                    setNonclassOutputDirectory(param);
136:                else if (arg == "-s")
137:                    setSourceOutputDirectory(param);
138:                else if (arg == "-keep")
139:                    setKeep(true);
140:                else if (arg == "-verbose")
141:                    setVerbose(true);
142:                else if (arg == "-mapping")
143:                    setMapping(param);
144:                else {
145:                    if (param == null)
146:                        extraArguments.add(arg);
147:                    else
148:                        extraArguments.add(arg + " " + param);
149:                }
150:            }
151:
152:            public void addFeature(String feature) {
153:                // Deal with mutually exclusive features by removing the old one.
154:                if ("documentliteral".equals(feature)) {
155:                    features.remove("rpcliteral");
156:                } else if ("rpcliteral".equals(feature)) {
157:                    features.remove("documentliteral");
158:                } else if ("unwrap".equals(feature)) {
159:                    features.remove("donotunwrap");
160:                } else if ("donotunwrap".equals(feature)) {
161:                    features.remove("unwrap");
162:                }
163:                features.add(feature);
164:            }
165:
166:            public void removeFeature(String feature) {
167:                features.remove(feature);
168:            }
169:
170:            public boolean hasFeature(String feature) {
171:                return features.contains(feature);
172:            }
173:
174:            public void setSearchSchemaForSubtypes() {
175:                features.add("searchschema");
176:            }
177:
178:            public void setUseDataHandlerOnly() {
179:                features.add("datahandleronly");
180:            }
181:
182:            public String[] toArgs() {
183:                List args = new LinkedList();
184:
185:                if (gen != null) {
186:                    if (define || importGen)
187:                        throw new IllegalStateException(NbBundle.getMessage(
188:                                WSCompileArguments.class,
189:                                "MSG_MutuallyExclusiveGenDefineImport"));
190:                    if (gen.equals(""))
191:                        args.add("-gen");
192:                    else {
193:                        args.add("-gen:" + gen);
194:                    }
195:                }
196:                if (define) {
197:                    if (gen != null || importGen)
198:                        throw new IllegalStateException(NbBundle.getMessage(
199:                                WSCompileArguments.class,
200:                                "MSG_MutuallyExclusiveGenDefineImport"));
201:                    args.add("-define");
202:                }
203:                if (importGen) {
204:                    if (gen != null || define)
205:                        throw new IllegalStateException(NbBundle.getMessage(
206:                                WSCompileArguments.class,
207:                                "MSG_MutuallyExclusiveGenDefineImport"));
208:                    args.add("-import");
209:                }
210:                if (classpath != null) {
211:                    args.add("-classpath");
212:                    args.add(classpath);
213:                }
214:                if (mappingFile != null) {
215:                    args.add("-mapping");
216:                    args.add(mappingFile);
217:                }
218:                if (outputDirectory != null) {
219:                    args.add("-d");
220:                    args.add(outputDirectory);
221:                }
222:                if (nonclassOutputDirectory != null) {
223:                    args.add("-nd");
224:                    args.add(nonclassOutputDirectory);
225:                }
226:                if (sourceOutputDirectory != null) {
227:                    args.add("-s");
228:                    args.add(sourceOutputDirectory);
229:                }
230:                if (keep)
231:                    args.add("-keep");
232:                if (verbose)
233:                    args.add("-verbose");
234:                if (features.size() > 0) {
235:                    String featureArg = "-f:";
236:                    boolean first = true;
237:                    for (Iterator it = features.iterator(); it.hasNext();) {
238:                        if (first)
239:                            first = false;
240:                        else
241:                            featureArg += ",";
242:                        featureArg += (String) it.next();
243:                    }
244:                    args.add(featureArg);
245:                }
246:
247:                if (configuration != null) {
248:                    try {
249:                        File cf = File.createTempFile("jaxrpcconfigfile",
250:                                ".xml");
251:                        cf.deleteOnExit();
252:                        OutputStream out = new FileOutputStream(cf);
253:                        configuration.write(out);
254:                        out.close();
255:                        args.add(cf.getAbsolutePath());
256:                    } catch (IOException e) {
257:                        throw new RuntimeException(e);
258:                    }
259:                }
260:
261:                String[] result = new String[args.size()];
262:                return (String[]) args.toArray(result);
263:            }
264:
265:            /** Getter for property classpath.
266:             * @return Value of property classpath.
267:             *
268:             */
269:            public String getClasspath() {
270:                return this .classpath;
271:            }
272:
273:            /** Setter for property classpath.
274:             * @param classpath New value of property classpath.
275:             *
276:             */
277:            public void setClasspath(String classpath) {
278:                if (additionalClasspath == null)
279:                    this .classpath = classpath;
280:                else
281:                    this .classpath = classpath + File.pathSeparator
282:                            + additionalClasspath;
283:            }
284:
285:            public String getMapping() {
286:                return mappingFile;
287:            }
288:
289:            public void setMapping(String m) {
290:                mappingFile = m;
291:            }
292:
293:            /** Getter for property outputDirectory.
294:             * @return Value of property outputDirectory.
295:             *
296:             */
297:            public String getOutputDirectory() {
298:                return this .outputDirectory;
299:            }
300:
301:            /** Setter for property outputDirectory.
302:             * @param outputDirectory New value of property outputDirectory.
303:             *
304:             */
305:            public void setOutputDirectory(String outputDirectory) {
306:                this .outputDirectory = outputDirectory;
307:            }
308:
309:            public void setOutputDirectory(File outputDirectory) {
310:                this .outputDirectory = outputDirectory.getAbsolutePath();
311:            }
312:
313:            /** Getter for property gen.
314:             * @return Value of property gen.
315:             *
316:             */
317:            public String getGen() {
318:                return this .gen;
319:            }
320:
321:            /** Setter for property gen.
322:             * @param gen New value of property gen.
323:             *
324:             */
325:            public void setGen(String gen) {
326:                this .gen = gen;
327:            }
328:
329:            /** Getter for property keep.
330:             * @return Value of property keep.
331:             *
332:             */
333:            public boolean isKeep() {
334:                return this .keep;
335:            }
336:
337:            /** Setter for property keep.
338:             * @param keep New value of property keep.
339:             *
340:             */
341:            public void setKeep(boolean keep) {
342:                this .keep = keep;
343:            }
344:
345:            /** Getter for property nonclassOutputDirectory.
346:             * @return Value of property nonclassOutputDirectory.
347:             *
348:             */
349:            public String getNonclassOutputDirectory() {
350:                return this .nonclassOutputDirectory;
351:            }
352:
353:            /** Setter for property nonclassOutputDirectory.
354:             * @param nonclassOutputDirectory New value of property nonclassOutputDirectory.
355:             *
356:             */
357:            public void setNonclassOutputDirectory(
358:                    String nonclassOutputDirectory) {
359:                this .nonclassOutputDirectory = nonclassOutputDirectory;
360:            }
361:
362:            /** Getter for property sourceOutputDirectory.
363:             * @return Value of property sourceOutputDirectory.
364:             *
365:             */
366:            public String getSourceOutputDirectory() {
367:                return this .sourceOutputDirectory;
368:            }
369:
370:            /** Setter for property sourceOutputDirectory.
371:             * @param sourceOutputDirectory New value of property sourceOutputDirectory.
372:             *
373:             */
374:            public void setSourceOutputDirectory(String sourceOutputDirectory) {
375:                this .sourceOutputDirectory = sourceOutputDirectory;
376:            }
377:
378:            /** Getter for property define.
379:             * @return Value of property define.
380:             *
381:             */
382:            public boolean isDefine() {
383:                return this .define;
384:            }
385:
386:            /** Setter for property define.
387:             * @param define New value of property define.
388:             *
389:             */
390:            public void setDefine(boolean define) {
391:                this .define = define;
392:            }
393:
394:            /** Getter for property importGen.
395:             * @return Value of property importGen.
396:             *
397:             */
398:            public boolean isImportGen() {
399:                return this .importGen;
400:            }
401:
402:            /** Setter for property importGen.
403:             * @param importGen New value of property importGen.
404:             *
405:             */
406:            public void setImportGen(boolean importGen) {
407:                this .importGen = importGen;
408:            }
409:
410:            /** Getter for property verbose.
411:             * @return Value of property verbose.
412:             *
413:             */
414:            public boolean isVerbose() {
415:                return this .verbose;
416:            }
417:
418:            /** Setter for property verbose.
419:             * @param verbose New value of property verbose.
420:             *
421:             */
422:            public void setVerbose(boolean verbose) {
423:                this .verbose = verbose;
424:            }
425:
426:            public String toString() {
427:                String[] args = toArgs();
428:                String result = "";
429:                for (int i = 0; i < args.length; ++i) {
430:                    if (i > 0)
431:                        result += " ";
432:                    result += args[i];
433:                }
434:                return result;
435:            }
436:
437:            /** Getter for property configuration.
438:             * @return Value of property configuration.
439:             *
440:             */
441:            public Configuration getConfiguration() {
442:                return this .configuration;
443:            }
444:
445:            /** Setter for property configuration.
446:             * @param configuration New value of property configuration.
447:             *
448:             */
449:            public void setConfiguration(Configuration configuration) {
450:                this .configuration = configuration;
451:            }
452:
453:            /**
454:             * Create a Configuration object (if not there already) and set the WSDL
455:             * property.
456:             */
457:            public void prepConfigurationForWSDL(java.net.URL location,
458:                    java.lang.String packageName) {
459:                if (configuration == null)
460:                    configuration = new Configuration();
461:                if (configuration.getWsdl() == null)
462:                    configuration.setWsdl(new WsdlType(location, packageName));
463:                else {
464:                    configuration.getWsdl().setLocation(location);
465:                    configuration.getWsdl().setPackageName(packageName);
466:                }
467:            }
468:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.