Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java (original) +++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java Mon May 28 18:27:54 2012 @@ -86,16 +86,16 @@ public class SOAPHeaderImpl extends SOAP throws SOAPException { OMNamespace ns = new NamespaceImpl(uri, prefix); SOAPHeaderBlock headerBlock = null; - if (this.element.getOMFactory() instanceof SOAP11Factory) { + if (this.target.getOMFactory() instanceof SOAP11Factory) { headerBlock = new SOAP11HeaderBlockImpl(localName, ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } else { headerBlock = new SOAP12HeaderBlockImpl(localName, ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); - element.setUserData(SAAJ_NODE, this, null); - soapHeaderElement.element.setUserData(SAAJ_NODE, soapHeaderElement, null); + target.setUserData(SAAJ_NODE, this, null); + soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null); soapHeaderElement.setParentElement(this); return soapHeaderElement; } @@ -114,19 +114,19 @@ public class SOAPHeaderImpl extends SOAP OMNamespace ns = new NamespaceImpl(soapElement.getNamespaceURI(), soapElement.getPrefix()); SOAPHeaderBlock headerBlock = null; - if (this.element.getOMFactory() instanceof SOAP11Factory) { + if (this.target.getOMFactory() instanceof SOAP11Factory) { headerBlock = new SOAP11HeaderBlockImpl(soapElement.getLocalName(), ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } else { headerBlock = new SOAP12HeaderBlockImpl(soapElement.getLocalName(), ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); - element.setUserData(SAAJ_NODE, this, null); - soapHeaderElement.element.setUserData(SAAJ_NODE, soapHeaderElement, null); + target.setUserData(SAAJ_NODE, this, null); + soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null); soapHeaderElement.setParentElement(this); return soapHeaderElement; } @@ -136,22 +136,22 @@ public class SOAPHeaderImpl extends SOAP OMNamespace ns = new NamespaceImpl(child.getNamespaceURI(), child.getPrefix()); SOAPHeaderBlock headerBlock = null; - if (this.element.getOMFactory() instanceof SOAP11Factory) { + if (this.target.getOMFactory() instanceof SOAP11Factory) { headerBlock = new SOAP11HeaderBlockImpl(child.getLocalName(), ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } else { headerBlock = new SOAP12HeaderBlockImpl(child.getLocalName(), ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } - element.setUserData(SAAJ_NODE, this, null); + target.setUserData(SAAJ_NODE, this, null); SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); copyContents(soapHeaderElement, child); - soapHeaderElement.element.setUserData(SAAJ_NODE, soapHeaderElement, null); + soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null); soapHeaderElement.setParentElement(this); return soapHeaderElement; } @@ -177,17 +177,17 @@ public class SOAPHeaderImpl extends SOAP OMNamespace ns = new NamespaceImpl(name.getURI(), prefix); SOAPHeaderBlock headerBlock = null; - if (this.element.getOMFactory() instanceof SOAP11Factory) { + if (this.target.getOMFactory() instanceof SOAP11Factory) { headerBlock = new SOAP11HeaderBlockImpl(name.getLocalName(), ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } else { headerBlock = new SOAP12HeaderBlockImpl(name.getLocalName(), ns, omSOAPHeader, - (SOAPFactory)this.element.getOMFactory()); + (SOAPFactory)this.target.getOMFactory()); } SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); - element.setUserData(SAAJ_NODE, this, null); - soapHeaderElement.element.setUserData(SAAJ_NODE, soapHeaderElement, null); + target.setUserData(SAAJ_NODE, this, null); + soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null); soapHeaderElement.setParentElement(this); return soapHeaderElement; } @@ -302,11 +302,11 @@ public class SOAPHeaderImpl extends SOAP public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException { SOAPHeaderBlock soapHeaderBlock = null; OMNamespace ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix()); - if (this.element.getOMFactory() instanceof SOAP11Factory) { + if (this.target.getOMFactory() instanceof SOAP11Factory) { throw new UnsupportedOperationException(); } else { soapHeaderBlock = this.omSOAPHeader.addHeaderBlock( - Constants.ELEM_NOTUNDERSTOOD, this.element.getNamespace()); + Constants.ELEM_NOTUNDERSTOOD, this.target.getNamespace()); soapHeaderBlock.addAttribute(qname.getLocalPart(), qname.getPrefix(), ns); } SOAPHeaderElementImpl soapHeaderElementImpl = new SOAPHeaderElementImpl(soapHeaderBlock); @@ -324,7 +324,7 @@ public class SOAPHeaderImpl extends SOAP */ public SOAPHeaderElement addUpgradeHeaderElement(Iterator iterator) throws SOAPException { SOAPHeaderBlock upgrade = this.omSOAPHeader.addHeaderBlock( - Constants.ELEM_UPGRADE, this.element.getNamespace()); + Constants.ELEM_UPGRADE, this.target.getNamespace()); int index = 0; String prefix = "ns"; @@ -335,7 +335,7 @@ public class SOAPHeaderImpl extends SOAP OMNamespace namespace = new NamespaceImpl(supported, prefix + index); OMElement supportedEnvelop = - element.getOMFactory().createOMElement(Constants.ELEM_SUPPORTEDENVELOPE, + target.getOMFactory().createOMElement(Constants.ELEM_SUPPORTEDENVELOPE, namespace); supportedEnvelop.addAttribute(Constants.ATTR_QNAME, prefix + index + ":" + Constants.ELEM_ENVELOPE, null); @@ -367,9 +367,9 @@ public class SOAPHeaderImpl extends SOAP } public SOAPElement addTextNode(String text) throws SOAPException { - if (this.element.getOMFactory() instanceof SOAP11Factory) { + if (this.target.getOMFactory() instanceof SOAP11Factory) { return super.addTextNode(text); - } else if (this.element.getOMFactory() instanceof SOAP12Factory) { + } else if (this.target.getOMFactory() instanceof SOAP12Factory) { throw new SOAPException("Cannot add text node to SOAPHeader"); } else { return null; @@ -378,11 +378,11 @@ public class SOAPHeaderImpl extends SOAP public Iterator getChildElements(Name name) { QName qName = new QName(name.getURI(), name.getLocalName()); - return getChildren(element.getChildrenWithName(qName)); + return getChildren(target.getChildrenWithName(qName)); } public Iterator getChildElements() { - return getChildren(element.getChildren()); + return getChildren(target.getChildren()); } private Iterator getChildren(Iterator childIter) {
Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java (original) +++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java Mon May 28 18:27:54 2012 @@ -62,9 +62,9 @@ public class SOAPMessageImpl extends SOA public SOAPMessageImpl(SOAPEnvelopeImpl soapEnvelope) { this.mimeHeaders = new MimeHeaders(); - if (soapEnvelope.getOMFactory() instanceof SOAP11Factory) { + if (soapEnvelope.target.getOMFactory() instanceof SOAP11Factory) { this.mimeHeaders.addHeader("content-type", HTTPConstants.MEDIA_TYPE_TEXT_XML); - } else if (soapEnvelope.getOMFactory() instanceof SOAP12Factory) { + } else if (soapEnvelope.target.getOMFactory() instanceof SOAP12Factory) { this.mimeHeaders.addHeader("content-type", HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML); } @@ -400,7 +400,7 @@ public class SOAPMessageImpl extends SOA } format.setRootContentId(rootContentId); - format.setSOAP11(((SOAPEnvelopeImpl) soapPart.getEnvelope()).getOMFactory() instanceof SOAP11Factory); + format.setSOAP11(((SOAPEnvelopeImpl) soapPart.getEnvelope()).target.getOMFactory() instanceof SOAP11Factory); //Double save the content-type in case anything is updated mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType.toString()); @@ -612,7 +612,7 @@ public class SOAPMessageImpl extends SOA } private String getBaseType() throws SOAPException { - boolean isSOAP12 = ((SOAPEnvelopeImpl) soapPart.getEnvelope()).getOMFactory() instanceof SOAP12Factory; + boolean isSOAP12 = ((SOAPEnvelopeImpl) soapPart.getEnvelope()).target.getOMFactory() instanceof SOAP12Factory; return isSOAP12 ? HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML : HTTPConstants.MEDIA_TYPE_TEXT_XML; } Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java (original) +++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java Mon May 28 18:27:54 2012 @@ -200,7 +200,7 @@ public class SOAPPartImpl extends SOAPPa org.apache.axiom.soap.SOAPEnvelope soapEnvelope = builder.getSOAPEnvelope(); envelope = new SOAPEnvelopeImpl( (org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)soapEnvelope); - envelope.element.build(); + envelope.target.build(); this.document = envelope.getOwnerDocument(); envelope.setSOAPPartParent(this); } catch (Exception e) { @@ -349,20 +349,20 @@ public class SOAPPartImpl extends SOAPPa } StAXSOAPModelBuilder builder1 = null; - if (this.envelope.element.getOMFactory() instanceof SOAP11Factory) { + if (this.envelope.target.getOMFactory() instanceof SOAP11Factory) { builder1 = new StAXSOAPModelBuilder(reader, - (SOAP11Factory)this.envelope.element + (SOAP11Factory)this.envelope.target .getOMFactory(), null); - } else if (this.envelope.element.getOMFactory() instanceof SOAP12Factory) { + } else if (this.envelope.target.getOMFactory() instanceof SOAP12Factory) { builder1 = new StAXSOAPModelBuilder(reader, - (SOAP12Factory)this.envelope.element + (SOAP12Factory)this.envelope.target .getOMFactory(), null); } org.apache.axiom.soap.SOAPEnvelope soapEnvelope = builder1.getSOAPEnvelope(); envelope = new SOAPEnvelopeImpl( (org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)soapEnvelope); - envelope.element.build(); + envelope.target.build(); this.document = envelope.getOwnerDocument(); envelope.setSOAPPartParent(this); } catch (TransformerFactoryConfigurationError e) { @@ -922,7 +922,7 @@ public class SOAPPartImpl extends SOAPPa */ public Node removeChild(Node oldChild) throws DOMException { if (oldChild instanceof SOAPElementImpl) { - oldChild = ((SOAPElementImpl)oldChild).getElement(); + oldChild = ((SOAPElementImpl)oldChild).getTarget(); } else if (oldChild instanceof TextImplEx) { // TODO: handle text nodes somehow } @@ -1196,6 +1196,6 @@ public class SOAPPartImpl extends SOAPPa } javax.xml.soap.Node toSAAJNode(org.w3c.dom.Node domNode) { - return NodeImplEx.toSAAJNode(domNode, this); + return SAAJNode.toSAAJNode(domNode, this); } } Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java?rev=1343353&r1=1343352&r2=1343353&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java (original) +++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java Mon May 28 18:27:54 2012 @@ -19,51 +19,35 @@ package org.apache.axis2.saaj; -import org.apache.axiom.om.OMContainer; -import org.apache.axiom.om.OMException; import org.apache.axiom.om.impl.dom.DOOMAbstractFactory; import org.apache.axiom.om.impl.dom.TextImpl; import org.w3c.dom.DOMException; -import org.w3c.dom.Document; import javax.xml.soap.SOAPElement; import javax.xml.soap.Text; -import javax.xml.stream.XMLStreamException; - -public class TextImplEx extends NodeImplEx implements Text { - - //TODO: assign textNode - - private TextImpl textNode; +public class TextImplEx extends SAAJNode<TextImpl> implements Text { private org.w3c.dom.Node previousSibling; private org.w3c.dom.Node nextSibling; public TextImplEx(String data, SOAPElement parent) { - super(((SOAPElementImpl)parent).getOMFactory()); - textNode = (TextImpl)DOOMAbstractFactory.getOMFactory().createOMText(data); + super((TextImpl)DOOMAbstractFactory.getOMFactory().createOMText(data)); this.parentElement = parent; } public TextImplEx(TextImpl textNode, SOAPElement parent) { - super(((SOAPElementImpl)parent).getOMFactory()); - this.textNode = textNode; + super(textNode); this.parentElement = parent; } public TextImplEx(String data, SOAPElement parent, org.w3c.dom.Node prevSibling, org.w3c.dom.Node nextSibling) { - super(((SOAPElementImpl)parent).getOMFactory()); - textNode = (TextImpl)DOOMAbstractFactory.getOMFactory().createOMText(data); + super((TextImpl)DOOMAbstractFactory.getOMFactory().createOMText(data)); this.parentElement = parent; this.previousSibling = prevSibling; this.nextSibling = nextSibling; } - TextImpl getTextNode() { - return textNode; - } - public void setNextSibling(org.w3c.dom.Node nextSibling) { this.nextSibling = nextSibling; } @@ -79,20 +63,10 @@ public class TextImplEx extends NodeImpl * otherwise */ public boolean isComment() { - String value = textNode.getText(); + String value = target.getText(); return value.startsWith("<!--") && value.endsWith("-->"); } - /** The name of this node, depending on its type; see the table above. */ - public String getNodeName() { - return textNode.getNodeName(); - } - - /** A code representing the type of the underlying object, as defined above. */ - public short getNodeType() { - return textNode.getNodeType(); - } - /** * Breaks this node into two nodes at the specified <code>offset</code>, keeping both in the * tree as siblings. After being split, this node will contain all the content up to the @@ -108,7 +82,7 @@ public class TextImplEx extends NodeImpl * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public org.w3c.dom.Text splitText(int offset) throws DOMException { - return textNode.splitText(offset); + return target.splitText(offset); } public boolean isElementContentWhitespace() { @@ -138,7 +112,7 @@ public class TextImplEx extends NodeImpl * in a <code>DOMString</code> variable on the implementation platform. */ public String getData() throws DOMException { - return textNode.getData(); + return target.getData(); } /** @@ -153,7 +127,7 @@ public class TextImplEx extends NodeImpl * in a <code>DOMString</code> variable on the implementation platform. */ public void setData(String data) throws DOMException { - textNode.setData(data); + target.setData(data); } /** @@ -171,7 +145,7 @@ public class TextImplEx extends NodeImpl * <code>DOMString</code>. */ public String substringData(int offset, int count) throws DOMException { - return textNode.substringData(offset, count); + return target.substringData(offset, count); } /** @@ -183,7 +157,7 @@ public class TextImplEx extends NodeImpl * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void appendData(String value) throws DOMException { - textNode.appendData(value); + target.appendData(value); } /** @@ -196,7 +170,7 @@ public class TextImplEx extends NodeImpl * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void insertData(int offset, String data) throws DOMException { - textNode.insertData(offset, data); + target.insertData(offset, data); } /** @@ -213,7 +187,7 @@ public class TextImplEx extends NodeImpl * Raised if this node is readonly. */ public void deleteData(int offset, int count) throws DOMException { - textNode.deleteData(offset, count); + target.deleteData(offset, count); } /** @@ -233,37 +207,7 @@ public class TextImplEx extends NodeImpl * Raised if this node is readonly. */ public void replaceData(int offset, int count, String data) throws DOMException { - textNode.replaceData(offset, count, data); - } - - /* (non-Javadoc) - * @see org.apache.axiom.om.impl.OMNodeEx#setParent(org.apache.axiom.om.OMContainer) - */ - public void setParent(OMContainer element) { - textNode.setParent(element); - } - - public Document getOwnerDocument() { - return textNode.getOwnerDocument(); - } - - /* (non-Javadoc) - * @see org.apache.axiom.om.OMNode#getParent() - */ - public OMContainer getParent() { - return textNode.getParent(); - } - - /* (non-Javadoc) - * @see org.apache.axiom.om.OMNode#discard() - */ - public void discard() throws OMException { - textNode.discard(); - } - - public void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache) - throws XMLStreamException { - textNode.internalSerialize(writer, cache); + target.replaceData(offset, count, data); } /** @@ -272,11 +216,7 @@ public class TextImplEx extends NodeImpl * @return The text value (data) of this */ public String getValue() { - return textNode.getData(); - } - - public String getNodeValue() { - return textNode.getData(); + return target.getData(); } /** @@ -290,11 +230,7 @@ public class TextImplEx extends NodeImpl * child node or has a child node that is not a Text node */ public void setValue(String value) { - textNode.setData(value); - } - - public void setNodeValue(String value) { - textNode.setData(value); + target.setData(value); } public String toString() { @@ -310,4 +246,8 @@ public class TextImplEx extends NodeImpl public org.w3c.dom.Node getPreviousSibling() { return toSAAJNode(previousSibling); } + + public int getLength() { + return target.getLength(); + } }