Source Code Cross Referenced for CxfEndpoint.java in  » J2EE » openejb3 » org » apache » openejb » server » cxf » 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.server.cxf 
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.server.cxf;
018:
019:        import org.apache.cxf.Bus;
020:        import org.apache.cxf.endpoint.Server;
021:        import org.apache.cxf.endpoint.ServerImpl;
022:        import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
023:        import org.apache.cxf.jaxws.handler.PortInfoImpl;
024:        import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
025:        import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
026:        import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
027:        import org.apache.cxf.service.Service;
028:        import org.apache.openejb.core.webservices.HandlerResolverImpl;
029:        import org.apache.openejb.core.webservices.PortData;
030:        import org.w3c.dom.Element;
031:
032:        import javax.xml.transform.Source;
033:        import javax.xml.ws.Binding;
034:        import javax.xml.ws.Endpoint;
035:        import javax.xml.ws.EndpointReference;
036:        import javax.xml.ws.handler.Handler;
037:        import javax.xml.ws.http.HTTPBinding;
038:        import javax.xml.ws.soap.SOAPBinding;
039:        import javax.naming.Context;
040:        import java.net.MalformedURLException;
041:        import java.net.URL;
042:        import java.util.List;
043:        import java.util.Map;
044:        import java.util.concurrent.Executor;
045:
046:        public abstract class CxfEndpoint extends Endpoint {
047:            protected Bus bus;
048:
049:            protected PortData port;
050:
051:            protected Context context;
052:
053:            protected Object implementor;
054:
055:            protected Server server;
056:
057:            protected Service service;
058:
059:            protected JaxWsImplementorInfo implInfo;
060:
061:            protected JaxWsServiceFactoryBean serviceFactory;
062:
063:            protected HandlerResolverImpl handlerResolver;
064:
065:            public CxfEndpoint(Bus bus, PortData port, Context context,
066:                    Object implementor) {
067:                this .bus = bus;
068:                this .port = port;
069:                this .implementor = implementor;
070:                this .context = context;
071:            }
072:
073:            protected URL getWsdlURL(URL configurationBaseUrl, String wsdlFile) {
074:                URL wsdlURL = null;
075:                if (wsdlFile != null && wsdlFile.trim().length() > 0) {
076:                    wsdlFile = wsdlFile.trim();
077:                    try {
078:                        wsdlURL = new URL(wsdlFile);
079:                    } catch (MalformedURLException e) {
080:                        // Not a URL, try as a resource
081:                        wsdlURL = getImplementorClass().getResource(
082:                                "/" + wsdlFile);
083:
084:                        if (wsdlURL == null && configurationBaseUrl != null) {
085:                            // Cannot get it as a resource, try with
086:                            // configurationBaseUrl
087:                            try {
088:                                wsdlURL = new URL(configurationBaseUrl,
089:                                        wsdlFile);
090:                            } catch (MalformedURLException ee) {
091:                                // ignore
092:                            }
093:                        }
094:                    }
095:                }
096:                return wsdlURL;
097:            }
098:
099:            protected Class getImplementorClass() {
100:                return this .implementor.getClass();
101:            }
102:
103:            protected org.apache.cxf.endpoint.Endpoint getEndpoint() {
104:                return getServer().getEndpoint();
105:            }
106:
107:            public boolean isSOAP11() {
108:                return SOAPBinding.SOAP11HTTP_BINDING.equals(implInfo
109:                        .getBindingType())
110:                        || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(implInfo
111:                                .getBindingType());
112:            }
113:
114:            public ServerImpl getServer() {
115:                return (ServerImpl) server;
116:            }
117:
118:            public Binding getBinding() {
119:                return ((JaxWsEndpointImpl) getEndpoint()).getJaxwsBinding();
120:            }
121:
122:            public void setExecutor(Executor executor) {
123:                service.setExecutor(executor);
124:            }
125:
126:            public Executor getExecutor() {
127:                return service.getExecutor();
128:            }
129:
130:            public Object getImplementor() {
131:                return implementor;
132:            }
133:
134:            public List<Source> getMetadata() {
135:                return null;
136:            }
137:
138:            public Map<String, Object> getProperties() {
139:                return null;
140:            }
141:
142:            public boolean isPublished() {
143:                return server != null;
144:            }
145:
146:            public void publish(Object arg0) {
147:            }
148:
149:            public void publish(String address) {
150:                doPublish(address);
151:            }
152:
153:            public void setMetadata(List<Source> arg0) {
154:            }
155:
156:            public void setProperties(Map<String, Object> arg0) {
157:            }
158:
159:            @SuppressWarnings({"UnusedDeclaration"})
160:            public EndpointReference getEndpointReference(
161:                    Element... referenceParameters) {
162:                throw new UnsupportedOperationException(
163:                        "JaxWS 2.1 APIs are not supported");
164:            }
165:
166:            @SuppressWarnings({"UnusedDeclaration"})
167:            public <T extends EndpointReference> T getEndpointReference(
168:                    Class<T> clazz, Element... referenceParameters) {
169:                throw new UnsupportedOperationException(
170:                        "JaxWS 2.1 APIs are not supported");
171:            }
172:
173:            private static class NoInitJaxWsServerFactoryBean extends
174:                    JaxWsServerFactoryBean {
175:                public NoInitJaxWsServerFactoryBean() {
176:                    // disable CXF resource injection
177:                    doInit = false;
178:                }
179:            }
180:
181:            protected void doPublish(String address) {
182:                JaxWsServerFactoryBean svrFactory = new NoInitJaxWsServerFactoryBean();
183:                svrFactory.setBus(bus);
184:                svrFactory.setAddress(address);
185:                svrFactory.setServiceFactory(serviceFactory);
186:                svrFactory.setStart(false);
187:                svrFactory.setServiceBean(implementor);
188:
189:                if (HTTPBinding.HTTP_BINDING.equals(implInfo.getBindingType())) {
190:                    svrFactory
191:                            .setTransportId("http://cxf.apache.org/bindings/xformat");
192:                }
193:
194:                server = svrFactory.create();
195:
196:                init();
197:
198:                // todo do we need to call this?
199:                getEndpoint();
200:
201:                if (getBinding() instanceof  SOAPBinding) {
202:                    ((SOAPBinding) getBinding()).setMTOMEnabled(port
203:                            .isMtomEnabled());
204:                }
205:
206:                server.start();
207:            }
208:
209:            protected void init() {
210:            }
211:
212:            /**
213:             * Set appropriate handlers for the port/service/bindings.
214:             */
215:            protected void initHandlers() throws Exception {
216:                PortInfoImpl portInfo = new PortInfoImpl(implInfo
217:                        .getBindingType(), serviceFactory.getEndpointName(),
218:                        service.getName());
219:
220:                handlerResolver = new HandlerResolverImpl(port
221:                        .getHandlerChains(), port.getInjections(), context);
222:                List<Handler> chain = handlerResolver.getHandlerChain(portInfo);
223:
224:                getBinding().setHandlerChain(chain);
225:            }
226:
227:            protected void destroyHandlers() {
228:                if (this .handlerResolver != null) {
229:                    handlerResolver.destroyHandlers();
230:                    handlerResolver = null;
231:                }
232:            }
233:
234:            public void stop() {
235:                // shutdown server
236:                if (this.server != null) {
237:                    this.server.stop();
238:                }
239:            }
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.