Source Code Cross Referenced for WsMetaData.java in  » J2EE » openejb3 » org » apache » openejb » client » 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 » openejb3 » org.apache.openejb.client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *
003:         * Licensed to the Apache Software Foundation (ASF) under one or more
004:         * contributor license agreements.  See the NOTICE file distributed with
005:         * this work for additional information regarding copyright ownership.
006:         * The ASF licenses this file to You under the Apache License, Version 2.0
007:         * (the "License"); you may not use this file except in compliance with
008:         * the License.  You may obtain a copy of the License at
009:         *
010:         *     http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         *  Unless required by applicable law or agreed to in writing, software
013:         *  distributed under the License is distributed on an "AS IS" BASIS,
014:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         *  See the License for the specific language governing permissions and
016:         *  limitations under the License.
017:         */package org.apache.openejb.client;
018:
019:        import javax.naming.InitialContext;
020:        import javax.naming.NamingException;
021:        import javax.xml.namespace.QName;
022:        import javax.xml.ws.Service;
023:        import javax.xml.ws.handler.HandlerResolver;
024:        import java.net.URL;
025:        import java.util.List;
026:        import java.util.ArrayList;
027:        import java.io.Serializable;
028:
029:        public class WsMetaData implements  Serializable {
030:            private static final long serialVersionUID = -895152184216070327L;
031:            private String serviceClassName;
032:            private String referenceClassName;
033:            private String wsdlUrl;
034:            private String serviceQName;
035:            private final List<HandlerChainMetaData> handlerChains = new ArrayList<HandlerChainMetaData>();
036:            private final List<PortRefMetaData> portRefs = new ArrayList<PortRefMetaData>();
037:
038:            public String getServiceClassName() {
039:                return serviceClassName;
040:            }
041:
042:            public void setServiceClassName(String serviceClassName) {
043:                this .serviceClassName = serviceClassName;
044:            }
045:
046:            public String getReferenceClassName() {
047:                return referenceClassName;
048:            }
049:
050:            public void setReferenceClassName(String referenceClassName) {
051:                this .referenceClassName = referenceClassName;
052:            }
053:
054:            public String getWsdlUrl() {
055:                return wsdlUrl;
056:            }
057:
058:            public void setWsdlUrl(String wsdlUrl) {
059:                this .wsdlUrl = wsdlUrl;
060:            }
061:
062:            public String getServiceQName() {
063:                return serviceQName;
064:            }
065:
066:            public void setServiceQName(String serviceQName) {
067:                this .serviceQName = serviceQName;
068:            }
069:
070:            public List<HandlerChainMetaData> getHandlerChains() {
071:                return handlerChains;
072:            }
073:
074:            public List<PortRefMetaData> getPortRefs() {
075:                return portRefs;
076:            }
077:
078:            public Object createWebservice() throws Exception {
079:                // load service class which is used to construct the port
080:                Class<? extends Service> serviceClass = loadClass(
081:                        serviceClassName).asSubclass(Service.class);
082:                if (serviceClass == null) {
083:                    throw new NamingException(
084:                            "Could not load service type class "
085:                                    + serviceClassName);
086:                }
087:
088:                // load the reference class which is the ultimate type of the port
089:                Class<?> referenceClass = loadClass(referenceClassName);
090:
091:                // if ref class is a subclass of Service, use it for the service class
092:                if (referenceClass != null
093:                        && Service.class.isAssignableFrom(referenceClass)) {
094:                    serviceClass = referenceClass.asSubclass(Service.class);
095:                }
096:
097:                // Service QName
098:                QName serviceQName = QName.valueOf(this .serviceQName);
099:
100:                // WSDL URL
101:                URL wsdlLocation = new URL(this .wsdlUrl);
102:
103:                JaxWsProviderWrapper.beforeCreate(portRefs);
104:                Service instance;
105:                try {
106:                    instance = null;
107:                    if (Service.class.equals(serviceClass)) {
108:                        instance = Service.create(wsdlLocation, serviceQName);
109:                    } else {
110:                        try {
111:                            instance = serviceClass.getConstructor(URL.class,
112:                                    QName.class).newInstance(wsdlLocation,
113:                                    serviceQName);
114:                        } catch (Throwable e) {
115:                            throw (NamingException) new NamingException(
116:                                    "Could not instantiate jax-ws service class "
117:                                            + serviceClass.getName())
118:                                    .initCause(e);
119:                        }
120:                    }
121:                } finally {
122:                    JaxWsProviderWrapper.afterCreate();
123:                }
124:
125:                if (handlerChains != null && !handlerChains.isEmpty()) {
126:                    InjectionMetaData injectionMetaData = ClientInstance.get()
127:                            .getComponent(InjectionMetaData.class);
128:                    List<Injection> injections = injectionMetaData
129:                            .getInjections();
130:                    HandlerResolver handlerResolver = new ClientHandlerResolverImpl(
131:                            handlerChains, injections, new InitialContext());
132:                    instance.setHandlerResolver(handlerResolver);
133:                }
134:
135:                Object port;
136:                if (referenceClass != null
137:                        && !Service.class.isAssignableFrom(referenceClass)) {
138:                    // do port lookup
139:                    port = instance.getPort(referenceClass);
140:                } else {
141:                    // return service
142:                    port = instance;
143:                }
144:                return port;
145:            }
146:
147:            public static Class<?> loadClass(String className) {
148:                if (className == null)
149:                    return null;
150:                try {
151:                    ClassLoader classLoader = Thread.currentThread()
152:                            .getContextClassLoader();
153:                    if (classLoader != null) {
154:                        try {
155:                            Class clazz = classLoader.loadClass(className);
156:                            return clazz;
157:                        } catch (ClassNotFoundException e) {
158:                        }
159:                    }
160:                    return Class.forName(className);
161:                } catch (ClassNotFoundException e) {
162:                    return null;
163:                }
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.