View Javadoc

1   /*
2    * Copyright 2005 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.server.endpoint.adapter;
18  
19  import org.springframework.ws.context.MessageContext;
20  import org.springframework.ws.server.EndpointAdapter;
21  import org.springframework.ws.server.MessageDispatcher;
22  import org.springframework.ws.server.endpoint.MessageEndpoint;
23  import org.springframework.ws.soap.server.SoapMessageDispatcher;
24  
25  /**
26   * Adapter to use a <code>MessageEndpoint</code> as the endpoint for a <code>EndpointInvocationChain</code>.
27   * <p/>
28   * This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
29   *
30   * @author Arjen Poutsma
31   * @see org.springframework.ws.server.EndpointInvocationChain
32   * @since 1.0.0
33   */
34  public class MessageEndpointAdapter implements EndpointAdapter {
35  
36      public boolean supports(Object endpoint) {
37          return endpoint instanceof MessageEndpoint;
38      }
39  
40      public void invoke(MessageContext messageContext, Object endpoint) throws Exception {
41          ((MessageEndpoint) endpoint).invoke(messageContext);
42      }
43  }