View Javadoc
1   /*
2    * Copyright 2011 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  package org.openehealth.ipf.commons.ihe.ws.cxf;
17  
18  import org.apache.cxf.message.Exchange;
19  
20  /**
21   * Rejection handling strategy for WS transactions.
22   * @author Dmytro Rud
23   */
24  public interface WsRejectionHandlingStrategy {
25  
26      /**
27       * This method will be called when the request has been rejected
28       * by CXF (in this case, the CXF exchange will contain a SOAP fault)
29       * or by IPF (transaction-specific logic).
30       *
31       * @param cxfExchange
32       *      CXF exchange containing multiple representations of the request
33       *      message and the whole context information.
34       */
35      void handleRejectedExchange(Exchange cxfExchange);
36  
37  
38      /**
39       * This method should return <code>true</code> when the given CXF
40       * exchange can be considered rejected (failed).
41       * <p>
42       * @see org.openehealth.ipf.commons.ihe.ws.utils.SoapUtils#extractOutgoingException(org.apache.cxf.message.Exchange)
43       *
44       * @param cxfExchange
45       *      CXF exchange under consideration.
46       * @return
47       *      <code>true</code> when the given CXF exchange has been
48       *      rejected; <code>false</code> otherwise.
49       */
50      boolean isRejected(Exchange cxfExchange);
51  }