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;
18
19 import org.springframework.ws.context.MessageContext;
20
21 /**
22 * Interface that must be implemented for each endpoint type to handle a message request. This interface is used to
23 * allow the <code>MessageDispatcher</code> to be indefinitely extensible. It accesses all installed endpoints through
24 * this interface, meaning that is does not contain code specific to any endpoint type.
25 * <p/>
26 * <p>This interface is not intended for application developers. It is available for those who want to develop their own
27 * message flow.
28 *
29 * @author Arjen Poutsma
30 * @see MessageDispatcher
31 * @since 1.0.0
32 */
33 public interface EndpointAdapter {
34
35 /**
36 * Does this <code>EndpointAdapter</code> support the given <code>endpoint</code>?
37 * <p/>
38 * <p>Typical <code>EndpointAdapters</code> will base the decision on the endpoint type.
39 *
40 * @param endpoint endpoint object to check
41 * @return <code>true</code> if this <code>EndpointAdapter</code> supports the supplied <code>endpoint</code>
42 */
43 boolean supports(Object endpoint);
44
45 /**
46 * Use the given <code>endpoint</code> to handle the request.
47 *
48 * @param messageContext the current message context
49 * @param endpoint the endpoint to use. This object must have previously been passed to the {@link
50 * #supports(Object)} method of this interface, which must have returned <code>true</code>
51 * @throws Exception in case of errors
52 */
53 void invoke(MessageContext messageContext, Object endpoint) throws Exception;
54 }