Source Code Cross Referenced for AbstractEndpointMapping.java in  » Web-Services » spring-ws-1.0.0 » org » springframework » ws » server » endpoint » mapping » 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 » spring ws 1.0.0 » org.springframework.ws.server.endpoint.mapping 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.ws.server.endpoint.mapping;
018:
019:        import org.springframework.context.support.ApplicationObjectSupport;
020:        import org.springframework.core.Ordered;
021:        import org.springframework.ws.context.MessageContext;
022:        import org.springframework.ws.server.EndpointInterceptor;
023:        import org.springframework.ws.server.EndpointInvocationChain;
024:        import org.springframework.ws.server.EndpointMapping;
025:
026:        /**
027:         * Abstract base class for EndpointMapping implementations. Supports a default endpoint, and endpoint interceptors.
028:         *
029:         * @author Arjen Poutsma
030:         * @see #getEndpointInternal(org.springframework.ws.context.MessageContext)
031:         * @see org.springframework.ws.server.EndpointInterceptor
032:         * @since 1.0.0
033:         */
034:        public abstract class AbstractEndpointMapping extends
035:                ApplicationObjectSupport implements  EndpointMapping, Ordered {
036:
037:            private int order = Integer.MAX_VALUE; // default: same as non-Ordered
038:
039:            private Object defaultEndpoint;
040:
041:            private EndpointInterceptor[] interceptors;
042:
043:            /**
044:             * Returns the the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.
045:             *
046:             * @return array of endpoint interceptors, or <code>null</code> if none
047:             */
048:            public EndpointInterceptor[] getInterceptors() {
049:                return interceptors;
050:            }
051:
052:            /**
053:             * Sets the endpoint interceptors to apply to all endpoints mapped by this endpoint mapping.
054:             *
055:             * @param interceptors array of endpoint interceptors, or <code>null</code> if none
056:             */
057:            public final void setInterceptors(EndpointInterceptor[] interceptors) {
058:                this .interceptors = interceptors;
059:            }
060:
061:            public final int getOrder() {
062:                return order;
063:            }
064:
065:            /**
066:             * Specify the order value for this mapping.
067:             * <p/>
068:             * Default value is {@link Integer#MAX_VALUE}, meaning that it's non-ordered.
069:             *
070:             * @see org.springframework.core.Ordered#getOrder()
071:             */
072:            public final void setOrder(int order) {
073:                this .order = order;
074:            }
075:
076:            /**
077:             * Look up an endpoint for the given message context, falling back to the default endpoint if no specific one is
078:             * found.
079:             *
080:             * @return the looked up endpoint instance, or the default endpoint
081:             * @see #getEndpointInternal(org.springframework.ws.context.MessageContext)
082:             */
083:            public final EndpointInvocationChain getEndpoint(
084:                    MessageContext messageContext) throws Exception {
085:                Object endpoint = getEndpointInternal(messageContext);
086:                if (endpoint == null) {
087:                    endpoint = defaultEndpoint;
088:                }
089:                if (endpoint == null) {
090:                    return null;
091:                }
092:                if (endpoint instanceof  String) {
093:                    String endpointName = (String) endpoint;
094:                    endpoint = resolveStringEndpoint(endpointName);
095:                    if (endpoint == null) {
096:                        return null;
097:                    }
098:                }
099:                return createEndpointInvocationChain(messageContext, endpoint,
100:                        interceptors);
101:            }
102:
103:            /**
104:             * Creates a new <code>EndpointInvocationChain</code> based on the given message context, endpoint, and
105:             * interceptors. Default implementation creates a simple <code>EndpointInvocationChain</code> based on the set
106:             * interceptors.
107:             *
108:             * @param endpoint     the endpoint
109:             * @param interceptors the endpoint interceptors
110:             * @return the created invocation chain
111:             * @see #setInterceptors(org.springframework.ws.server.EndpointInterceptor[])
112:             */
113:            protected EndpointInvocationChain createEndpointInvocationChain(
114:                    MessageContext messageContext, Object endpoint,
115:                    EndpointInterceptor[] interceptors) {
116:                return new EndpointInvocationChain(endpoint, interceptors);
117:            }
118:
119:            /**
120:             * Returns the default endpoint for this endpoint mapping.
121:             *
122:             * @return the default endpoint mapping, or null if none
123:             */
124:            protected final Object getDefaultEndpoint() {
125:                return defaultEndpoint;
126:            }
127:
128:            /**
129:             * Sets the default endpoint for this endpoint mapping. This endpoint will be returned if no specific mapping was
130:             * found.
131:             * <p/>
132:             * Default is <code>null</code>, indicating no default endpoint.
133:             *
134:             * @param defaultEndpoint the default endpoint, or null if none
135:             */
136:            public final void setDefaultEndpoint(Object defaultEndpoint) {
137:                this .defaultEndpoint = defaultEndpoint;
138:            }
139:
140:            /**
141:             * Resolves an endpoint string. If the given string can is a bean name, it is resolved using the application
142:             * context.
143:             *
144:             * @param endpointName the endpoint name
145:             * @return the resolved enpoint, or <code>null</code> if the name could not be resolved
146:             */
147:            protected Object resolveStringEndpoint(String endpointName) {
148:                if (getApplicationContext().containsBean(endpointName)) {
149:                    return getApplicationContext().getBean(endpointName);
150:                } else {
151:                    return null;
152:                }
153:            }
154:
155:            /**
156:             * Lookup an endpoint for the given request, returning <code>null</code> if no specific one is found. This template
157:             * method is called by getEndpoint, a <code>null</code> return value will lead to the default handler, if one is
158:             * set.
159:             * <p/>
160:             * The returned endpoint can be a string, in which case it is resolved as a bean name. Also, it can take the form
161:             * <code>beanName#method</code>, in which case the method is resolved.
162:             *
163:             * @return the looked up endpoint instance, or null
164:             * @throws Exception if there is an error
165:             */
166:            protected abstract Object getEndpointInternal(
167:                    MessageContext messageContext) throws Exception;
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.