Source Code Cross Referenced for RMContextUtils.java in  » Web-Services-apache-cxf-2.0.1 » ws-rm » org » apache » cxf » ws » rm » 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 » Web Services apache cxf 2.0.1 » ws rm » org.apache.cxf.ws.rm 
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.cxf.ws.rm;
019:
020:        import org.apache.cxf.message.Message;
021:        import org.apache.cxf.message.MessageUtils;
022:        import org.apache.cxf.ws.addressing.AddressingProperties;
023:        import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
024:        import org.apache.cxf.ws.addressing.VersionTransformer;
025:
026:        /**
027:         * Holder for utility methods relating to contexts.
028:         */
029:
030:        public final class RMContextUtils {
031:
032:            /**
033:             * Prevents instantiation.
034:             */
035:            protected RMContextUtils() {
036:            }
037:
038:            /**
039:             * @return a generated UUID
040:             */
041:            public static String generateUUID() {
042:                return org.apache.cxf.ws.addressing.ContextUtils.generateUUID();
043:            }
044:
045:            /**
046:             * Determine if message is currently being processed on server side.
047:             * 
048:             * @param message the current Message
049:             * @return true iff message is currently being processed on server side
050:             */
051:            public static boolean isServerSide(Message message) {
052:                return message.getExchange().getDestination() != null;
053:            }
054:
055:            /**
056:             * Checks if the action String belongs to an RM protocol message.
057:             * 
058:             * @param action the action
059:             * @return true iff the action is not one of the RM protocol actions.
060:             */
061:            public static boolean isRMProtocolMessage(String action) {
062:                return RMConstants.getCreateSequenceAction().equals(action)
063:                        || RMConstants.getCreateSequenceResponseAction()
064:                                .equals(action)
065:                        || RMConstants.getTerminateSequenceAction().equals(
066:                                action)
067:                        || RMConstants.getLastMessageAction().equals(action)
068:                        || RMConstants.getSequenceAcknowledgmentAction()
069:                                .equals(action)
070:                        || RMConstants.getSequenceInfoAction().equals(action);
071:            }
072:
073:            /**
074:             * Retrieve the RM properties from the current message.
075:             * 
076:             * @param message the current message
077:             * @param outbound true iff the message direction is outbound
078:             * @return the RM properties
079:             */
080:            public static RMProperties retrieveRMProperties(Message message,
081:                    boolean outbound) {
082:                if (outbound) {
083:                    return (RMProperties) message.get(getRMPropertiesKey(true));
084:                } else {
085:                    Message m = null;
086:                    if (MessageUtils.isOutbound(message)) {
087:                        // the in properties are only available on the in message
088:                        m = message.getExchange().getInMessage();
089:                        if (null == m) {
090:                            m = message.getExchange().getInFaultMessage();
091:                        }
092:                    } else {
093:                        m = message;
094:                    }
095:                    if (null != m) {
096:                        return (RMProperties) m.get(getRMPropertiesKey(false));
097:                    }
098:                }
099:                return null;
100:
101:            }
102:
103:            /**
104:             * Store the RM properties in the current message.
105:             * 
106:             * @param message the current message
107:             * @param rmps the RM properties
108:             * @param outbound iff the message direction is outbound
109:             */
110:            public static void storeRMProperties(Message message,
111:                    RMProperties rmps, boolean outbound) {
112:                String key = getRMPropertiesKey(outbound);
113:                message.put(key, rmps);
114:            }
115:
116:            /**
117:             * Retrieves the addressing properties from the current message.
118:             * 
119:             * @param message the current message
120:             * @param isProviderContext true if the binding provider request context
121:             *            available to the client application as opposed to the message
122:             *            context visible to handlers
123:             * @param isOutbound true iff the message is outbound
124:             * @return the current addressing properties
125:             */
126:            public static AddressingPropertiesImpl retrieveMAPs(
127:                    Message message, boolean isProviderContext,
128:                    boolean isOutbound) {
129:                return org.apache.cxf.ws.addressing.ContextUtils.retrieveMAPs(
130:                        message, isProviderContext, isOutbound);
131:            }
132:
133:            /**
134:             * Store MAPs in the message.
135:             * 
136:             * @param maps the MAPs to store
137:             * @param message the current message
138:             * @param isOutbound true iff the message is outbound
139:             * @param isRequestor true iff the current messaging role is that of
140:             *            requestor
141:             * @param handler true if HANDLER scope, APPLICATION scope otherwise
142:             */
143:            public static void storeMAPs(AddressingProperties maps,
144:                    Message message, boolean isOutbound, boolean isRequestor) {
145:                org.apache.cxf.ws.addressing.ContextUtils.storeMAPs(maps,
146:                        message, isOutbound, isRequestor);
147:            }
148:
149:            /**
150:             * Ensures the appropriate version of WS-Addressing is used.
151:             * 
152:             * @param maps the addressing properties
153:             */
154:            public static void ensureExposedVersion(AddressingProperties maps) {
155:                ((AddressingPropertiesImpl) maps)
156:                        .exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
157:            }
158:
159:            public static String getRMPropertiesKey(boolean outbound) {
160:                return outbound ? RMMessageConstants.RM_PROPERTIES_OUTBOUND
161:                        : RMMessageConstants.RM_PROPERTIES_INBOUND;
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.