View Javadoc

1   /*
2    * Copyright 2007 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.axiom;
18  
19  import java.util.Arrays;
20  import java.util.Iterator;
21  import java.util.List;
22  
23  import org.apache.axiom.soap.RolePlayer;
24  import org.apache.axiom.soap.SOAPFactory;
25  import org.apache.axiom.soap.SOAPHeader;
26  import org.springframework.util.ObjectUtils;
27  import org.springframework.ws.soap.soap11.Soap11Header;
28  
29  /**
30   * Axiom-specific version of <code>org.springframework.ws.soap.Soap11Header</code>.
31   *
32   * @author Arjen Poutsma
33   * @since 1.0.0
34   */
35  class AxiomSoap11Header extends AxiomSoapHeader implements Soap11Header {
36  
37      AxiomSoap11Header(SOAPHeader axiomHeader, SOAPFactory axiomFactory) {
38          super(axiomHeader, axiomFactory);
39      }
40  
41      public Iterator examineHeaderElementsToProcess(final String[] actors) {
42          RolePlayer rolePlayer = null;
43          if (!ObjectUtils.isEmpty(actors)) {
44              rolePlayer = new RolePlayer() {
45  
46                  public List getRoles() {
47                      return Arrays.asList(actors);
48                  }
49  
50                  public boolean isUltimateDestination() {
51                      return false;
52                  }
53              };
54          }
55          Iterator result = getAxiomHeader().getHeadersToProcess(rolePlayer);
56          return new AxiomSoapHeaderElementIterator(result);
57      }
58  }