View Javadoc

1   /*
2    *  Copyright (c) 2008 Rodrigo Ruiz
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.apache.axis.message.addressing;
17  
18  import javax.xml.soap.SOAPEnvelope;
19  import javax.xml.soap.SOAPException;
20  import javax.xml.soap.SOAPHeaderElement;
21  
22  import org.apache.axis.types.URI;
23  import org.apache.axis.types.URI.MalformedURIException;
24  import org.w3c.dom.Document;
25  import org.w3c.dom.Element;
26  
27  /**
28   * Java content class for From element declaration.
29   * <p>
30   * The following schema fragment specifies the expected content contained within
31   * this java content object. (defined at
32   * http://schemas.xmlsoap.org/ws/2004/08/addressing line 80)
33   *
34   * <pre>
35   * &lt;element
36   *   xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;
37   *   name=&quot;From&quot;
38   *   type=&quot;wsa:EndpointReferenceType&quot;/&gt;
39   * </pre>
40   *
41   * @author Davanum Srinivas
42   * @version $Revision: 14 $
43   */
44  public class From extends EndpointReference {
45    /**
46     * <code>serialVersionUID</code> attribute.
47     */
48    private static final long serialVersionUID = -7738503005594044966L;
49  
50    /**
51     * Constructor From.
52     *
53     * @param endpoint Source end-point
54     */
55    public From(EndpointReferenceType endpoint) {
56      super(endpoint);
57    }
58  
59    /**
60     * Constructor From.
61     *
62     * @param element Source element
63     * @throws MalformedURIException If an error occurs
64     */
65    public From(SOAPHeaderElement element) throws MalformedURIException {
66      super(element);
67    }
68  
69    /**
70     * Constructor From.
71     *
72     * @param uri Source URI
73     */
74    public From(URI uri) {
75      super(uri);
76    }
77  
78    /**
79     * Creates an instance.
80     *
81     * @param uri Source URI
82     * @throws MalformedURIException If the URI is not valid
83     */
84    public From(String uri) throws MalformedURIException {
85      super(uri);
86    }
87  
88    /**
89     * {@inheritDoc}
90     */
91    @Override
92    public Element toDOM(Document doc) {
93      return this.toDOM(doc, Constants.FROM);
94    }
95  
96    /**
97     * {@inheritDoc}
98     */
99    public SOAPHeaderElement toSOAPHeaderElement(AddressingVersion version,
100     SOAPEnvelope env, String actorURI) throws SOAPException {
101     return this.toSOAPHeaderElement(version, env, actorURI, Constants.FROM);
102   }
103 }