You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/09/15 21:07:03 UTC
svn commit: r289289 [91/134] - in /webservices/axis2/trunk/java: ./ etc/
modules/addressing/ modules/addressing/src/META-INF/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/ modules/addressing/test/org/ap...
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java Thu Sep 15 11:52:11 2005
@@ -1,31 +1,31 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.saaj;
-
-import javax.xml.soap.SOAPFaultElement;
-
-/**
- * Class SOAPFaultElementImpl
- * Just a placeholder, extends SOAPElementImpl
- * Does not implement any new methods or override anything
- *
- * @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
- */
-public class SOAPFaultElementImpl extends SOAPElementImpl implements
- SOAPFaultElement {
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.saaj;
+
+import javax.xml.soap.SOAPFaultElement;
+
+/**
+ * Class SOAPFaultElementImpl
+ * Just a placeholder, extends SOAPElementImpl
+ * Does not implement any new methods or override anything
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class SOAPFaultElementImpl extends SOAPElementImpl implements
+ SOAPFaultElement {
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java Thu Sep 15 11:52:11 2005
@@ -1,225 +1,225 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.saaj;
-
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.soap.*;
-
-import javax.xml.soap.Detail;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFault;
-import java.util.Locale;
-
-/**
- * Class SOAPFaultImpl
- *
- * @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
- * <p/>
- * SOAPFault specific classes not implemented in OM, so
- * throwing unsupported operation for the time being
- */
-public class SOAPFaultImpl extends SOAPBodyElementImpl implements SOAPFault {
-
- /**
- * Field fault The omSOAPFault field
- */
- protected org.apache.axis2.soap.SOAPFault fault;
-
- /**
- * Constructor SOAPFaultImpl
- *
- * @param fault
- */
- public SOAPFaultImpl(org.apache.axis2.soap.SOAPFault fault) {
- this.fault = fault;
- }
-
- public org.apache.axis2.soap.SOAPFault getOMFault() {
- return fault;
- }
-
- /**
- * Method setFaultCode
- *
- * @param faultCode
- * @throws SOAPException
- * @see javax.xml.soap.SOAPFault#setFaultCode(java.lang.String)
- */
- public void setFaultCode(String faultCode) throws SOAPException {
- // No direct mapping of SOAP 1.1 faultCode to SOAP 1.2, Mapping it to
- // (Fault Value of FaultCode) in OM impl
- SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
- SOAPFaultCode fCode = soapFactory.createSOAPFaultCode(fault);
- SOAPFaultValue value = soapFactory.createSOAPFaultValue(fCode);
- fCode.setValue(value);
- value.setText(faultCode);
- }
-
- /**
- * Method getFaultCode
- *
- * @return
- * @see javax.xml.soap.SOAPFault#getFaultCode()
- */
- public String getFaultCode() {
-
- //FaultCode mapped to Fault.FaultCode.FaultValue in OM
- return fault.getCode().getValue().getText();
- }
-
- /**
- * method setFaultActor
- *
- * @param faultActor
- * @throws SOAPException
- * @see javax.xml.soap.SOAPFault#setFaultActor(java.lang.String)
- */
- public void setFaultActor(String faultActor) throws SOAPException {
-
- //faultActor mapped to SOAPFaultNode in OM
- SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
- SOAPFaultNode fNode = soapFactory.createSOAPFaultNode(fault);
- fNode.setNodeValue(faultActor);
- }
-
- /**
- * method getFaultActor
- *
- * @return
- * @see javax.xml.soap.SOAPFault#getFaultActor()
- */
- public String getFaultActor() {
-
- // return the text value in SOAPFaultNode of OM
- return fault.getNode().getNodeValue();
- }
-
- /**
- * method setFaultString
- *
- * @param faultString
- * @throws SOAPException
- * @see javax.xml.soap.SOAPFault#setFaultString(java.lang.String)
- */
- public void setFaultString(String faultString) throws SOAPException {
-
- //FaultString mapped to text elemtnt of SOAPFaultReason->SOAPFaultText in OM
- SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
- SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
- SOAPFaultText text = soapFactory.createSOAPFaultText(fReason);
- text.setText(faultString);
- fReason.setSOAPText(text);
- }
-
- /**
- * method getFaultString
- *
- * @return
- * @see javax.xml.soap.SOAPFault#getFaultString()
- */
- public String getFaultString() {
-
- //return text elemtnt of SOAPFaultReason->SOAPFaultText in OM
- return fault.getReason().getSOAPText().getText();
- }
-
- /**
- * method getDetail
- *
- * @return
- * @see javax.xml.soap.SOAPFault#getDetail()
- */
- public Detail getDetail() {
-
- SOAPFaultDetail detail = fault.getDetail();
- return new DetailImpl(detail);
- }
-
- /**
- * method addDetail
- *
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPFault#addDetail()
- */
- public Detail addDetail() throws SOAPException {
-
- SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
- SOAPFaultDetail detail = soapFactory.createSOAPFaultDetail(fault);
- return new DetailImpl(detail);
- }
-
- /**
- * method setFaultCode
- *
- * @param name
- * @throws SOAPException
- * @see javax.xml.soap.SOAPFault#setFaultCode(javax.xml.soap.Name)
- */
- public void setFaultCode(Name name) throws SOAPException {
-
- /*QName qName = new QName(name.getURI(), name.getLocalName(), name.getPrefix());
- fault.setFaultCode(qName);*/
- throw new UnsupportedOperationException("No supoprted for M2 release");
- }
-
- /**
- * method getFaultCodeAsName
- *
- * @return
- * @see javax.xml.soap.SOAPFault#getFaultCodeAsName()
- */
- public Name getFaultCodeAsName() {
-
- /*QName qName = fault.getFaultCode();
- Name name = new PrefixedQName(qName);
- return name;*/
- throw new UnsupportedOperationException("No supoprted for M2 release");
- }
-
- /**
- * method seFaultString
- *
- * @param faultString
- * @param locale
- * @throws SOAPException
- * @see javax.xml.soap.SOAPFault#setFaultString(java.lang.String, java.util.Locale)
- */
- public void setFaultString(String faultString, Locale locale)
- throws SOAPException {
- //FaultString mapped to text elemtnt of SOAPFaultReason->SOAPFaultText in OM
- // Not using Locale information
- SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
- SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
- SOAPFaultText text = soapFactory.createSOAPFaultText(fReason);
- text.setText(faultString);
- fReason.setSOAPText(text);
- }
-
- /**
- * method getFaultStringLocale
- *
- * @return
- * @see javax.xml.soap.SOAPFault#getFaultStringLocale()
- */
- public Locale getFaultStringLocale() {
- //No implementation in Axis 1.2 also, not sure what to do here
- return null; //TODO
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.saaj;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.soap.*;
+
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import java.util.Locale;
+
+/**
+ * Class SOAPFaultImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ * <p/>
+ * SOAPFault specific classes not implemented in OM, so
+ * throwing unsupported operation for the time being
+ */
+public class SOAPFaultImpl extends SOAPBodyElementImpl implements SOAPFault {
+
+ /**
+ * Field fault The omSOAPFault field
+ */
+ protected org.apache.axis2.soap.SOAPFault fault;
+
+ /**
+ * Constructor SOAPFaultImpl
+ *
+ * @param fault
+ */
+ public SOAPFaultImpl(org.apache.axis2.soap.SOAPFault fault) {
+ this.fault = fault;
+ }
+
+ public org.apache.axis2.soap.SOAPFault getOMFault() {
+ return fault;
+ }
+
+ /**
+ * Method setFaultCode
+ *
+ * @param faultCode
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPFault#setFaultCode(java.lang.String)
+ */
+ public void setFaultCode(String faultCode) throws SOAPException {
+ // No direct mapping of SOAP 1.1 faultCode to SOAP 1.2, Mapping it to
+ // (Fault Value of FaultCode) in OM impl
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ SOAPFaultCode fCode = soapFactory.createSOAPFaultCode(fault);
+ SOAPFaultValue value = soapFactory.createSOAPFaultValue(fCode);
+ fCode.setValue(value);
+ value.setText(faultCode);
+ }
+
+ /**
+ * Method getFaultCode
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultCode()
+ */
+ public String getFaultCode() {
+
+ //FaultCode mapped to Fault.FaultCode.FaultValue in OM
+ return fault.getCode().getValue().getText();
+ }
+
+ /**
+ * method setFaultActor
+ *
+ * @param faultActor
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPFault#setFaultActor(java.lang.String)
+ */
+ public void setFaultActor(String faultActor) throws SOAPException {
+
+ //faultActor mapped to SOAPFaultNode in OM
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ SOAPFaultNode fNode = soapFactory.createSOAPFaultNode(fault);
+ fNode.setNodeValue(faultActor);
+ }
+
+ /**
+ * method getFaultActor
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultActor()
+ */
+ public String getFaultActor() {
+
+ // return the text value in SOAPFaultNode of OM
+ return fault.getNode().getNodeValue();
+ }
+
+ /**
+ * method setFaultString
+ *
+ * @param faultString
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPFault#setFaultString(java.lang.String)
+ */
+ public void setFaultString(String faultString) throws SOAPException {
+
+ //FaultString mapped to text elemtnt of SOAPFaultReason->SOAPFaultText in OM
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
+ SOAPFaultText text = soapFactory.createSOAPFaultText(fReason);
+ text.setText(faultString);
+ fReason.setSOAPText(text);
+ }
+
+ /**
+ * method getFaultString
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultString()
+ */
+ public String getFaultString() {
+
+ //return text elemtnt of SOAPFaultReason->SOAPFaultText in OM
+ return fault.getReason().getSOAPText().getText();
+ }
+
+ /**
+ * method getDetail
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getDetail()
+ */
+ public Detail getDetail() {
+
+ SOAPFaultDetail detail = fault.getDetail();
+ return new DetailImpl(detail);
+ }
+
+ /**
+ * method addDetail
+ *
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPFault#addDetail()
+ */
+ public Detail addDetail() throws SOAPException {
+
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ SOAPFaultDetail detail = soapFactory.createSOAPFaultDetail(fault);
+ return new DetailImpl(detail);
+ }
+
+ /**
+ * method setFaultCode
+ *
+ * @param name
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPFault#setFaultCode(javax.xml.soap.Name)
+ */
+ public void setFaultCode(Name name) throws SOAPException {
+
+ /*QName qName = new QName(name.getURI(), name.getLocalName(), name.getPrefix());
+ fault.setFaultCode(qName);*/
+ throw new UnsupportedOperationException("No supoprted for M2 release");
+ }
+
+ /**
+ * method getFaultCodeAsName
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultCodeAsName()
+ */
+ public Name getFaultCodeAsName() {
+
+ /*QName qName = fault.getFaultCode();
+ Name name = new PrefixedQName(qName);
+ return name;*/
+ throw new UnsupportedOperationException("No supoprted for M2 release");
+ }
+
+ /**
+ * method seFaultString
+ *
+ * @param faultString
+ * @param locale
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPFault#setFaultString(java.lang.String, java.util.Locale)
+ */
+ public void setFaultString(String faultString, Locale locale)
+ throws SOAPException {
+ //FaultString mapped to text elemtnt of SOAPFaultReason->SOAPFaultText in OM
+ // Not using Locale information
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
+ SOAPFaultText text = soapFactory.createSOAPFaultText(fReason);
+ text.setText(faultString);
+ fReason.setSOAPText(text);
+ }
+
+ /**
+ * method getFaultStringLocale
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultStringLocale()
+ */
+ public Locale getFaultStringLocale() {
+ //No implementation in Axis 1.2 also, not sure what to do here
+ return null; //TODO
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java Thu Sep 15 11:52:11 2005
@@ -1,91 +1,91 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.saaj;
-
-import org.apache.axis2.soap.SOAPHeaderBlock;
-
-import javax.xml.soap.SOAPHeaderElement;
-
-/**
- * Class SOAPHeaderImpl
- *
- * @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
- */
-public class SOAPHeaderElementImpl extends SOAPElementImpl implements
- SOAPHeaderElement {
-
- /**
- * Field omHeaderElement
- */
- SOAPHeaderBlock omHeaderElement;
-
- /**
- * Constructor SOAPHeaderElementImpl
- *
- * @param headerElement
- */
- public SOAPHeaderElementImpl(
- org.apache.axis2.soap.SOAPHeaderBlock headerElement) {
- super(headerElement);
- this.omHeaderElement = headerElement;
- }
-
- /**
- * method setActor
- *
- * @param actorURI
- * @see javax.xml.soap.SOAPHeaderElement#setActor(java.lang.String)
- */
- public void setActor(String actorURI) {
-
- omHeaderElement.setRole(actorURI);
- }
-
- /**
- * method getActor
- *
- * @return
- * @see javax.xml.soap.SOAPHeaderElement#getActor()
- */
- public String getActor() {
-
- return omHeaderElement.getRole();
- }
-
- /**
- * method setMustUnderstand
- *
- * @param mustUnderstand
- * @see javax.xml.soap.SOAPHeaderElement#setMustUnderstand(boolean)
- */
- public void setMustUnderstand(boolean mustUnderstand) {
-
- omHeaderElement.setMustUnderstand(mustUnderstand);
- }
-
- /**
- * method getMustUnderstand
- *
- * @return
- * @see javax.xml.soap.SOAPHeaderElement#getMustUnderstand()
- */
- public boolean getMustUnderstand() {
-
- return omHeaderElement.getMustUnderstand();
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.saaj;
+
+import org.apache.axis2.soap.SOAPHeaderBlock;
+
+import javax.xml.soap.SOAPHeaderElement;
+
+/**
+ * Class SOAPHeaderImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class SOAPHeaderElementImpl extends SOAPElementImpl implements
+ SOAPHeaderElement {
+
+ /**
+ * Field omHeaderElement
+ */
+ SOAPHeaderBlock omHeaderElement;
+
+ /**
+ * Constructor SOAPHeaderElementImpl
+ *
+ * @param headerElement
+ */
+ public SOAPHeaderElementImpl(
+ org.apache.axis2.soap.SOAPHeaderBlock headerElement) {
+ super(headerElement);
+ this.omHeaderElement = headerElement;
+ }
+
+ /**
+ * method setActor
+ *
+ * @param actorURI
+ * @see javax.xml.soap.SOAPHeaderElement#setActor(java.lang.String)
+ */
+ public void setActor(String actorURI) {
+
+ omHeaderElement.setRole(actorURI);
+ }
+
+ /**
+ * method getActor
+ *
+ * @return
+ * @see javax.xml.soap.SOAPHeaderElement#getActor()
+ */
+ public String getActor() {
+
+ return omHeaderElement.getRole();
+ }
+
+ /**
+ * method setMustUnderstand
+ *
+ * @param mustUnderstand
+ * @see javax.xml.soap.SOAPHeaderElement#setMustUnderstand(boolean)
+ */
+ public void setMustUnderstand(boolean mustUnderstand) {
+
+ omHeaderElement.setMustUnderstand(mustUnderstand);
+ }
+
+ /**
+ * method getMustUnderstand
+ *
+ * @return
+ * @see javax.xml.soap.SOAPHeaderElement#getMustUnderstand()
+ */
+ public boolean getMustUnderstand() {
+
+ return omHeaderElement.getMustUnderstand();
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java Thu Sep 15 11:52:11 2005
@@ -1,199 +1,199 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.saaj;
-
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * Class SOAPHeaderImpl
- *
- * @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
- */
-public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader {
-
- /**
- * Field omHeader OM's SOAPHeader field
- */
- private org.apache.axis2.soap.SOAPHeader omHeader;
-
- /**
- * Constructor SOAPHeaderImpl
- *
- * @param header
- */
- public SOAPHeaderImpl(org.apache.axis2.soap.SOAPHeader header) {
- super(header);
- this.omHeader = header;
- }
-
- /**
- * Method addHeaderElement
- *
- * @param name
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPHeader#addHeaderElement(javax.xml.soap.Name)
- */
- public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
- // Create an OMHeaderBlock out of name and add it a SOAPHeaderElement
- //to SOAPHeader
- String localName = name.getLocalName();
- OMFactory omFactory = OMAbstractFactory.getOMFactory();
- OMNamespace ns = omFactory.createOMNamespace(name.getURI(),
- name.getPrefix());
- org.apache.axis2.soap.SOAPHeaderBlock headerBlock = omHeader.addHeaderBlock(
- localName, ns);
- return (new SOAPHeaderElementImpl(headerBlock));
- }
-
- /**
- * method examineHeaderElements
- *
- * @param actor
- * @return
- * @see javax.xml.soap.SOAPHeader#examineHeaderElements(java.lang.String)
- */
- public Iterator examineHeaderElements(String actor) {
- // Get all the om specific header elements in an iterator and wrap it
- // in a soap specific iterator and return
- Iterator headerElementsIter = omHeader.examineHeaderBlocks(actor);
- ArrayList aList = new ArrayList();
- while (headerElementsIter.hasNext()) {
- Object o = headerElementsIter.next();
- if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
- org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
- SOAPHeaderElement element = (new SOAPHeaderElementImpl(
- headerBlock));
- aList.add(element);
- }
- }
- return aList.iterator();
- }
-
- /**
- * method extractHeaderElements
- *
- * @param actor
- * @return
- * @see javax.xml.soap.SOAPHeader#extractHeaderElements(java.lang.String)
- */
- public Iterator extractHeaderElements(String actor) {
- // Get all the om specific header elements in an iterator and wrap it
- // in a soap specific iterator and return
- Iterator headerElementsIter = omHeader.extractHeaderBlocks(actor);
- ArrayList aList = new ArrayList();
- while (headerElementsIter.hasNext()) {
- Object o = headerElementsIter.next();
- if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
- org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
- SOAPHeaderElement element = (new SOAPHeaderElementImpl(
- headerBlock));
- aList.add(element);
- }
- }
- return aList.iterator();
- }
-
- /**
- * method examineMustUnderstandHeaderElements
- *
- * @param actor
- * @return
- * @see javax.xml.soap.SOAPHeader#examineMustUnderstandHeaderElements(java.lang.String)
- */
- public Iterator examineMustUnderstandHeaderElements(String actor) {
- // Get all the om specific header elements in an iterator and wrap it
- // in a soap specific iterator and return
- Iterator headerElementsIter = omHeader.examineMustUnderstandHeaderBlocks(
- actor);
- ArrayList aList = new ArrayList();
- while (headerElementsIter.hasNext()) {
- Object o = headerElementsIter.next();
- if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
- org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
- SOAPHeaderElement element = (new SOAPHeaderElementImpl(
- headerBlock));
- aList.add(element);
- }
- }
- return aList.iterator();
- }
-
- /**
- * method examineAllHeaderElements
- *
- * @return
- * @see javax.xml.soap.SOAPHeader#examineAllHeaderElements()
- */
- public Iterator examineAllHeaderElements() {
- // Get all the om specific header elements in an iterator and wrap it
- // in a soap specific iterator and return
- Iterator headerElementsIter = omHeader.examineAllHeaderBlocks();
- ArrayList aList = new ArrayList();
- while (headerElementsIter.hasNext()) {
- Object o = headerElementsIter.next();
- if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
- org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
- SOAPHeaderElement element = (new SOAPHeaderElementImpl(
- headerBlock));
- aList.add(element);
- }
- }
- return aList.iterator();
- }
-
- /**
- * method extractAllHeaderElements
- *
- * @return
- * @see javax.xml.soap.SOAPHeader#extractAllHeaderElements()
- */
- public Iterator extractAllHeaderElements() {
- // Get all the om specific header elements in an iterator and wrap it
- // in a soap specific iterator and return
- Iterator headerElementsIter = omHeader.extractAllHeaderBlocks();
- ArrayList aList = new ArrayList();
- while (headerElementsIter.hasNext()) {
- Object o = headerElementsIter.next();
- if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
- org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
- SOAPHeaderElement element = (new SOAPHeaderElementImpl(
- headerBlock));
- aList.add(element);
- }
- }
- return aList.iterator();
- }
-
- /*public boolean equals(Object o){
- if(o instanceof SOAPHeaderImpl){
- if(this.omHeader.equals(((SOAPHeaderImpl)o).omHeader))
- return true;
- }
- return false;
- }*/
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.saaj;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Class SOAPHeaderImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader {
+
+ /**
+ * Field omHeader OM's SOAPHeader field
+ */
+ private org.apache.axis2.soap.SOAPHeader omHeader;
+
+ /**
+ * Constructor SOAPHeaderImpl
+ *
+ * @param header
+ */
+ public SOAPHeaderImpl(org.apache.axis2.soap.SOAPHeader header) {
+ super(header);
+ this.omHeader = header;
+ }
+
+ /**
+ * Method addHeaderElement
+ *
+ * @param name
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPHeader#addHeaderElement(javax.xml.soap.Name)
+ */
+ public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
+ // Create an OMHeaderBlock out of name and add it a SOAPHeaderElement
+ //to SOAPHeader
+ String localName = name.getLocalName();
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMNamespace ns = omFactory.createOMNamespace(name.getURI(),
+ name.getPrefix());
+ org.apache.axis2.soap.SOAPHeaderBlock headerBlock = omHeader.addHeaderBlock(
+ localName, ns);
+ return (new SOAPHeaderElementImpl(headerBlock));
+ }
+
+ /**
+ * method examineHeaderElements
+ *
+ * @param actor
+ * @return
+ * @see javax.xml.soap.SOAPHeader#examineHeaderElements(java.lang.String)
+ */
+ public Iterator examineHeaderElements(String actor) {
+ // Get all the om specific header elements in an iterator and wrap it
+ // in a soap specific iterator and return
+ Iterator headerElementsIter = omHeader.examineHeaderBlocks(actor);
+ ArrayList aList = new ArrayList();
+ while (headerElementsIter.hasNext()) {
+ Object o = headerElementsIter.next();
+ if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
+ org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
+ SOAPHeaderElement element = (new SOAPHeaderElementImpl(
+ headerBlock));
+ aList.add(element);
+ }
+ }
+ return aList.iterator();
+ }
+
+ /**
+ * method extractHeaderElements
+ *
+ * @param actor
+ * @return
+ * @see javax.xml.soap.SOAPHeader#extractHeaderElements(java.lang.String)
+ */
+ public Iterator extractHeaderElements(String actor) {
+ // Get all the om specific header elements in an iterator and wrap it
+ // in a soap specific iterator and return
+ Iterator headerElementsIter = omHeader.extractHeaderBlocks(actor);
+ ArrayList aList = new ArrayList();
+ while (headerElementsIter.hasNext()) {
+ Object o = headerElementsIter.next();
+ if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
+ org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
+ SOAPHeaderElement element = (new SOAPHeaderElementImpl(
+ headerBlock));
+ aList.add(element);
+ }
+ }
+ return aList.iterator();
+ }
+
+ /**
+ * method examineMustUnderstandHeaderElements
+ *
+ * @param actor
+ * @return
+ * @see javax.xml.soap.SOAPHeader#examineMustUnderstandHeaderElements(java.lang.String)
+ */
+ public Iterator examineMustUnderstandHeaderElements(String actor) {
+ // Get all the om specific header elements in an iterator and wrap it
+ // in a soap specific iterator and return
+ Iterator headerElementsIter = omHeader.examineMustUnderstandHeaderBlocks(
+ actor);
+ ArrayList aList = new ArrayList();
+ while (headerElementsIter.hasNext()) {
+ Object o = headerElementsIter.next();
+ if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
+ org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
+ SOAPHeaderElement element = (new SOAPHeaderElementImpl(
+ headerBlock));
+ aList.add(element);
+ }
+ }
+ return aList.iterator();
+ }
+
+ /**
+ * method examineAllHeaderElements
+ *
+ * @return
+ * @see javax.xml.soap.SOAPHeader#examineAllHeaderElements()
+ */
+ public Iterator examineAllHeaderElements() {
+ // Get all the om specific header elements in an iterator and wrap it
+ // in a soap specific iterator and return
+ Iterator headerElementsIter = omHeader.examineAllHeaderBlocks();
+ ArrayList aList = new ArrayList();
+ while (headerElementsIter.hasNext()) {
+ Object o = headerElementsIter.next();
+ if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
+ org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
+ SOAPHeaderElement element = (new SOAPHeaderElementImpl(
+ headerBlock));
+ aList.add(element);
+ }
+ }
+ return aList.iterator();
+ }
+
+ /**
+ * method extractAllHeaderElements
+ *
+ * @return
+ * @see javax.xml.soap.SOAPHeader#extractAllHeaderElements()
+ */
+ public Iterator extractAllHeaderElements() {
+ // Get all the om specific header elements in an iterator and wrap it
+ // in a soap specific iterator and return
+ Iterator headerElementsIter = omHeader.extractAllHeaderBlocks();
+ ArrayList aList = new ArrayList();
+ while (headerElementsIter.hasNext()) {
+ Object o = headerElementsIter.next();
+ if (o instanceof org.apache.axis2.soap.SOAPHeaderBlock) {
+ org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock) o;
+ SOAPHeaderElement element = (new SOAPHeaderElementImpl(
+ headerBlock));
+ aList.add(element);
+ }
+ }
+ return aList.iterator();
+ }
+
+ /*public boolean equals(Object o){
+ if(o instanceof SOAPHeaderImpl){
+ if(this.omHeader.equals(((SOAPHeaderImpl)o).omHeader))
+ return true;
+ }
+ return false;
+ }*/
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java Thu Sep 15 11:52:11 2005
@@ -1,490 +1,490 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.saaj;
-
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.SessionUtils;
-import org.w3c.dom.*;
-
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPPart;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.transform.Source;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-
-/**
- * @author Ashutosh Shahi ashutosh.shahi@gmail.com
- * <p/>
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public class SOAPPartImpl extends SOAPPart {
-
- private SOAPMessageImpl msgObject;
- private MimeHeaders mimeHeaders = new MimeHeaders();
- private Object envelope;
- /**
- * default message encoding charset
- */
- private String currentEncoding = "UTF-8";
-
- public SOAPPartImpl(SOAPMessageImpl parent,
- Object initialContents,
- boolean isBodyStream) throws SOAPException {
-
- setMimeHeader(HTTPConstants.HEADER_CONTENT_ID,
- SessionUtils.generateSessionId());
- setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, "text/xml");
- StAXSOAPModelBuilder stAXSOAPModelBuilder;
-
- msgObject = parent;
- try {
- if (initialContents instanceof SOAPEnvelope) {
- ((SOAPEnvelopeImpl) initialContents).setOwnerDocument(this);
- envelope = initialContents;
- } else if (initialContents instanceof InputStream) {
- //XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader((InputStream)initialContents);
- InputStreamReader inr = new InputStreamReader(
- (InputStream) initialContents);
- stAXSOAPModelBuilder =
- new StAXSOAPModelBuilder(
- XMLInputFactory.newInstance()
- .createXMLStreamReader(inr), null);
- org.apache.axis2.soap.SOAPEnvelope omEnv = stAXSOAPModelBuilder.getSOAPEnvelope();
- envelope = new SOAPEnvelopeImpl(omEnv);
- ((SOAPEnvelopeImpl) envelope).setOwnerDocument(this);
- }
-
- } catch (Exception e) {
- throw new SOAPException(e);
- }
- }
-
- public SOAPMessageImpl getMessage() {
- return msgObject;
- }
-
- /**
- * Set the Message for this Part.
- * Do not call this Directly. Called by Message.
- *
- * @param msg the <code>Message</code> for this part
- */
- public void setMessage(SOAPMessageImpl msg) {
- this.msgObject = msg;
- }
-
- /**
- * @see javax.xml.soap.SOAPPart#getEnvelope()
- */
- public SOAPEnvelope getEnvelope() throws SOAPException {
- //if(envelope != null)
- return (SOAPEnvelope) envelope;
-
- }
-
- /**
- * Removes all MIME headers that match the given name.
- *
- * @param header a <CODE>String</CODE> giving
- * the name of the MIME header(s) to be removed
- */
- public void removeMimeHeader(String header) {
- mimeHeaders.removeHeader(header);
- }
-
- /**
- * Removes all the <CODE>MimeHeader</CODE> objects for this
- * <CODE>SOAPEnvelope</CODE> object.
- */
- public void removeAllMimeHeaders() {
- mimeHeaders.removeAllHeaders();
- }
-
- /**
- * Gets all the values of the <CODE>MimeHeader</CODE> object
- * in this <CODE>SOAPPart</CODE> object that is identified by
- * the given <CODE>String</CODE>.
- *
- * @param name the name of the header; example:
- * "Content-Type"
- * @return a <CODE>String</CODE> array giving all the values for
- * the specified header
- * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String)
- */
- public String[] getMimeHeader(String name) {
- return mimeHeaders.getHeader(name);
- }
-
- /**
- * Changes the first header entry that matches the given
- * header name so that its value is the given value, adding a
- * new header with the given name and value if no existing
- * header is a match. If there is a match, this method clears
- * all existing values for the first header that matches and
- * sets the given value instead. If more than one header has
- * the given name, this method removes all of the matching
- * headers after the first one.
- * <p/>
- * <P>Note that RFC822 headers can contain only US-ASCII
- * characters.</P>
- *
- * @param name a <CODE>String</CODE> giving the
- * header name for which to search
- * @param value a <CODE>String</CODE> giving the
- * value to be set. This value will be substituted for the
- * current value(s) of the first header that is a match if
- * there is one. If there is no match, this value will be
- * the value for a new <CODE>MimeHeader</CODE> object.
- * @ throws java.lang.IllegalArgumentException if
- * there was a problem with the specified mime header name
- * or value
- * @see #getMimeHeader(java.lang.String) getMimeHeader(java.lang.String)
- */
- public void setMimeHeader(String name, String value) {
- mimeHeaders.setHeader(name, value);
- }
-
- /**
- * Add the specified MIME header, as per JAXM.
- *
- * @param header the header to add
- * @param value the value of that header
- */
- public void addMimeHeader(String header, String value) {
- mimeHeaders.addHeader(header, value);
- }
-
- /**
- * Retrieves all the headers for this <CODE>SOAPPart</CODE>
- * object as an iterator over the <CODE>MimeHeader</CODE>
- * objects.
- *
- * @return an <CODE>Iterator</CODE> object with all of the Mime
- * headers for this <CODE>SOAPPart</CODE> object
- */
- public Iterator getAllMimeHeaders() {
- return mimeHeaders.getAllHeaders();
- }
-
- /**
- * Get all headers that match.
- *
- * @param match an array of <code>String</code>s giving mime header names
- * @return an <code>Iterator</code> over all values matching these headers
- */
- public java.util.Iterator getMatchingMimeHeaders(final String[] match) {
- return mimeHeaders.getMatchingHeaders(match);
- }
-
- /**
- * Get all headers that do not match.
- *
- * @param match an array of <code>String</code>s giving mime header names
- * @return an <code>Iterator</code> over all values not matching these
- * headers
- */
- public java.util.Iterator getNonMatchingMimeHeaders(final String[] match) {
- return mimeHeaders.getNonMatchingHeaders(match);
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPPart#setContent(javax.xml.transform.Source)
- */
- public void setContent(Source source) throws SOAPException {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPPart#getContent()
- */
- public Source getContent() throws SOAPException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Implementation of org.w3c.Document
- * Most of methods will be implemented using the delgate
- * instance of SOAPDocumentImpl
- * This is for two reasons:
- * - possible change of message classes, by extenstion of xerces implementation
- * - we cannot extends SOAPPart (multiple inheritance),
- * since it is defined as Abstract class
- * ***********************************************************
- */
-
- private Document document = new SOAPDocumentImpl(this);
-
- /**
- * @since SAAJ 1.2
- */
- public Document getSOAPDocument() {
- if (document == null) {
- document = new SOAPDocumentImpl(this);
- }
- return document;
- }
-
- /**
- * @return
- */
- public DocumentType getDoctype() {
- return document.getDoctype();
- }
-
- /**
- * @return
- */
- public DOMImplementation getImplementation() {
- return document.getImplementation();
- }
-
- /**
- * SOAPEnvelope is the Document Elements of this XML document
- */
- protected Document mDocument;
-
- public Element getDocumentElement() {
- try {
- return getEnvelope();
- } catch (SOAPException se) {
- return null;
- }
- }
-
- /**
- * @param tagName
- * @return
- * @throws DOMException
- */
- public Element createElement(String tagName) throws DOMException {
- return document.createElement(tagName);
- }
-
- public DocumentFragment createDocumentFragment() {
- return document.createDocumentFragment();
- }
-
- public Text createTextNode(String data) {
- return document.createTextNode(data);
- }
-
- public Comment createComment(String data) {
- return document.createComment(data);
- }
-
- public CDATASection createCDATASection(String data) throws DOMException {
- return document.createCDATASection(data);
- }
-
- public ProcessingInstruction createProcessingInstruction(String target,
- String data)
- throws DOMException {
- return document.createProcessingInstruction(target, data);
- }
-
- public Attr createAttribute(String name) throws DOMException {
- return document.createAttribute(name);
- }
-
- public EntityReference createEntityReference(String name) throws DOMException {
- return document.createEntityReference(name);
- }
-
- public NodeList getElementsByTagName(String tagname) {
- return document.getElementsByTagName(tagname);
- }
-
- public Node importNode(Node importedNode, boolean deep)
- throws DOMException {
- return document.importNode(importedNode, deep);
- }
-
- public Element createElementNS(String namespaceURI, String qualifiedName)
- throws DOMException {
- return document.createElementNS(namespaceURI, qualifiedName);
- }
-
- public Attr createAttributeNS(String namespaceURI, String qualifiedName)
- throws DOMException {
- return document.createAttributeNS(namespaceURI, qualifiedName);
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI,
- String localName) {
- return document.getElementsByTagNameNS(namespaceURI, localName);
- }
-
- public Element getElementById(String elementId) {
- return document.getElementById(elementId);
- }
-
- /////////////////////////////////////////////////////////////
-
- public String getEncoding() {
- return currentEncoding;
- }
-
- public void setEncoding(String s) {
- currentEncoding = s;
- }
-
- public boolean getStandalone() {
- throw new UnsupportedOperationException("Not yet implemented.71");
- }
-
-
- public void setStandalone(boolean flag) {
- throw new UnsupportedOperationException("Not yet implemented.72");
- }
-
- public boolean getStrictErrorChecking() {
- throw new UnsupportedOperationException("Not yet implemented.73");
- }
-
-
- public void setStrictErrorChecking(boolean flag) {
- throw new UnsupportedOperationException("Not yet implemented. 74");
- }
-
-
- public String getVersion() {
- throw new UnsupportedOperationException("Not yet implemented. 75");
- }
-
-
- public void setVersion(String s) {
- throw new UnsupportedOperationException("Not yet implemented.76");
- }
-
-
- public Node adoptNode(Node node)
- throws DOMException {
- throw new UnsupportedOperationException("Not yet implemented.77");
- }
-
- /**
- * Node Implementation
- */
-
- public String getNodeName() {
- return document.getNodeName();
- }
-
- public String getNodeValue() throws DOMException {
- return document.getNodeValue();
- }
-
- public void setNodeValue(String nodeValue) throws DOMException {
- document.setNodeValue(nodeValue);
- }
-
- public short getNodeType() {
- return document.getNodeType();
- }
-
- public Node getParentNode() {
- return document.getParentNode();
- }
-
- public NodeList getChildNodes() {
- return document.getChildNodes();
- }
-
- public Node getFirstChild() {
- return document.getFirstChild();
- }
-
- public Node getLastChild() {
- return document.getLastChild();
- }
-
- public Node getPreviousSibling() {
- return document.getPreviousSibling();
- }
-
- public Node getNextSibling() {
- return document.getNextSibling();
- }
-
- public NamedNodeMap getAttributes() {
- return document.getAttributes();
- }
-
- public Document getOwnerDocument() {
- return document.getOwnerDocument();
- }
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException {
- return document.insertBefore(newChild, refChild);
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
- return document.replaceChild(newChild, oldChild);
- }
-
- public Node removeChild(Node oldChild) throws DOMException {
- return document.removeChild(oldChild);
- }
-
- public Node appendChild(Node newChild) throws DOMException {
- return document.appendChild(newChild);
- }
-
- public boolean hasChildNodes() {
- return document.hasChildNodes();
- }
-
- public Node cloneNode(boolean deep) {
- return document.cloneNode(deep);
- }
-
- public void normalize() {
- document.normalize();
- }
-
- public boolean isSupported(String feature, String version) {
- return document.isSupported(feature, version);
- }
-
- public String getNamespaceURI() {
- return document.getNamespaceURI();
- }
-
- public String getPrefix() {
- return document.getPrefix();
- }
-
- public void setPrefix(String prefix) throws DOMException {
- document.setPrefix(prefix);
- }
-
- public String getLocalName() {
- return document.getLocalName();
- }
-
- public boolean hasAttributes() {
- return document.hasAttributes();
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.saaj;
+
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.SessionUtils;
+import org.w3c.dom.*;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPPart;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.transform.Source;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ * <p/>
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SOAPPartImpl extends SOAPPart {
+
+ private SOAPMessageImpl msgObject;
+ private MimeHeaders mimeHeaders = new MimeHeaders();
+ private Object envelope;
+ /**
+ * default message encoding charset
+ */
+ private String currentEncoding = "UTF-8";
+
+ public SOAPPartImpl(SOAPMessageImpl parent,
+ Object initialContents,
+ boolean isBodyStream) throws SOAPException {
+
+ setMimeHeader(HTTPConstants.HEADER_CONTENT_ID,
+ SessionUtils.generateSessionId());
+ setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, "text/xml");
+ StAXSOAPModelBuilder stAXSOAPModelBuilder;
+
+ msgObject = parent;
+ try {
+ if (initialContents instanceof SOAPEnvelope) {
+ ((SOAPEnvelopeImpl) initialContents).setOwnerDocument(this);
+ envelope = initialContents;
+ } else if (initialContents instanceof InputStream) {
+ //XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader((InputStream)initialContents);
+ InputStreamReader inr = new InputStreamReader(
+ (InputStream) initialContents);
+ stAXSOAPModelBuilder =
+ new StAXSOAPModelBuilder(
+ XMLInputFactory.newInstance()
+ .createXMLStreamReader(inr), null);
+ org.apache.axis2.soap.SOAPEnvelope omEnv = stAXSOAPModelBuilder.getSOAPEnvelope();
+ envelope = new SOAPEnvelopeImpl(omEnv);
+ ((SOAPEnvelopeImpl) envelope).setOwnerDocument(this);
+ }
+
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ }
+
+ public SOAPMessageImpl getMessage() {
+ return msgObject;
+ }
+
+ /**
+ * Set the Message for this Part.
+ * Do not call this Directly. Called by Message.
+ *
+ * @param msg the <code>Message</code> for this part
+ */
+ public void setMessage(SOAPMessageImpl msg) {
+ this.msgObject = msg;
+ }
+
+ /**
+ * @see javax.xml.soap.SOAPPart#getEnvelope()
+ */
+ public SOAPEnvelope getEnvelope() throws SOAPException {
+ //if(envelope != null)
+ return (SOAPEnvelope) envelope;
+
+ }
+
+ /**
+ * Removes all MIME headers that match the given name.
+ *
+ * @param header a <CODE>String</CODE> giving
+ * the name of the MIME header(s) to be removed
+ */
+ public void removeMimeHeader(String header) {
+ mimeHeaders.removeHeader(header);
+ }
+
+ /**
+ * Removes all the <CODE>MimeHeader</CODE> objects for this
+ * <CODE>SOAPEnvelope</CODE> object.
+ */
+ public void removeAllMimeHeaders() {
+ mimeHeaders.removeAllHeaders();
+ }
+
+ /**
+ * Gets all the values of the <CODE>MimeHeader</CODE> object
+ * in this <CODE>SOAPPart</CODE> object that is identified by
+ * the given <CODE>String</CODE>.
+ *
+ * @param name the name of the header; example:
+ * "Content-Type"
+ * @return a <CODE>String</CODE> array giving all the values for
+ * the specified header
+ * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String)
+ */
+ public String[] getMimeHeader(String name) {
+ return mimeHeaders.getHeader(name);
+ }
+
+ /**
+ * Changes the first header entry that matches the given
+ * header name so that its value is the given value, adding a
+ * new header with the given name and value if no existing
+ * header is a match. If there is a match, this method clears
+ * all existing values for the first header that matches and
+ * sets the given value instead. If more than one header has
+ * the given name, this method removes all of the matching
+ * headers after the first one.
+ * <p/>
+ * <P>Note that RFC822 headers can contain only US-ASCII
+ * characters.</P>
+ *
+ * @param name a <CODE>String</CODE> giving the
+ * header name for which to search
+ * @param value a <CODE>String</CODE> giving the
+ * value to be set. This value will be substituted for the
+ * current value(s) of the first header that is a match if
+ * there is one. If there is no match, this value will be
+ * the value for a new <CODE>MimeHeader</CODE> object.
+ * @ throws java.lang.IllegalArgumentException if
+ * there was a problem with the specified mime header name
+ * or value
+ * @see #getMimeHeader(java.lang.String) getMimeHeader(java.lang.String)
+ */
+ public void setMimeHeader(String name, String value) {
+ mimeHeaders.setHeader(name, value);
+ }
+
+ /**
+ * Add the specified MIME header, as per JAXM.
+ *
+ * @param header the header to add
+ * @param value the value of that header
+ */
+ public void addMimeHeader(String header, String value) {
+ mimeHeaders.addHeader(header, value);
+ }
+
+ /**
+ * Retrieves all the headers for this <CODE>SOAPPart</CODE>
+ * object as an iterator over the <CODE>MimeHeader</CODE>
+ * objects.
+ *
+ * @return an <CODE>Iterator</CODE> object with all of the Mime
+ * headers for this <CODE>SOAPPart</CODE> object
+ */
+ public Iterator getAllMimeHeaders() {
+ return mimeHeaders.getAllHeaders();
+ }
+
+ /**
+ * Get all headers that match.
+ *
+ * @param match an array of <code>String</code>s giving mime header names
+ * @return an <code>Iterator</code> over all values matching these headers
+ */
+ public java.util.Iterator getMatchingMimeHeaders(final String[] match) {
+ return mimeHeaders.getMatchingHeaders(match);
+ }
+
+ /**
+ * Get all headers that do not match.
+ *
+ * @param match an array of <code>String</code>s giving mime header names
+ * @return an <code>Iterator</code> over all values not matching these
+ * headers
+ */
+ public java.util.Iterator getNonMatchingMimeHeaders(final String[] match) {
+ return mimeHeaders.getNonMatchingHeaders(match);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPPart#setContent(javax.xml.transform.Source)
+ */
+ public void setContent(Source source) throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPPart#getContent()
+ */
+ public Source getContent() throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Implementation of org.w3c.Document
+ * Most of methods will be implemented using the delgate
+ * instance of SOAPDocumentImpl
+ * This is for two reasons:
+ * - possible change of message classes, by extenstion of xerces implementation
+ * - we cannot extends SOAPPart (multiple inheritance),
+ * since it is defined as Abstract class
+ * ***********************************************************
+ */
+
+ private Document document = new SOAPDocumentImpl(this);
+
+ /**
+ * @since SAAJ 1.2
+ */
+ public Document getSOAPDocument() {
+ if (document == null) {
+ document = new SOAPDocumentImpl(this);
+ }
+ return document;
+ }
+
+ /**
+ * @return
+ */
+ public DocumentType getDoctype() {
+ return document.getDoctype();
+ }
+
+ /**
+ * @return
+ */
+ public DOMImplementation getImplementation() {
+ return document.getImplementation();
+ }
+
+ /**
+ * SOAPEnvelope is the Document Elements of this XML document
+ */
+ protected Document mDocument;
+
+ public Element getDocumentElement() {
+ try {
+ return getEnvelope();
+ } catch (SOAPException se) {
+ return null;
+ }
+ }
+
+ /**
+ * @param tagName
+ * @return
+ * @throws DOMException
+ */
+ public Element createElement(String tagName) throws DOMException {
+ return document.createElement(tagName);
+ }
+
+ public DocumentFragment createDocumentFragment() {
+ return document.createDocumentFragment();
+ }
+
+ public Text createTextNode(String data) {
+ return document.createTextNode(data);
+ }
+
+ public Comment createComment(String data) {
+ return document.createComment(data);
+ }
+
+ public CDATASection createCDATASection(String data) throws DOMException {
+ return document.createCDATASection(data);
+ }
+
+ public ProcessingInstruction createProcessingInstruction(String target,
+ String data)
+ throws DOMException {
+ return document.createProcessingInstruction(target, data);
+ }
+
+ public Attr createAttribute(String name) throws DOMException {
+ return document.createAttribute(name);
+ }
+
+ public EntityReference createEntityReference(String name) throws DOMException {
+ return document.createEntityReference(name);
+ }
+
+ public NodeList getElementsByTagName(String tagname) {
+ return document.getElementsByTagName(tagname);
+ }
+
+ public Node importNode(Node importedNode, boolean deep)
+ throws DOMException {
+ return document.importNode(importedNode, deep);
+ }
+
+ public Element createElementNS(String namespaceURI, String qualifiedName)
+ throws DOMException {
+ return document.createElementNS(namespaceURI, qualifiedName);
+ }
+
+ public Attr createAttributeNS(String namespaceURI, String qualifiedName)
+ throws DOMException {
+ return document.createAttributeNS(namespaceURI, qualifiedName);
+ }
+
+ public NodeList getElementsByTagNameNS(String namespaceURI,
+ String localName) {
+ return document.getElementsByTagNameNS(namespaceURI, localName);
+ }
+
+ public Element getElementById(String elementId) {
+ return document.getElementById(elementId);
+ }
+
+ /////////////////////////////////////////////////////////////
+
+ public String getEncoding() {
+ return currentEncoding;
+ }
+
+ public void setEncoding(String s) {
+ currentEncoding = s;
+ }
+
+ public boolean getStandalone() {
+ throw new UnsupportedOperationException("Not yet implemented.71");
+ }
+
+
+ public void setStandalone(boolean flag) {
+ throw new UnsupportedOperationException("Not yet implemented.72");
+ }
+
+ public boolean getStrictErrorChecking() {
+ throw new UnsupportedOperationException("Not yet implemented.73");
+ }
+
+
+ public void setStrictErrorChecking(boolean flag) {
+ throw new UnsupportedOperationException("Not yet implemented. 74");
+ }
+
+
+ public String getVersion() {
+ throw new UnsupportedOperationException("Not yet implemented. 75");
+ }
+
+
+ public void setVersion(String s) {
+ throw new UnsupportedOperationException("Not yet implemented.76");
+ }
+
+
+ public Node adoptNode(Node node)
+ throws DOMException {
+ throw new UnsupportedOperationException("Not yet implemented.77");
+ }
+
+ /**
+ * Node Implementation
+ */
+
+ public String getNodeName() {
+ return document.getNodeName();
+ }
+
+ public String getNodeValue() throws DOMException {
+ return document.getNodeValue();
+ }
+
+ public void setNodeValue(String nodeValue) throws DOMException {
+ document.setNodeValue(nodeValue);
+ }
+
+ public short getNodeType() {
+ return document.getNodeType();
+ }
+
+ public Node getParentNode() {
+ return document.getParentNode();
+ }
+
+ public NodeList getChildNodes() {
+ return document.getChildNodes();
+ }
+
+ public Node getFirstChild() {
+ return document.getFirstChild();
+ }
+
+ public Node getLastChild() {
+ return document.getLastChild();
+ }
+
+ public Node getPreviousSibling() {
+ return document.getPreviousSibling();
+ }
+
+ public Node getNextSibling() {
+ return document.getNextSibling();
+ }
+
+ public NamedNodeMap getAttributes() {
+ return document.getAttributes();
+ }
+
+ public Document getOwnerDocument() {
+ return document.getOwnerDocument();
+ }
+
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+ return document.insertBefore(newChild, refChild);
+ }
+
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+ return document.replaceChild(newChild, oldChild);
+ }
+
+ public Node removeChild(Node oldChild) throws DOMException {
+ return document.removeChild(oldChild);
+ }
+
+ public Node appendChild(Node newChild) throws DOMException {
+ return document.appendChild(newChild);
+ }
+
+ public boolean hasChildNodes() {
+ return document.hasChildNodes();
+ }
+
+ public Node cloneNode(boolean deep) {
+ return document.cloneNode(deep);
+ }
+
+ public void normalize() {
+ document.normalize();
+ }
+
+ public boolean isSupported(String feature, String version) {
+ return document.isSupported(feature, version);
+ }
+
+ public String getNamespaceURI() {
+ return document.getNamespaceURI();
+ }
+
+ public String getPrefix() {
+ return document.getPrefix();
+ }
+
+ public void setPrefix(String prefix) throws DOMException {
+ document.setPrefix(prefix);
+ }
+
+ public String getLocalName() {
+ return document.getLocalName();
+ }
+
+ public boolean hasAttributes() {
+ return document.hasAttributes();
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java Thu Sep 15 11:52:11 2005
@@ -1,199 +1,199 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.saaj;
-
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMText;
-import org.w3c.dom.DOMException;
-
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.Text;
-
-/**
- * @author Ashutosh Shahi ashutosh.shahi@gmail.com
- * <p/>
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public class TextImpl extends NodeImpl implements Text {
-
- private OMText omText;
-
- public TextImpl(String s) {
- //super();
- omNode =
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(s);
- }
-
- public TextImpl(SOAPElementImpl parent, String s) throws SOAPException {
- //super();
- //super.setParentElement(parent);
- OMElement par = parent.getOMElement();
- omNode =
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(par, s);
- }
-
- public TextImpl(org.w3c.dom.CharacterData data) {
- if (data == null) {
- throw new IllegalArgumentException("Text value may not be null.");
- }
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(data.getData());
- }
-
- public TextImpl(OMText omText){
- omNode = this.omText = omText;
- }
-
- /*Overridden Method*/
- public SOAPElement getParentElement() {
- OMElement parent = (OMElement) omText.getParent();
- return new SOAPElementImpl(parent);
- }
-
- /*Overridden Method*/
- public void setParentElement(SOAPElement parent) throws SOAPException {
- OMElement omParent = ((SOAPElementImpl) parent).getOMElement();
- omText.setParent(omParent);
- }
-
- /*Overridden Method*/
- public String getValue() {
- return omText.getText();
- }
-
- public boolean isComment() {
-
- String temp = omText.getText();
- return temp.startsWith("<!--") && temp.endsWith("-->");
- }
-
- /**
- * Implementation of DOM TEXT Interface
- * *************************************************************
- */
-
-
- public org.w3c.dom.Text splitText(int offset) throws DOMException {
-
- String temp = omText.getText();
- int length = temp.length();
- String tailData = temp.substring(offset);
- temp = temp.substring(0, offset);
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(temp);
- TextImpl tailText = new TextImpl(tailData);
- org.w3c.dom.Node myParent = getParentNode();
- if (myParent != null) {
- org.w3c.dom.NodeList brothers = myParent.getChildNodes();
- for (int i = 0; i < brothers.getLength(); i++) {
- if (brothers.item(i).equals(this)) {
- myParent.insertBefore(tailText, this);
- return tailText;
- }
- }
- }
- return tailText;
- }
-
-
- public int getLength() {
-
- return omText.getText().length();
- }
-
-
- public void deleteData(int offset, int count) throws DOMException {
-
- String temp = omText.getText();
- StringBuffer subString = new StringBuffer(temp.substring(0, offset));
- if (temp.length() - offset >= count - offset)
- subString = subString.append(temp.substring(offset + count));
- temp = subString.toString();
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(temp);
-
- }
-
-
- public String getData() throws DOMException {
-
- return omText.getText();
- }
-
-
- public String substringData(int offset, int count) throws DOMException {
-
- String temp = omText.getText();
- if (temp.length() - offset >= count - offset)
- return temp.substring(offset, count);
- else
- return temp.substring(offset);
- }
-
-
- public void replaceData(int offset, int count, String arg)
- throws DOMException {
-
- deleteData(offset, count);
- StringBuffer temp = new StringBuffer(omText.getText());
- temp.append(arg);
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(temp.toString());
- }
-
-
- public void insertData(int offset, String arg) throws DOMException {
-
- if (offset < 0 || offset > omText.getText().length())
- throw new DOMException(DOMException.INDEX_SIZE_ERR, "");
- StringBuffer temp = new StringBuffer(
- omText.getText().substring(0, offset));
- temp = temp.append(arg);
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(temp.toString());
- }
-
-
- public void appendData(String arg) throws DOMException {
-
- StringBuffer temp = new StringBuffer(omText.getText());
- temp = temp.append(arg);
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(temp.toString());
-
- }
-
-
- public void setData(String arg) throws DOMException {
-
- omText =
- org.apache.axis2.om.OMAbstractFactory.getOMFactory()
- .createText(arg);
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.saaj;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMText;
+import org.w3c.dom.DOMException;
+
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.Text;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ * <p/>
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TextImpl extends NodeImpl implements Text {
+
+ private OMText omText;
+
+ public TextImpl(String s) {
+ //super();
+ omNode =
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(s);
+ }
+
+ public TextImpl(SOAPElementImpl parent, String s) throws SOAPException {
+ //super();
+ //super.setParentElement(parent);
+ OMElement par = parent.getOMElement();
+ omNode =
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(par, s);
+ }
+
+ public TextImpl(org.w3c.dom.CharacterData data) {
+ if (data == null) {
+ throw new IllegalArgumentException("Text value may not be null.");
+ }
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(data.getData());
+ }
+
+ public TextImpl(OMText omText){
+ omNode = this.omText = omText;
+ }
+
+ /*Overridden Method*/
+ public SOAPElement getParentElement() {
+ OMElement parent = (OMElement) omText.getParent();
+ return new SOAPElementImpl(parent);
+ }
+
+ /*Overridden Method*/
+ public void setParentElement(SOAPElement parent) throws SOAPException {
+ OMElement omParent = ((SOAPElementImpl) parent).getOMElement();
+ omText.setParent(omParent);
+ }
+
+ /*Overridden Method*/
+ public String getValue() {
+ return omText.getText();
+ }
+
+ public boolean isComment() {
+
+ String temp = omText.getText();
+ return temp.startsWith("<!--") && temp.endsWith("-->");
+ }
+
+ /**
+ * Implementation of DOM TEXT Interface
+ * *************************************************************
+ */
+
+
+ public org.w3c.dom.Text splitText(int offset) throws DOMException {
+
+ String temp = omText.getText();
+ int length = temp.length();
+ String tailData = temp.substring(offset);
+ temp = temp.substring(0, offset);
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(temp);
+ TextImpl tailText = new TextImpl(tailData);
+ org.w3c.dom.Node myParent = getParentNode();
+ if (myParent != null) {
+ org.w3c.dom.NodeList brothers = myParent.getChildNodes();
+ for (int i = 0; i < brothers.getLength(); i++) {
+ if (brothers.item(i).equals(this)) {
+ myParent.insertBefore(tailText, this);
+ return tailText;
+ }
+ }
+ }
+ return tailText;
+ }
+
+
+ public int getLength() {
+
+ return omText.getText().length();
+ }
+
+
+ public void deleteData(int offset, int count) throws DOMException {
+
+ String temp = omText.getText();
+ StringBuffer subString = new StringBuffer(temp.substring(0, offset));
+ if (temp.length() - offset >= count - offset)
+ subString = subString.append(temp.substring(offset + count));
+ temp = subString.toString();
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(temp);
+
+ }
+
+
+ public String getData() throws DOMException {
+
+ return omText.getText();
+ }
+
+
+ public String substringData(int offset, int count) throws DOMException {
+
+ String temp = omText.getText();
+ if (temp.length() - offset >= count - offset)
+ return temp.substring(offset, count);
+ else
+ return temp.substring(offset);
+ }
+
+
+ public void replaceData(int offset, int count, String arg)
+ throws DOMException {
+
+ deleteData(offset, count);
+ StringBuffer temp = new StringBuffer(omText.getText());
+ temp.append(arg);
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(temp.toString());
+ }
+
+
+ public void insertData(int offset, String arg) throws DOMException {
+
+ if (offset < 0 || offset > omText.getText().length())
+ throw new DOMException(DOMException.INDEX_SIZE_ERR, "");
+ StringBuffer temp = new StringBuffer(
+ omText.getText().substring(0, offset));
+ temp = temp.append(arg);
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(temp.toString());
+ }
+
+
+ public void appendData(String arg) throws DOMException {
+
+ StringBuffer temp = new StringBuffer(omText.getText());
+ temp = temp.append(arg);
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(temp.toString());
+
+ }
+
+
+ public void setData(String arg) throws DOMException {
+
+ omText =
+ org.apache.axis2.om.OMAbstractFactory.getOMFactory()
+ .createText(arg);
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java Thu Sep 15 11:52:11 2005
@@ -1,39 +1,39 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.util;
-
-import org.apache.axis2.om.OMNode;
-import org.apache.axis2.saaj.NodeImpl;
-import org.w3c.dom.Node;
-
-/**
- * Class to convert DOM node to OM Node
- */
-public class Dom2OmUtils {
-
- private OMNode omNode;
-
- public static OMNode toOM(Node node) {
- if (node instanceof NodeImpl) {
- return ((NodeImpl) node).getOMNode();
- }
- //ELSE Assumes an implemenattion of DOM to be present
- //so, here we convert DOM Node to a OMNode and add it as a
- //child to the omNode member of this NodeImpl
- return null;
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.util;
+
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.saaj.NodeImpl;
+import org.w3c.dom.Node;
+
+/**
+ * Class to convert DOM node to OM Node
+ */
+public class Dom2OmUtils {
+
+ private OMNode omNode;
+
+ public static OMNode toOM(Node node) {
+ if (node instanceof NodeImpl) {
+ return ((NodeImpl) node).getOMNode();
+ }
+ //ELSE Assumes an implemenattion of DOM to be present
+ //so, here we convert DOM Node to a OMNode and add it as a
+ //child to the omNode member of this NodeImpl
+ return null;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java
------------------------------------------------------------------------------
svn:eol-style = native