Source Code Cross Referenced for WsdlDocument.java in  » ESB » open-esb » com » sun » jbi » messaging » 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 » ESB » open esb » com.sun.jbi.messaging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)WsdlDocument.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.messaging;
030:
031:        import com.sun.jbi.wsdl2.*;
032:        import com.sun.jbi.wsdl2.impl.WsdlFactory;
033:        import java.io.File;
034:        import javax.xml.namespace.QName;
035:        import javax.xml.parsers.DocumentBuilder;
036:        import javax.xml.parsers.DocumentBuilderFactory;
037:
038:        import org.w3c.dom.Document;
039:
040:        /** This class generates the default WSDL definition used by NMR tests.  
041:         *  Constants are supplied to protect individual tests from name changes
042:         *  in the underlying WSDL document.
043:         * @author Sun Microsystems, Inc.
044:         */
045:        public class WsdlDocument {
046:            /** Path to default WSDL definition. */
047:            public static final String WSDL_20_DEFINITION = System
048:                    .getProperty("junit.srcroot")
049:                    + "/nms/regress/regress20.wsdl";
050:
051:            public static final String WSDL_11_DEFINITION = System
052:                    .getProperty("junit.srcroot")
053:                    + "/nms/regress/regress11.wsdl";
054:
055:            public static final String NS_URI = "http://example.com/wsdl";
056:            /** NCNames */
057:            public static final String HELLO_C_INTERFACE = "hellocity";
058:            public static final String HELLO_W_INTERFACE = "helloworld";
059:            public static final String HELLO_C_OPERATION_1 = "helloPhoenix";
060:            public static final String HELLO_C_OPERATION_2 = "helloTempe";
061:            public static final String HELLO_W_OPERATION = "helloEarth";
062:            public static final String HELLO_BINDING = "hellobinding";
063:            public static final String HELLO_SERVICE = "helloservice";
064:            public static final String HELLO_ENDPOINT_1 = "helloendpoint1";
065:            public static final String HELLO_ENDPOINT_2 = "helloendpoint2";
066:
067:            public static final String STOCK_INTERFACE = "StockQuote";
068:            public static final String STOCK_OPERATION = "GetLastTradePrice";
069:            public static final String STOCK_BINDING = "StockQuoteBinding";
070:            public static final String STOCK_SERVICE = "StockQuoteService";
071:            public static final String STOCK_ENDPOINT = "StockQuotePort";
072:
073:            /** QNames */
074:            public static final QName HELLO_C_INTERFACE_Q = new QName(NS_URI,
075:                    HELLO_C_INTERFACE);
076:            public static final QName HELLO_W_INTERFACE_Q = new QName(NS_URI,
077:                    HELLO_W_INTERFACE);
078:            public static final QName STOCK_INTERFACE_Q = new QName(NS_URI,
079:                    STOCK_INTERFACE);
080:            public static final QName HELLO_C_OPERATION_1_Q = new QName(NS_URI,
081:                    HELLO_C_OPERATION_1);
082:            public static final QName HELLO_C_OPERATION_2_Q = new QName(NS_URI,
083:                    HELLO_C_OPERATION_2);
084:            public static final QName HELLO_W_OPERATION_Q = new QName(NS_URI,
085:                    HELLO_W_OPERATION);
086:            public static final QName STOCK_OPERATION_Q = new QName(NS_URI,
087:                    STOCK_OPERATION);
088:            public static final QName HELLO_SERVICE_Q = new QName(NS_URI,
089:                    HELLO_SERVICE);
090:            public static final QName STOCK_SERVICE_Q = new QName(NS_URI,
091:                    STOCK_SERVICE);
092:
093:            public static void main(String[] args) throws Exception {
094:                WsdlFactory factory;
095:                Description defs;
096:
097:                factory = WsdlFactory.newInstance();
098:
099:                defs = createDefinition(factory);
100:
101:                if (args.length == 1) {
102:                    writeDefinition(factory, defs, args[0]);
103:                } else {
104:                    writeDefinition(factory, defs, WSDL_20_DEFINITION);
105:                }
106:
107:                /*
108:                defs = readDefinition(factory, args[0]);
109:                System.out.println(defs.getService(0).getQName());
110:                 */
111:            }
112:
113:            public static Description createDefinition(WsdlFactory wf)
114:                    throws Exception {
115:                Description d;
116:                Interface hellocity;
117:                Interface helloworld;
118:                Interface stockquote;
119:                InterfaceOperation hellocity1;
120:                InterfaceOperation hellocity2;
121:                InterfaceOperation helloworld1;
122:                InterfaceOperation stockquote1;
123:                com.sun.jbi.wsdl2.Binding hellobinding;
124:                com.sun.jbi.wsdl2.Binding stockbinding;
125:                Service helloservice;
126:                Service stockservice;
127:                Endpoint helloendpoint1;
128:                Endpoint helloendpoint2;
129:                Endpoint stockendpoint1;
130:
131:                d = wf.newDescription(NS_URI);
132:
133:                /**
134:                 *   INTERFACES
135:                 */
136:                hellocity = d.addNewInterface(HELLO_C_INTERFACE);
137:                helloworld = d.addNewInterface(HELLO_W_INTERFACE);
138:                stockquote = d.addNewInterface(STOCK_INTERFACE);
139:                /** The next line doesn't seem to work, so I just edit the output by hand. */
140:                //helloworld.appendInterface(hellocity);
141:                /**
142:                 *   BINDINGS
143:                 */
144:                hellobinding = d.addNewBinding(HELLO_BINDING);
145:                stockbinding = d.addNewBinding(STOCK_BINDING);
146:                hellobinding.setType(HELLO_BINDING);
147:                stockbinding.setType(STOCK_BINDING);
148:
149:                /**
150:                 *   OPERATIONS
151:                 */
152:                hellocity1 = hellocity.addNewOperation();
153:                hellocity2 = hellocity.addNewOperation();
154:                helloworld1 = helloworld.addNewOperation();
155:                stockquote1 = stockquote.addNewOperation();
156:                hellocity1.setPattern(ExchangePattern.IN_ONLY.toString());
157:                hellocity2.setPattern(ExchangePattern.IN_OUT.toString());
158:                helloworld1.setPattern(ExchangePattern.IN_OPTIONAL_OUT
159:                        .toString());
160:                stockquote1.setPattern(ExchangePattern.ROBUST_IN_ONLY
161:                        .toString());
162:                hellocity1.setName(HELLO_C_OPERATION_1);
163:                hellocity2.setName(HELLO_C_OPERATION_2);
164:                helloworld1.setName(HELLO_W_OPERATION);
165:                stockquote1.setName(STOCK_OPERATION);
166:
167:                /**
168:                 *   SERVICES
169:                 */
170:                helloservice = d.addNewService(HELLO_SERVICE);
171:                stockservice = d.addNewService(STOCK_SERVICE);
172:                helloservice.setInterface(helloworld);
173:                stockservice.setInterface(stockquote);
174:
175:                /**
176:                 *  ENDPOINTS
177:                 */
178:                helloendpoint1 = helloservice.addNewEndpoint(HELLO_ENDPOINT_1,
179:                        hellobinding);
180:                helloendpoint2 = helloservice.addNewEndpoint(HELLO_ENDPOINT_2,
181:                        hellobinding);
182:                stockendpoint1 = stockservice.addNewEndpoint(STOCK_ENDPOINT,
183:                        stockbinding);
184:                helloendpoint1.setBinding(hellobinding);
185:                helloendpoint2.setBinding(hellobinding);
186:                stockendpoint1.setBinding(stockbinding);
187:
188:                return d;
189:            }
190:
191:            public static void writeDefinition(WsdlFactory wf, Description def,
192:                    String path) throws Exception {
193:                WsdlWriter ww = wf.newWsdlWriter();
194:                ww.writeDescription(def, new java.io.FileOutputStream(path));
195:            }
196:
197:            public static Description readDefinition(WsdlFactory wf, String path)
198:                    throws Exception {
199:                WsdlReader wr = wf.newWsdlReader();
200:                return wr
201:                        .readDescription("c:/development/jbi/nms/bld/regress/regress.wsdl");
202:            }
203:
204:            public static Document readDocument(String path) throws Exception {
205:                DocumentBuilderFactory dbf;
206:                DocumentBuilder db;
207:                Document d;
208:
209:                dbf = DocumentBuilderFactory.newInstance();
210:                dbf.setNamespaceAware(true);
211:                db = dbf.newDocumentBuilder();
212:                d = db.parse(new File(path));
213:
214:                return d;
215:            }
216:
217:            public static Document readDefaultDocument() throws Exception {
218:                return readDocument(WSDL_20_DEFINITION);
219:            }
220:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.