Source Code Cross Referenced for JOnASWSDL2Java.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ws » wsgen » generator » axis » wsdl2java » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_ws.wsgen.generator.axis.wsdl2java 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JOnASWSDL2Java.java 5401 2004-09-09 16:12:37Z sauthieg $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ws.wsgen.generator.axis.wsdl2java;
025:
026:        import java.io.File;
027:        import java.io.IOException;
028:        import java.util.HashMap;
029:        import java.util.Iterator;
030:        import java.util.Map;
031:
032:        import javax.wsdl.WSDLException;
033:        import javax.xml.parsers.DocumentBuilder;
034:        import javax.xml.parsers.DocumentBuilderFactory;
035:        import javax.xml.parsers.ParserConfigurationException;
036:
037:        import org.w3c.dom.Document;
038:        import org.xml.sax.SAXException;
039:
040:        import org.apache.axis.wsdl.WSDL2Java;
041:        import org.apache.axis.wsdl.gen.Parser;
042:
043:        import org.objectweb.jonas_ws.wsgen.WsGenException;
044:        import org.objectweb.jonas_ws.wsgen.generator.axis.AxisWsClientGenerator;
045:
046:        /**
047:         * Programmatic interface to the WSDL2Java Axis tool.
048:         * @author Guillaume Sauthier
049:         */
050:        public class JOnASWSDL2Java extends WSDL2Java {
051:
052:            /**
053:             * Field emitter
054:             */
055:            private JOnASEmitter jEmitter;
056:
057:            /**
058:             * WSDL Localtion URL
059:             */
060:            private String wsdlURL = null;
061:
062:            /**
063:             * Parsed WSDL Document
064:             */
065:            private Document wsdlDoc = null;
066:
067:            /**
068:             * JOnASWSDL2Java Constructor.
069:             */
070:            public JOnASWSDL2Java() {
071:                super ();
072:                // just cast it once
073:                jEmitter = (JOnASEmitter) getParser();
074:            }
075:
076:            /**
077:             * @return Returns an extension of the Parser
078:             */
079:            protected Parser createParser() {
080:                return new JOnASEmitter();
081:            } // createParser
082:
083:            /**
084:             * Setup the JOnASWSDL2Java generator.
085:             * @param wsc WsClientGenerator from wich the configuration will be read.
086:             * @throws WsGenException Cannot parse WSDL Document
087:             */
088:            private void setup(AxisWsClientGenerator wsc) throws WsGenException {
089:                setupEmitter(wsc);
090:                setupWSDL(wsc);
091:            }
092:
093:            /**
094:             * Setup the WSDL Document before giving it to the Emitter.
095:             * @param wsc configuration
096:             * @throws WsGenException Cannot load WSDL
097:             */
098:            private void setupWSDL(AxisWsClientGenerator wsc)
099:                    throws WsGenException {
100:                try {
101:                    if (wsc.getArchive().isPacked()) {
102:                        // URL Loading
103:                        String jarpath = wsc.getArchive().getRootFile()
104:                                .getCanonicalFile().toURL().toExternalForm();
105:                        wsdlURL = "jar:" + jarpath + "!/"
106:                                + wsc.getRef().getWsdlFileName();
107:                    } else {
108:                        // File Loading
109:                        wsdlURL = new File(wsc.getArchive().getRootFile(), wsc
110:                                .getRef().getWsdlFileName()).toURL()
111:                                .toExternalForm();
112:                    }
113:
114:                    DocumentBuilderFactory factory = DocumentBuilderFactory
115:                            .newInstance();
116:                    factory.setNamespaceAware(true);
117:                    DocumentBuilder builder = factory.newDocumentBuilder();
118:                    wsdlDoc = builder.parse(wsdlURL);
119:                } catch (ParserConfigurationException pce) {
120:                    throw new WsGenException("", pce);
121:                } catch (IOException ioe) {
122:                    throw new WsGenException("", ioe);
123:                } catch (SAXException se) {
124:                    throw new WsGenException("", se);
125:                }
126:            }
127:
128:            /**
129:             * Setup the JOnASEmitter instance.
130:             * @param wsc configuration
131:             */
132:            private void setupEmitter(AxisWsClientGenerator wsc) {
133:                jEmitter.setDebug(wsc.getConfig().isDebug());
134:                jEmitter.setVerbose(wsc.getConfig().isVerbose());
135:                jEmitter.setNamespaceMap(convert2HashMap(wsc.getRef()
136:                        .getMappingFile().getMappings()));
137:                jEmitter.setOutputDir(wsc.getSources().getPath());
138:            }
139:
140:            /**
141:             * Converts Hashtable to HashMap.
142:             * @param m Hashtable to be converted
143:             * @return HashMap converted
144:             */
145:            private HashMap convert2HashMap(Map m) {
146:                HashMap ns2pkg = new HashMap();
147:                for (Iterator i = m.keySet().iterator(); i.hasNext();) {
148:                    String ns = (String) i.next();
149:                    ns2pkg.put(ns, m.get(ns));
150:                }
151:                return ns2pkg;
152:            }
153:
154:            /**
155:             * Setup and runs the JOnASEmitter.
156:             *
157:             * @param wsc Configuration.
158:             *
159:             * @throws WsGenException When WSDL has not been properly parsed
160:             * @throws SAXException Cannot parse WSDL document
161:             * @throws WSDLException When WSDL is incorrect
162:             * @throws ParserConfigurationException Cannot Configure Parser
163:             * @throws IOException Import URL cannot be loaded
164:             */
165:            public void run(AxisWsClientGenerator wsc) throws WsGenException,
166:                    IOException, SAXException, WSDLException,
167:                    ParserConfigurationException {
168:                setup(wsc);
169:                parser.run(wsdlURL, wsdlDoc);
170:            } // run
171:
172:        }
ww__w.j___av___a__2___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.