Source Code Cross Referenced for EJBInterceptor.java in  » EJB-Server-geronimo » plugins » org » apache » geronimo » axis2 » ejb » 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 » EJB Server geronimo » plugins » org.apache.geronimo.axis2.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with 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,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */package org.apache.geronimo.axis2.ejb;
019:
020:        import javax.interceptor.AroundInvoke;
021:        import javax.xml.ws.Binding;
022:
023:        import org.apache.axis2.AxisFault;
024:        import org.apache.axis2.context.OperationContext;
025:        import org.apache.axis2.description.AxisOperation;
026:        import org.apache.axis2.description.WSDL2Constants;
027:        import org.apache.axis2.engine.AxisEngine;
028:        import org.apache.axis2.jaxws.core.InvocationContext;
029:        import org.apache.axis2.jaxws.core.InvocationContextFactory;
030:        import org.apache.axis2.jaxws.core.MessageContext;
031:        import org.apache.axis2.jaxws.message.util.MessageUtils;
032:        import org.apache.axis2.jaxws.server.JAXWSMessageReceiver;
033:        import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004_Constants;
034:        import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2006Constants;
035:        import org.apache.commons.logging.Log;
036:        import org.apache.commons.logging.LogFactory;
037:
038:        public class EJBInterceptor {
039:
040:            private static final Log LOG = LogFactory
041:                    .getLog(EJBInterceptor.class);
042:
043:            private MessageContext requestMsgCtx;
044:            private EJBWebServiceContainer container;
045:
046:            public EJBInterceptor(EJBWebServiceContainer container,
047:                    MessageContext requestCtx) {
048:                this .container = container;
049:                this .requestMsgCtx = requestCtx;
050:            }
051:
052:            @AroundInvoke
053:            public Object intercept(
054:                    javax.interceptor.InvocationContext invContext)
055:                    throws Exception {
056:
057:                this .container.injectHandlers();
058:
059:                AxisOperation operation = this .requestMsgCtx
060:                        .getAxisMessageContext().getAxisOperation();
061:                String mep = operation.getMessageExchangePattern();
062:
063:                EJBEndpointController controller = new EJBEndpointController(
064:                        invContext);
065:
066:                Binding binding = (Binding) this .requestMsgCtx
067:                        .getAxisMessageContext().getProperty(
068:                                JAXWSMessageReceiver.PARAM_BINDING);
069:                InvocationContext ic = InvocationContextFactory
070:                        .createInvocationContext(binding);
071:                ic.setRequestMessageContext(this .requestMsgCtx);
072:
073:                controller.invoke(ic);
074:
075:                MessageContext responseMsgCtx = ic.getResponseMessageContext();
076:
077:                //If there is a fault it could be Robust In-Only
078:                if (!isMepInOnly(mep) || hasFault(responseMsgCtx)) {
079:                    // If this is a two-way exchange, there should already be a
080:                    // JAX-WS MessageContext for the response.  We need to pull 
081:                    // the Message data out of there and set it on the Axis2 
082:                    // MessageContext.
083:                    org.apache.axis2.context.MessageContext axisResponseMsgCtx = responseMsgCtx
084:                            .getAxisMessageContext();
085:
086:                    MessageUtils.putMessageOnMessageContext(responseMsgCtx
087:                            .getMessage(), axisResponseMsgCtx);
088:
089:                    OperationContext opCtx = axisResponseMsgCtx
090:                            .getOperationContext();
091:                    opCtx.addMessageContext(axisResponseMsgCtx);
092:
093:                    // If this is a fault message, we want to throw it as an
094:                    // exception so that the transport can do the appropriate things
095:                    if (responseMsgCtx.getMessage().isFault()) {
096:                        throw new AxisFault(
097:                                "An error was detected during JAXWS processing",
098:                                axisResponseMsgCtx);
099:                    } else {
100:                        //Create the AxisEngine for the reponse and send it.
101:                        AxisEngine engine = new AxisEngine(axisResponseMsgCtx
102:                                .getConfigurationContext());
103:                        engine.send(axisResponseMsgCtx);
104:                    }
105:                }
106:
107:                // TODO: convert response into object?
108:                return null;
109:            }
110:
111:            private boolean hasFault(MessageContext responseMsgCtx) {
112:                if (responseMsgCtx == null
113:                        || responseMsgCtx.getMessage() == null) {
114:                    return false;
115:                }
116:                return responseMsgCtx.getMessage().isFault();
117:            }
118:
119:            private boolean isMepInOnly(String mep) {
120:                boolean inOnly = mep
121:                        .equals(WSDL20_2004_Constants.MEP_URI_ROBUST_IN_ONLY)
122:                        || mep.equals(WSDL20_2004_Constants.MEP_URI_IN_ONLY)
123:                        || mep.equals(WSDL2Constants.MEP_URI_IN_ONLY)
124:                        || mep.equals(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY)
125:                        || mep
126:                                .equals(WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY)
127:                        || mep.equals(WSDL20_2006Constants.MEP_URI_IN_ONLY);
128:                return inOnly;
129:            }
130:
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.