View Javadoc

1   /*
2    * Copyright 2005-2010 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.transport.support;
18  
19  import org.springframework.beans.factory.InitializingBean;
20  import org.springframework.util.Assert;
21  import org.springframework.ws.transport.WebServiceConnection;
22  import org.springframework.ws.transport.WebServiceMessageReceiver;
23  
24  /**
25   * Base class for server-side transport objects which have a predefined [email protected] WebServiceMessageReceiver}.
26   *
27   * @author Arjen Poutsma
28   * @see #handleConnection(WebServiceConnection)
29   * @since 1.5.0
30   */
31  public abstract class SimpleWebServiceMessageReceiverObjectSupport extends WebServiceMessageReceiverObjectSupport
32          implements InitializingBean {
33  
34      private WebServiceMessageReceiver messageReceiver;
35  
36      /**
37       * Returns the <code>WebServiceMessageReceiver</code> used by this listener.
38       */
39      public WebServiceMessageReceiver getMessageReceiver() {
40          return messageReceiver;
41      }
42  
43      /**
44       * Sets the <code>WebServiceMessageReceiver</code> used by this listener.
45       */
46      public void setMessageReceiver(WebServiceMessageReceiver messageReceiver) {
47          this.messageReceiver = messageReceiver;
48      }
49  
50      @Override
51      public void afterPropertiesSet() throws Exception {
52          super.afterPropertiesSet();
53          Assert.notNull(getMessageReceiver(), "messageReceiver must not be null");
54      }
55  
56      protected final void handleConnection(WebServiceConnection connection) throws Exception {
57          handleConnection(connection, getMessageReceiver());
58      }
59  
60  }