Source Code Cross Referenced for AxisService.java in  » J2EE » openejb3 » org » apache » openejb » server » axis » 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.axis 
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.axis;
018:
019:        import org.apache.axis.description.JavaServiceDesc;
020:        import org.apache.axis.handlers.HandlerInfoChainFactory;
021:        import org.apache.axis.handlers.soap.SOAPService;
022:        import org.apache.axis.providers.java.RPCProvider;
023:        import org.apache.openejb.DeploymentInfo;
024:        import org.apache.openejb.OpenEJBException;
025:        import org.apache.openejb.core.webservices.HandlerChainData;
026:        import org.apache.openejb.core.webservices.HandlerData;
027:        import org.apache.openejb.core.webservices.PortData;
028:        import org.apache.openejb.jee.JavaWsdlMapping;
029:        import org.apache.openejb.jee.PortComponent;
030:        import org.apache.openejb.server.axis.assembler.CommonsSchemaInfoBuilder;
031:        import org.apache.openejb.server.axis.assembler.JaxRpcServiceInfo;
032:        import org.apache.openejb.server.axis.assembler.JaxRpcServiceInfoBuilder;
033:        import org.apache.openejb.server.axis.assembler.XmlSchemaInfo;
034:        import org.apache.openejb.server.httpd.HttpListener;
035:        import org.apache.openejb.server.webservices.WsService;
036:
037:        import javax.naming.Context;
038:        import javax.wsdl.Port;
039:        import javax.xml.namespace.QName;
040:        import javax.xml.rpc.handler.HandlerInfo;
041:        import java.net.URL;
042:        import java.util.ArrayList;
043:        import java.util.HashMap;
044:        import java.util.List;
045:        import java.util.Map;
046:        import java.util.TreeMap;
047:
048:        public class AxisService extends WsService {
049:            private final Map<String, AxisWsContainer> wsContainers = new TreeMap<String, AxisWsContainer>();
050:
051:            public String getName() {
052:                return "axis";
053:            }
054:
055:            private JaxRpcServiceInfo getJaxRpcServiceInfo(
056:                    ClassLoader classLoader) throws OpenEJBException {
057:                JavaWsdlMapping mapping = null; // the java to wsdl mapping file
058:                CommonsSchemaInfoBuilder xmlBeansSchemaInfoBuilder = new CommonsSchemaInfoBuilder(
059:                        null, null); // the schema data from the wsdl file
060:                PortComponent portComponent = null; // webservice.xml declaration of this service
061:                Port port = null; // wsdl.xml declaration of this service
062:                String wsdlFile = null;
063:
064:                XmlSchemaInfo schemaInfo = xmlBeansSchemaInfoBuilder
065:                        .createSchemaInfo();
066:
067:                JaxRpcServiceInfoBuilder serviceInfoBuilder = new JaxRpcServiceInfoBuilder(
068:                        mapping, schemaInfo, portComponent, port, wsdlFile,
069:                        classLoader);
070:                JaxRpcServiceInfo serviceInfo = serviceInfoBuilder
071:                        .createServiceInfo();
072:                return serviceInfo;
073:            }
074:
075:            protected HttpListener createEjbWsContainer(URL moduleBaseUrl,
076:                    PortData port, DeploymentInfo deploymentInfo)
077:                    throws Exception {
078:                ClassLoader classLoader = deploymentInfo.getClassLoader();
079:
080:                // todo build JaxRpcServiceInfo in assembler
081:                JaxRpcServiceInfo serviceInfo = getJaxRpcServiceInfo(classLoader);
082:
083:                // Build java service descriptor
084:                JavaServiceDescBuilder javaServiceDescBuilder = new JavaServiceDescBuilder(
085:                        serviceInfo, classLoader);
086:                JavaServiceDesc serviceDesc = javaServiceDescBuilder
087:                        .createServiceDesc();
088:
089:                // Create service
090:                RPCProvider provider = new EjbContainerProvider(deploymentInfo,
091:                        createHandlerInfos(port.getHandlerChains()));
092:                SOAPService service = new SOAPService(null, provider, null);
093:                service.setServiceDescription(serviceDesc);
094:
095:                // Set class name
096:                service.setOption("className", deploymentInfo
097:                        .getServiceEndpointInterface().getName());
098:                serviceDesc.setImplClass(deploymentInfo
099:                        .getServiceEndpointInterface());
100:
101:                // Create container
102:                AxisWsContainer container = new AxisWsContainer(port
103:                        .getWsdlUrl(), service, null, classLoader);
104:                wsContainers.put(deploymentInfo.getDeploymentID().toString(),
105:                        container);
106:                return container;
107:            }
108:
109:            protected void destroyEjbWsContainer(String deploymentId) {
110:                AxisWsContainer container = wsContainers.remove(deploymentId);
111:                if (container != null) {
112:                    container.destroy();
113:                }
114:            }
115:
116:            protected HttpListener createPojoWsContainer(URL moduleBaseUrl,
117:                    PortData port, String serviceId, Class target,
118:                    Context context, String contextRoot) throws Exception {
119:                ClassLoader classLoader = target.getClassLoader();
120:
121:                // todo build JaxRpcServiceInfo in assembler
122:                JaxRpcServiceInfo serviceInfo = getJaxRpcServiceInfo(classLoader);
123:
124:                // Build java service descriptor
125:                JavaServiceDescBuilder javaServiceDescBuilder = new JavaServiceDescBuilder(
126:                        serviceInfo, classLoader);
127:                JavaServiceDesc serviceDesc = javaServiceDescBuilder
128:                        .createServiceDesc();
129:
130:                // Create service
131:                RPCProvider provider = new PojoProvider();
132:                SOAPService service = new SOAPService(null, provider, null);
133:                service.setServiceDescription(serviceDesc);
134:
135:                // Set class name
136:                service.setOption("className", target.getName());
137:
138:                // Add Handler Chain
139:                List<HandlerInfo> handlerInfos = createHandlerInfos(port
140:                        .getHandlerChains());
141:                HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(
142:                        handlerInfos);
143:                service.setOption(
144:                        org.apache.axis.Constants.ATTR_HANDLERINFOCHAIN,
145:                        handlerInfoChainFactory);
146:
147:                // Create container
148:                AxisWsContainer container = new AxisWsContainer(port
149:                        .getWsdlUrl(), service, null, classLoader);
150:                wsContainers.put(serviceId, container);
151:                return container;
152:            }
153:
154:            protected void destroyPojoWsContainer(String serviceId) {
155:                AxisWsContainer container = wsContainers.remove(serviceId);
156:                if (container != null) {
157:                    container.destroy();
158:                }
159:            }
160:
161:            @SuppressWarnings({"unchecked"})
162:            private List<HandlerInfo> createHandlerInfos(
163:                    List<HandlerChainData> handlerChains)
164:                    throws ClassNotFoundException {
165:                if (handlerChains == null || handlerChains.isEmpty())
166:                    return null;
167:                List<HandlerData> handlers = handlerChains.get(0).getHandlers();
168:
169:                List<HandlerInfo> handlerInfos = new ArrayList<HandlerInfo>(
170:                        handlers.size());
171:                for (HandlerData handler : handlers) {
172:                    Class<?> handlerClass = handler.getHandlerClass();
173:                    Map initParams = new HashMap(handler.getInitParams());
174:                    QName[] headers = handler.getSoapHeaders().toArray(
175:                            new QName[handler.getSoapHeaders().size()]);
176:                    HandlerInfo handlerInfo = new HandlerInfo(handlerClass,
177:                            initParams, headers);
178:                    handlerInfos.add(handlerInfo);
179:                }
180:
181:                return handlerInfos;
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.