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.soap.server.endpoint;
18  
19  import java.util.Locale;
20  import javax.xml.namespace.QName;
21  
22  /**
23   * Defines properties for a SOAP Fault. Used by the <code>SoapFaultDefinitionEditor</code> and the
24   * <code>SoapFaultMappingExceptionResolver</code>.
25   *
26   * @author Arjen Poutsma
27   * @see SoapFaultDefinitionEditor
28   * @see SoapFaultMappingExceptionResolver
29   * @since 1.0.0
30   */
31  public class SoapFaultDefinition {
32  
33      /**
34       * Constant <code>QName</code> used to indicate that a <code>Client</code> fault must be created.
35       *
36       * @see org.springframework.ws.soap.SoapBody#addClientOrSenderFault(String,java.util.Locale)
37       */
38      public static final QName CLIENT = new QName("CLIENT");
39  
40      /**
41       * Constant <code>QName</code> used to indicate that a <code>Receiver</code> fault must be created.
42       *
43       * @see org.springframework.ws.soap.SoapBody#addServerOrReceiverFault(String,java.util.Locale)
44       */
45      public static final QName RECEIVER = new QName("RECEIVER");
46  
47      /**
48       * Constant <code>QName</code> used to indicate that a <code>Sender</code> fault must be created.
49       *
50       * @see org.springframework.ws.soap.SoapBody#addServerOrReceiverFault(String,java.util.Locale)
51       */
52      public static final QName SENDER = new QName("SENDER");
53  
54      /**
55       * Constant <code>QName</code> used to indicate that a <code>Server</code>  fault must be created.
56       *
57       * @see org.springframework.ws.soap.SoapBody#addClientOrSenderFault(String,java.util.Locale)
58       */
59      public static final QName SERVER = new QName("SERVER");
60  
61      private QName faultCode;
62  
63      private String faultStringOrReason;
64  
65      private Locale locale = Locale.ENGLISH;
66  
67      /** Returns the fault code. */
68      public QName getFaultCode() {
69          return faultCode;
70      }
71  
72      /** Sets the fault code. */
73      public void setFaultCode(QName faultCode) {
74          this.faultCode = faultCode;
75      }
76  
77      /** Returns the fault string or reason text. By default, it is set to the exception message. */
78      public String getFaultStringOrReason() {
79          return faultStringOrReason;
80      }
81  
82      /** Sets the fault string or reason text. By default, it is set to the exception message. */
83      public void setFaultStringOrReason(String faultStringOrReason) {
84          this.faultStringOrReason = faultStringOrReason;
85      }
86  
87      /**
88       * Gets the fault string locale. By default, it is English.
89       *
90       * @see Locale#ENGLISH
91       */
92      public Locale getLocale() {
93          return locale;
94      }
95  
96      /**
97       * Sets the fault string locale. By default, it is English.
98       *
99       * @see Locale#ENGLISH
100      */
101     public void setLocale(Locale locale) {
102         this.locale = locale;
103     }
104 }