001: /*
002: * Copyright 2005 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.springframework.ws.soap.server.endpoint;
018:
019: import java.util.Locale;
020: import javax.xml.namespace.QName;
021:
022: /**
023: * Defines properties for a SOAP Fault. Used by the <code>SoapFaultDefinitionEditor</code> and the
024: * <code>SoapFaultMappingExceptionResolver</code>.
025: *
026: * @author Arjen Poutsma
027: * @see SoapFaultDefinitionEditor
028: * @see SoapFaultMappingExceptionResolver
029: * @since 1.0.0
030: */
031: public class SoapFaultDefinition {
032:
033: /**
034: * Constant <code>QName</code> used to indicate that a <code>Client</code> fault must be created.
035: *
036: * @see org.springframework.ws.soap.SoapBody#addClientOrSenderFault(String,java.util.Locale)
037: */
038: public static final QName CLIENT = new QName("CLIENT");
039:
040: /**
041: * Constant <code>QName</code> used to indicate that a <code>Receiver</code> fault must be created.
042: *
043: * @see org.springframework.ws.soap.SoapBody#addServerOrReceiverFault(String,java.util.Locale)
044: */
045: public static final QName RECEIVER = new QName("RECEIVER");
046:
047: /**
048: * Constant <code>QName</code> used to indicate that a <code>Sender</code> fault must be created.
049: *
050: * @see org.springframework.ws.soap.SoapBody#addServerOrReceiverFault(String,java.util.Locale)
051: */
052: public static final QName SENDER = new QName("SENDER");
053:
054: /**
055: * Constant <code>QName</code> used to indicate that a <code>Server</code> fault must be created.
056: *
057: * @see org.springframework.ws.soap.SoapBody#addClientOrSenderFault(String,java.util.Locale)
058: */
059: public static final QName SERVER = new QName("SERVER");
060:
061: private QName faultCode;
062:
063: private String faultStringOrReason;
064:
065: private Locale locale = Locale.ENGLISH;
066:
067: /** Returns the fault code. */
068: public QName getFaultCode() {
069: return faultCode;
070: }
071:
072: /** Sets the fault code. */
073: public void setFaultCode(QName faultCode) {
074: this .faultCode = faultCode;
075: }
076:
077: /** Returns the fault string or reason text. By default, it is set to the exception message. */
078: public String getFaultStringOrReason() {
079: return faultStringOrReason;
080: }
081:
082: /** Sets the fault string or reason text. By default, it is set to the exception message. */
083: public void setFaultStringOrReason(String faultStringOrReason) {
084: this .faultStringOrReason = faultStringOrReason;
085: }
086:
087: /**
088: * Gets the fault string locale. By default, it is English.
089: *
090: * @see Locale#ENGLISH
091: */
092: public Locale getLocale() {
093: return locale;
094: }
095:
096: /**
097: * Sets the fault string locale. By default, it is English.
098: *
099: * @see Locale#ENGLISH
100: */
101: public void setLocale(Locale locale) {
102: this.locale = locale;
103: }
104: }
|