KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > soap > impl > llom > SOAPElement


1 package org.apache.axis2.soap.impl.llom;
2
3 import org.apache.axis2.om.OMElement;
4 import org.apache.axis2.om.OMNamespace;
5 import org.apache.axis2.om.OMXMLParserWrapper;
6 import org.apache.axis2.om.impl.llom.OMElementImpl;
7
8 /*
9  * Copyright 2004,2005 The Apache Software Foundation.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *
23  * author : Eran Chinthaka (chinthaka@apache.org)
24  *
25  * This will be the base class of all the SOAP specific elements inthe system
26
27  */

28
29 public abstract class SOAPElement extends OMElementImpl {
30
31
32     /**
33      * @param parent
34      * @param parent
35      */

36     protected SOAPElement(OMElement parent, String JavaDoc localName, boolean extractNamespaceFromParent) throws SOAPProcessingException {
37         super(parent);
38         if (parent == null) {
39             throw new SOAPProcessingException(" Can not create " + localName + " element without a parent !!");
40         }
41         checkParent(parent);
42
43         if (extractNamespaceFromParent) {
44             this.ns = parent.getNamespace();
45         }
46         this.localName = localName;
47     }
48
49
50     protected SOAPElement(OMElement parent, String JavaDoc localName, OMXMLParserWrapper builder) {
51         super(localName, null, parent, builder);
52     }
53
54     /**
55      * Caution : This Constructor is meant to be used only by the SOAPEnvelope.
56      * <p/>
57      * Reasons : This can be used to create a SOAP Element programmatically. But we need to make sure that the user
58      * always passes a parent for the element being created. But SOAP Envelope has no parent.
59      *
60      * @param localName
61      * @param ns
62      */

63     protected SOAPElement(String JavaDoc localName, OMNamespace ns) {
64         super(localName, ns);
65
66     }
67
68     /**
69      * This has to be implemented by all the derived classes to check for the correct parent.
70      */

71     protected abstract void checkParent(OMElement parent) throws SOAPProcessingException;
72
73 }
74
Popular Tags