Source Code Cross Referenced for XmlBeans2Action.java in  » Web-Services » soapui-1.7.5 » com » eviware » soapui » impl » wsdl » actions » iface » tools » xmlbeans » 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.xmlbeans 
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.xmlbeans;
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.settings.ToolsSupport;
028:        import com.eviware.soapui.support.Tools;
029:        import com.eviware.soapui.support.UISupport;
030:        import com.eviware.soapui.support.types.StringToStringMap;
031:        import com.eviware.x.form.XForm;
032:        import com.eviware.x.form.XFormDialog;
033:        import com.eviware.x.form.XFormDialogBuilder;
034:        import com.eviware.x.form.XFormFactory;
035:
036:        /**
037:         * Generates XMLBeans for given interface
038:         * 
039:         * @author Ole.Matzura
040:         */
041:
042:        public class XmlBeans2Action extends AbstractToolsAction<Interface> {
043:            private final static String XSBTARGET = "class/xsb target";
044:            private final static String SRCTARGET = "src target";
045:            private final static String SRCONLY = "src only";
046:            private final static String JARFILE = "out jar";
047:            private final static String DOWNLOADS = "downloads";
048:            private final static String NOUPA = "noupa";
049:            private final static String NOPVR = "nopvr";
050:            private final static String NOANN = "noann";
051:            private final static String NOVDOC = "novdoc";
052:            private final static String VERBOSE = "verbose";
053:            private final static String JAVASOURCE = "javasource";
054:            private final static String DEBUG = "debug";
055:            private final static String ALLOWMDEF = "allowmdef";
056:            private final static String CATALOG = "catalog file";
057:            private final static String XSDCONFIG = "xsdconfig";
058:            public static final String SOAPUI_ACTION_ID = "XmlBeans2Action";
059:            private String output;
060:
061:            public XmlBeans2Action() {
062:                super ("XmlBeans Classes", "Generates XmlBeans classes");
063:            }
064:
065:            @Override
066:            public boolean applies(ModelItem target) {
067:                Interface iface = (Interface) target;
068:                return !iface.getProject().hasNature(Project.JBOSSWS_NATURE_ID);
069:            }
070:
071:            protected StringToStringMap initValues(Interface modelItem) {
072:                StringToStringMap values = super .initValues(modelItem);
073:                if (output != null)
074:                    values.put(SRCTARGET, output);
075:
076:                return values;
077:            }
078:
079:            protected XFormDialog buildDialog(Interface modelItem) {
080:                XFormDialogBuilder builder = XFormFactory
081:                        .createDialogBuilder("XmlBeans Classes");
082:
083:                XForm mainForm = builder.createForm("Basic");
084:                addWSDLFields(mainForm, modelItem);
085:
086:                mainForm.addTextField(XSBTARGET,
087:                        "Target directory for CLASS and XSB files",
088:                        XForm.FieldType.PROJECT_FOLDER);
089:                mainForm.addTextField(SRCTARGET,
090:                        "Target directory for generated JAVA files",
091:                        XForm.FieldType.PROJECT_FOLDER);
092:                mainForm
093:                        .addTextField(
094:                                JARFILE,
095:                                "The name of the output JAR that will contain the result of compilation",
096:                                XForm.FieldType.PROJECT_FILE);
097:
098:                mainForm.addCheckBox(SRCONLY,
099:                        "(Do not compile JAVA files or jar the output)");
100:                mainForm.addCheckBox(DOWNLOADS,
101:                        "(Permit network downloads for imports and includes)");
102:                mainForm
103:                        .addCheckBox(NOUPA,
104:                                "(Do not enforce the unique particle attribution rule)");
105:                mainForm
106:                        .addCheckBox(NOPVR,
107:                                "(Do not enforce the particle valid (restriction) rule)");
108:                mainForm.addCheckBox(NOANN, "(Ignore annotations)");
109:                mainForm
110:                        .addCheckBox(NOVDOC,
111:                                "(Do not validate contents of <documentation> elements)");
112:                mainForm.addCheckBox(DEBUG, "(Compile with debug symbols)");
113:
114:                mainForm
115:                        .addComboBox(JAVASOURCE, new String[] { "1.5", "1.4" },
116:                                "Generate Java source compatible for the specified Java version");
117:
118:                mainForm
119:                        .addTextField(
120:                                ALLOWMDEF,
121:                                "Ignore multiple defs in given namespaces. Use  ##local  to specify the no-namespace in that list",
122:                                XForm.FieldType.TEXT);
123:                mainForm.addTextField(CATALOG,
124:                        "Catalog file to use for resolving external entities",
125:                        XForm.FieldType.PROJECT_FILE);
126:                mainForm
127:                        .addTextField(
128:                                XSDCONFIG,
129:                                "Path to .xsdconfig file containing type-mapping information",
130:                                XForm.FieldType.PROJECT_FILE);
131:
132:                mainForm.addCheckBox(VERBOSE,
133:                        "(Print more informational messages)");
134:
135:                buildArgsForm(builder, false, "scomp");
136:
137:                return builder.buildDialog(buildDefaultActions(
138:                        HelpUrls.XMLBEANS_HELP_URL, modelItem),
139:                        "Specify arguments for XmlBeans 2.X scomp",
140:                        UISupport.TOOL_ICON);
141:            }
142:
143:            protected void generate(StringToStringMap values,
144:                    ToolHost toolHost, Interface modelItem) throws Exception {
145:                String xbDir = SoapUI.getSettings().getString(
146:                        ToolsSettings.XMLBEANS_LOCATION, null);
147:                if (Tools.isEmpty(xbDir)) {
148:                    UISupport
149:                            .showErrorMessage("XmlBeans location must be set in global preferences");
150:                    return;
151:                }
152:
153:                ProcessBuilder builder = new ProcessBuilder();
154:                builder.command(buildArgs(modelItem).getArgs());
155:                builder.directory(new File(xbDir + File.separatorChar + "bin"));
156:
157:                toolHost.run(new ProcessToolRunner(builder, "XmlBeans",
158:                        modelItem));
159:            }
160:
161:            private ArgumentBuilder buildArgs(Interface modelItem) {
162:                StringToStringMap values = dialog.getValues();
163:                ArgumentBuilder builder = new ArgumentBuilder(values);
164:
165:                values.put(XSBTARGET, Tools
166:                        .ensureDir(values.get(XSBTARGET), ""));
167:                values.put(SRCTARGET, Tools
168:                        .ensureDir(values.get(SRCTARGET), ""));
169:
170:                builder.startScript("scomp", ".cmd", "");
171:
172:                builder.addString(XSBTARGET, "-d");
173:                builder.addString(SRCTARGET, "-src");
174:                builder.addString(JARFILE, "-out");
175:
176:                builder.addBoolean(SRCONLY, "-srconly");
177:                builder.addBoolean(DOWNLOADS, "-dl");
178:                builder.addBoolean(NOUPA, "-noupa");
179:                builder.addBoolean(NOPVR, "-nopvr");
180:                builder.addBoolean(NOANN, "-noann");
181:                builder.addBoolean(NOVDOC, "-novdoc");
182:                builder.addBoolean(DEBUG, "-debug");
183:
184:                builder.addString(JAVASOURCE, "-javasource");
185:                builder.addString(ALLOWMDEF, "-allowmdef");
186:                builder.addString(CATALOG, "-catalog");
187:                builder.addBoolean(VERBOSE, "-verbose");
188:
189:                String javac = ToolsSupport.getToolLocator().getJavacLocation(
190:                        false);
191:
192:                if (javac != null) {
193:                    builder.addArgs("-compiler", javac + File.separatorChar
194:                            + "javac");
195:                }
196:                addToolArgs(values, builder);
197:
198:                builder.addString(XSDCONFIG, null);
199:                builder.addArgs(getWsdlUrl(values, modelItem));
200:
201:                return builder;
202:            }
203:
204:            public void setOutput(String output) {
205:                this.output = output;
206:            }
207:        }
w___ww__.ja__va2___s__._c_o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.