Source Code Cross Referenced for JaxbXjcAction.java in  » Web-Services » soapui-1.7.5 » com » eviware » soapui » impl » wsdl » actions » iface » tools » jaxb » 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 » Web Services » soapui 1.7.5 » com.eviware.soapui.impl.wsdl.actions.iface.tools.jaxb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  soapUI, copyright (C) 2004-2007 eviware.com 
003:         *
004:         *  soapUI is free software; you can redistribute it and/or modify it under the 
005:         *  terms of version 2.1 of the GNU Lesser General Public License as published by 
006:         *  the Free Software Foundation.
007:         *
008:         *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
009:         *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
010:         *  See the GNU Lesser General Public License for more details at gnu.org.
011:         */
012:
013:        package com.eviware.soapui.impl.wsdl.actions.iface.tools.jaxb;
014:
015:        import java.io.File;
016:
017:        import com.eviware.soapui.SoapUI;
018:        import com.eviware.soapui.impl.wsdl.actions.iface.tools.support.AbstractToolsAction;
019:        import com.eviware.soapui.impl.wsdl.actions.iface.tools.support.ArgumentBuilder;
020:        import com.eviware.soapui.impl.wsdl.actions.iface.tools.support.ProcessToolRunner;
021:        import com.eviware.soapui.impl.wsdl.actions.iface.tools.support.ToolHost;
022:        import com.eviware.soapui.impl.wsdl.support.HelpUrls;
023:        import com.eviware.soapui.model.ModelItem;
024:        import com.eviware.soapui.model.iface.Interface;
025:        import com.eviware.soapui.model.project.Project;
026:        import com.eviware.soapui.settings.ToolsSettings;
027:        import com.eviware.soapui.support.Tools;
028:        import com.eviware.soapui.support.UISupport;
029:        import com.eviware.soapui.support.types.StringToStringMap;
030:        import com.eviware.x.form.XForm;
031:        import com.eviware.x.form.XFormDialog;
032:        import com.eviware.x.form.XFormDialogBuilder;
033:        import com.eviware.x.form.XFormFactory;
034:
035:        /**
036:         * Generates JAXB classes for given interface
037:         * 
038:         * @author Ole.Matzura
039:         */
040:
041:        public class JaxbXjcAction extends AbstractToolsAction<Interface> {
042:            private final static String PACKAGE = "package";
043:            private final static String OUTPUT = "output";
044:            private final static String NOVALIDATION = "no validation";
045:            private final static String BINDINGS = "binding files";
046:            private final static String CLASSPATH = "classpath";
047:            private final static String CATALOG = "catalog";
048:            private final static String HTTPPROXY = "http proxy";
049:            private final static String READONLY = "read-only";
050:            private final static String NPA = "npa";
051:            private final static String VERBOSE = "verbose";
052:            public static final String SOAPUI_ACTION_ID = "JaxbXjcAction";
053:
054:            // Configure the behavior of this action:
055:            private String output = null;
056:
057:            public JaxbXjcAction() {
058:                super ("JAXB 2.0 Artifacts", "Generates JAXB artifacts");
059:            }
060:
061:            @Override
062:            public boolean applies(ModelItem target) {
063:                Interface iface = (Interface) target;
064:                return !iface.getProject().hasNature(Project.JBOSSWS_NATURE_ID);
065:            }
066:
067:            /**
068:             * Set this to predefine the output directory instead of letting the user select.
069:             */
070:            public void setOutput(String output) {
071:                this .output = output;
072:            }
073:
074:            protected StringToStringMap initValues(Interface modelItem) {
075:                StringToStringMap values = super .initValues(modelItem);
076:
077:                if (output != null)
078:                    values.put(OUTPUT, output);
079:
080:                return values;
081:            }
082:
083:            protected XFormDialog buildDialog(Interface modelItem) {
084:                XFormDialogBuilder builder = XFormFactory
085:                        .createDialogBuilder("JAXB Artifacts");
086:
087:                XForm mainForm = builder.createForm("Basic");
088:                addWSDLFields(mainForm, modelItem);
089:
090:                mainForm.addTextField(OUTPUT,
091:                        "generated files will go into this directory",
092:                        XForm.FieldType.PROJECT_FOLDER);
093:                mainForm.addTextField(PACKAGE, "the target package",
094:                        XForm.FieldType.JAVA_PACKAGE);
095:
096:                mainForm.addTextField(BINDINGS,
097:                        "external bindings file(s), comma-separated",
098:                        XForm.FieldType.PROJECT_FILE);
099:                mainForm.addTextField(CATALOG,
100:                        "catalog files to resolve external entity references",
101:                        XForm.FieldType.PROJECT_FILE);
102:                mainForm.addTextField(CLASSPATH,
103:                        "where to find user class files",
104:                        XForm.FieldType.PROJECT_FOLDER);
105:
106:                mainForm
107:                        .addTextField(
108:                                HTTPPROXY,
109:                                "set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost[:proxyPort]",
110:                                XForm.FieldType.TEXT);
111:                mainForm.addCheckBox(READONLY,
112:                        "(generated files will be in read-only mode)");
113:                mainForm
114:                        .addCheckBox(NOVALIDATION,
115:                                "(do not perform strict validation of the input schema(s))");
116:                mainForm
117:                        .addCheckBox(NPA,
118:                                "(suppress generation of package level annotations (**/package-info.java))");
119:
120:                mainForm.addCheckBox(VERBOSE, "(be extra verbose)");
121:
122:                buildArgsForm(builder, false, "xjc");
123:
124:                return builder.buildDialog(buildDefaultActions(
125:                        HelpUrls.JABXJC_HELP_URL, modelItem),
126:                        "Specify arguments for the JAXB 2 xjc compiler",
127:                        UISupport.TOOL_ICON);
128:            }
129:
130:            protected void generate(StringToStringMap values,
131:                    ToolHost toolHost, Interface modelItem) throws Exception {
132:                String jaxbDir = SoapUI.getSettings().getString(
133:                        ToolsSettings.JAXB_LOCATION, null);
134:                if (Tools.isEmpty(jaxbDir)) {
135:                    UISupport
136:                            .showErrorMessage("JAXB location must be set in global preferences");
137:                    return;
138:                }
139:
140:                ProcessBuilder builder = new ProcessBuilder();
141:                builder.command(buildArgs(modelItem).getArgs());
142:                builder
143:                        .directory(new File(jaxbDir + File.separatorChar
144:                                + "bin"));
145:
146:                toolHost.run(new ProcessToolRunner(builder, "JAXB xjc",
147:                        modelItem));
148:            }
149:
150:            private ArgumentBuilder buildArgs(Interface modelItem) {
151:                StringToStringMap values = dialog.getValues();
152:                ArgumentBuilder builder = new ArgumentBuilder(values);
153:
154:                builder.startScript("xjc", ".bat", ".sh");
155:
156:                String outputValue = (output != null ? output : values
157:                        .get(OUTPUT));
158:                values.put(OUTPUT, Tools.ensureDir(outputValue, ""));
159:
160:                builder.addString(OUTPUT, "-d");
161:                builder.addString(PACKAGE, "-p");
162:                builder.addString(CLASSPATH, "-classpath");
163:                builder.addString(CATALOG, "-catalog");
164:                builder.addString(HTTPPROXY, "-httpproxy ");
165:
166:                builder.addBoolean(NOVALIDATION, "-nv");
167:                builder.addBoolean(NPA, "-npa");
168:                builder.addBoolean(READONLY, "-readOnly");
169:                builder.addBoolean(VERBOSE, "-verbose");
170:
171:                addToolArgs(values, builder);
172:
173:                builder.addArgs("-wsdl", getWsdlUrl(values, modelItem));
174:
175:                String[] bindings = values.get(BINDINGS).split(",");
176:                for (String binding : bindings) {
177:                    if (binding.trim().length() > 0)
178:                        builder.addArgs("-b", binding.trim());
179:                }
180:
181:                return builder;
182:            }
183:        }
w__w_w___.___j___av__a__2s._c_o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.