View Javadoc

1   /*
2    * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.]
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.opensaml.ws.soap.soap11.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.opensaml.ws.soap.soap11.Detail;
24  import org.opensaml.ws.soap.soap11.Fault;
25  import org.opensaml.ws.soap.soap11.FaultActor;
26  import org.opensaml.ws.soap.soap11.FaultCode;
27  import org.opensaml.ws.soap.soap11.FaultString;
28  import org.opensaml.xml.XMLObject;
29  import org.opensaml.xml.validation.AbstractValidatingXMLObject;
30  
31  /**
32   * Concrete implemenation of {@link org.opensaml.ws.soap.soap11.Fault}.
33   */
34  public class FaultImpl extends AbstractValidatingXMLObject implements Fault {
35  
36      /** Fault code. */
37      private FaultCode faultCode;
38  
39      /** Fault message. */
40      private FaultString message;
41  
42      /** Actor that faulted. */
43      private FaultActor actor;
44  
45      /** Details of the fault. */
46      private Detail detail;
47  
48      /**
49       * Constructor.
50       * 
51       * @param namespaceURI namespace of the element
52       * @param elementLocalName name of the element
53       * @param namespacePrefix namespace prefix of the element
54       */
55      protected FaultImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
56          super(namespaceURI, elementLocalName, namespacePrefix);
57      }
58  
59      /** {@inheritDoc} */
60      public FaultCode getCode() {
61          return faultCode;
62      }
63  
64      /** {@inheritDoc} */
65      public void setCode(FaultCode newFaultCode) {
66          faultCode = prepareForAssignment(faultCode, newFaultCode);
67      }
68  
69      /** {@inheritDoc} */
70      public FaultString getMessage() {
71          return message;
72      }
73  
74      /** {@inheritDoc} */
75      public void setMessage(FaultString newMessage) {
76          message = prepareForAssignment(message, newMessage);
77      }
78  
79      /** {@inheritDoc} */
80      public FaultActor getActor() {
81          return actor;
82      }
83  
84      /** {@inheritDoc} */
85      public void setActor(FaultActor newActor) {
86          actor = prepareForAssignment(actor, newActor);
87      }
88  
89      /** {@inheritDoc} */
90      public Detail getDetail() {
91          return detail;
92      }
93  
94      /** {@inheritDoc} */
95      public void setDetail(Detail newDetail) {
96          detail = prepareForAssignment(detail, newDetail);
97      }
98  
99      /** {@inheritDoc} */
100     public List<XMLObject> getOrderedChildren() {
101         ArrayList<XMLObject> children = new ArrayList<XMLObject>();
102 
103         children.add(faultCode);
104         children.add(message);
105         children.add(actor);
106         children.add(detail);
107 
108         return Collections.unmodifiableList(children);
109     }
110 }