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 gd...@apache.org on 2005/07/11 17:49:55 UTC
svn commit: r210150 [14/35] - in /webservices/axis/trunk/java: ./ etc/
modules/addressing/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/
modules/addressing/test/org/apache/axis2/handlers/addressing/ mod...
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java Mon Jul 11 08:49:30 2005
@@ -23,175 +23,169 @@
/**
* Class SOAPEnvelopeImpl
- *
+ *
* @author Jayachandra
- * jayachandra@gmail.com
+ * jayachandra@gmail.com
*/
public class SOAPEnvelopeImpl extends SOAPElementImpl implements SOAPEnvelope {
- /**
- * Field soSOAPEnvelope
- * A data member of OM's SOAPEnvelopeImpl which would be used for delegation of any work to underlying OM.
- */
- private org.apache.axis2.soap.SOAPEnvelope omSOAPEnvelope;
-
- /**
- * Constructor SOAPEnvelopeImpl
- */
- public SOAPEnvelopeImpl(){
- //super(omEnv);
- SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
- omNode = omElement =omSOAPEnvelope = fac.getDefaultEnvelope();
- }
-
- public SOAPEnvelopeImpl(org.apache.axis2.soap.SOAPEnvelope omEnvelope){
- super(omEnvelope);
- this.omSOAPEnvelope = omEnvelope;
- }
-
- /**
- * method getOMEnvelope
- * @return
- */
- public org.apache.axis2.soap.SOAPEnvelope getOMEnvelope(){
- return omSOAPEnvelope;
- }
-
-
- /**
- * method createName
- * @param localName
- * @param prefix
- * @param uri
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPEnvelope#createName(java.lang.String, java.lang.String, java.lang.String)
- */
- public Name createName(String localName, String prefix, String uri)
- throws SOAPException {
- try {
- return new PrefixedQName(uri,localName, prefix);
- }catch (Exception e)
- {
- throw new SOAPException(e);
- }
- }
-
- /**
- * method createName
- *
- * @param localName
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPEnvelope#createName(java.lang.String)
- */
- public Name createName(String localName) throws SOAPException {
- try {
- return new PrefixedQName(null, localName, null);
- }catch (Exception e)
- {
- throw new SOAPException(e);
- }
- }
-
- /**
- * method getHeader
- *
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPEnvelope#getHeader()
- */
- public SOAPHeader getHeader() throws SOAPException {
-
- org.apache.axis2.soap.SOAPHeader omSOAPHeader;
- try
- {
- omSOAPHeader = (org.apache.axis2.soap.SOAPHeader) omSOAPEnvelope.getHeader();
- }catch (Exception e)
- {
- throw new SOAPException(e);
- }
- if(omSOAPHeader != null)
- return new SOAPHeaderImpl(omSOAPHeader);
- else
- return null;
- }
-
- /**
- * method getBody
- *
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPEnvelope#getBody()
- */
- public SOAPBody getBody() throws SOAPException {
-
- org.apache.axis2.soap.SOAPBody omSOAPBody = null;
- try
- {
- omSOAPBody = omSOAPEnvelope.getBody();
- } catch (Exception e)
- {
- //throw new SOAPException(e);
- }
- if(omSOAPBody != null)
- return (new SOAPBodyImpl(omSOAPBody));
- else
- return null;
- }
-
- /**
- * method addHeader
- *
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPEnvelope#addHeader()
- */
- public SOAPHeader addHeader() throws SOAPException {
- /*
- * Our objective is to set the omSOAPHeader of the omSOAPEnvelope if not already present
- */
- try {
- org.apache.axis2.soap.SOAPHeader header = omSOAPEnvelope.getHeader();
- if (header == null) {
- SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
- header = soapFactory.createSOAPHeader(omSOAPEnvelope);
- omSOAPEnvelope.addChild(header);
- return (new SOAPHeaderImpl(header));
- } else {
- throw new SOAPException("Header already present, can't set body again without deleting the existing header");
- }
- }catch (Exception e)
- {
- throw new SOAPException(e);
- }
- }
-
- /**
- * method addBody
- *
- * @return
- * @throws SOAPException
- * @see javax.xml.soap.SOAPEnvelope#addBody()
- */
- public SOAPBody addBody() throws SOAPException {
- /*
- * Our objective is to set the omSOAPBody of the omSOAPEnvelope if not already present
- */
- try {
- org.apache.axis2.soap.SOAPBody body = omSOAPEnvelope.getBody();
- if (body == null) {
- SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
- body = soapFactory.createSOAPBody(omSOAPEnvelope);
- omSOAPEnvelope.addChild(body);
- return (new SOAPBodyImpl(body));
- } else {
- throw new SOAPException("Body already present, can't set body again without deleting the existing body");
- }
- }catch (Exception e)
- {
- throw new SOAPException(e);
- }
- }
+ /**
+ * Field soSOAPEnvelope
+ * A data member of OM's SOAPEnvelopeImpl which would be used for delegation of any work to underlying OM.
+ */
+ private org.apache.axis2.soap.SOAPEnvelope omSOAPEnvelope;
+
+ /**
+ * Constructor SOAPEnvelopeImpl
+ */
+ public SOAPEnvelopeImpl() {
+ //super(omEnv);
+ SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+ omNode = omElement = omSOAPEnvelope = fac.getDefaultEnvelope();
+ }
+
+ public SOAPEnvelopeImpl(org.apache.axis2.soap.SOAPEnvelope omEnvelope) {
+ super(omEnvelope);
+ this.omSOAPEnvelope = omEnvelope;
+ }
+
+ /**
+ * method getOMEnvelope
+ *
+ * @return
+ */
+ public org.apache.axis2.soap.SOAPEnvelope getOMEnvelope() {
+ return omSOAPEnvelope;
+ }
+
+
+ /**
+ * method createName
+ *
+ * @param localName
+ * @param prefix
+ * @param uri
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#createName(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Name createName(String localName, String prefix, String uri)
+ throws SOAPException {
+ try {
+ return new PrefixedQName(uri, localName, prefix);
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * method createName
+ *
+ * @param localName
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#createName(java.lang.String)
+ */
+ public Name createName(String localName) throws SOAPException {
+ try {
+ return new PrefixedQName(null, localName, null);
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * method getHeader
+ *
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#getHeader()
+ */
+ public SOAPHeader getHeader() throws SOAPException {
+
+ org.apache.axis2.soap.SOAPHeader omSOAPHeader;
+ try {
+ omSOAPHeader = (org.apache.axis2.soap.SOAPHeader) omSOAPEnvelope.getHeader();
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ if (omSOAPHeader != null)
+ return new SOAPHeaderImpl(omSOAPHeader);
+ else
+ return null;
+ }
+
+ /**
+ * method getBody
+ *
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#getBody()
+ */
+ public SOAPBody getBody() throws SOAPException {
+
+ org.apache.axis2.soap.SOAPBody omSOAPBody = null;
+ try {
+ omSOAPBody = omSOAPEnvelope.getBody();
+ } catch (Exception e) {
+ //throw new SOAPException(e);
+ }
+ if (omSOAPBody != null)
+ return (new SOAPBodyImpl(omSOAPBody));
+ else
+ return null;
+ }
+
+ /**
+ * method addHeader
+ *
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#addHeader()
+ */
+ public SOAPHeader addHeader() throws SOAPException {
+ /*
+ * Our objective is to set the omSOAPHeader of the omSOAPEnvelope if not already present
+ */
+ try {
+ org.apache.axis2.soap.SOAPHeader header = omSOAPEnvelope.getHeader();
+ if (header == null) {
+ SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+ header = soapFactory.createSOAPHeader(omSOAPEnvelope);
+ omSOAPEnvelope.addChild(header);
+ return (new SOAPHeaderImpl(header));
+ } else {
+ throw new SOAPException("Header already present, can't set body again without deleting the existing header");
+ }
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * method addBody
+ *
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#addBody()
+ */
+ public SOAPBody addBody() throws SOAPException {
+ /*
+ * Our objective is to set the omSOAPBody of the omSOAPEnvelope if not already present
+ */
+ try {
+ org.apache.axis2.soap.SOAPBody body = omSOAPEnvelope.getBody();
+ if (body == null) {
+ SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+ body = soapFactory.createSOAPBody(omSOAPEnvelope);
+ omSOAPEnvelope.addChild(body);
+ return (new SOAPBodyImpl(body));
+ } else {
+ throw new SOAPException("Body already present, can't set body again without deleting the existing body");
+ }
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFactoryImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFactoryImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFactoryImpl.java Mon Jul 11 08:49:30 2005
@@ -25,60 +25,60 @@
/**
* @author shaas02
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * <p/>
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
*/
public class SOAPFactoryImpl extends javax.xml.soap.SOAPFactory {
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
- */
- public SOAPElement createElement(Name name) throws SOAPException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
- */
- public SOAPElement createElement(String localName) throws SOAPException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public SOAPElement createElement(String localName, String prefix, String uri)
- throws SOAPException {
- OMElement newOMElement = OMAbstractFactory.getOMFactory().createOMElement(localName, uri, prefix);
- return new SOAPElementImpl(newOMElement);
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPFactory#createDetail()
- */
- public Detail createDetail() throws SOAPException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPFactory#createName(java.lang.String, java.lang.String, java.lang.String)
- */
- public Name createName(String localName, String prefix, String uri)
- throws SOAPException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPFactory#createName(java.lang.String)
- */
- public Name createName(String localName) throws SOAPException {
- // TODO Auto-generated method stub
- return null;
- }
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
+ */
+ public SOAPElement createElement(Name name) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
+ */
+ public SOAPElement createElement(String localName) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public SOAPElement createElement(String localName, String prefix, String uri)
+ throws SOAPException {
+ OMElement newOMElement = OMAbstractFactory.getOMFactory().createOMElement(localName, uri, prefix);
+ return new SOAPElementImpl(newOMElement);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPFactory#createDetail()
+ */
+ public Detail createDetail() throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPFactory#createName(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Name createName(String localName, String prefix, String uri)
+ throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPFactory#createName(java.lang.String)
+ */
+ public Name createName(String localName) throws SOAPException {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java Mon Jul 11 08:49:30 2005
@@ -21,12 +21,11 @@
* Class SOAPFaultElementImpl
* Just a placeholder, extends SOAPElementImpl
* Does not implement any new methods or override anything
- *
- * @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
*
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
*/
public class SOAPFaultElementImpl extends SOAPElementImpl implements
- SOAPFaultElement {
+ SOAPFaultElement {
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java Mon Jul 11 08:49:30 2005
@@ -15,217 +15,211 @@
*/
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 org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.SOAPFaultCode;
-import org.apache.axis2.soap.SOAPFaultDetail;
-import org.apache.axis2.soap.SOAPFaultNode;
-import org.apache.axis2.soap.SOAPFaultReason;
-import org.apache.axis2.soap.SOAPFaultText;
-import org.apache.axis2.soap.SOAPFaultValue;
-
import java.util.Locale;
/**
* Class SOAPFaultImpl
- *
+ *
* @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
- *
- * SOAPFault specific classes not implemented in OM, so
- * throwing unsupported operation for the time being
+ * 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.getDefaultSOAPFactory();
- 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.getDefaultSOAPFactory();
- 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.getDefaultSOAPFactory();
- 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.getDefaultSOAPFactory();
- 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.getDefaultSOAPFactory();
- 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
- }
+
+ /**
+ * 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.getDefaultSOAPFactory();
+ 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.getDefaultSOAPFactory();
+ 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.getDefaultSOAPFactory();
+ 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.getDefaultSOAPFactory();
+ 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.getDefaultSOAPFactory();
+ 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
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java Mon Jul 11 08:49:30 2005
@@ -21,69 +21,70 @@
/**
* Class SOAPHeaderImpl
- *
+ *
* @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
+ * 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();
- }
+ 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();
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java Mon Jul 11 08:49:30 2005
@@ -28,163 +28,164 @@
/**
* Class SOAPHeaderImpl
- *
+ *
* @author Ashutosh Shahi
- * ashutosh.shahi@gmail.com
+ * 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;
- }*/
+ /**
+ * 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;
+ }*/
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java Mon Jul 11 08:49:30 2005
@@ -26,54 +26,55 @@
/**
* @author Ashutosh Shahi ashutosh.shahi@gmail.com
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * <p/>
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
*/
public class SOAPMessageImpl extends SOAPMessage {
-
- private SOAPPartImpl mSOAPPart;
+
+ private SOAPPartImpl mSOAPPart;
private java.util.Hashtable mProps = new java.util.Hashtable();
private MimeHeaders headers;
- public SOAPMessageImpl(Object initialContents){
- try{
- setup(initialContents, false, null, null, null);
- } catch(SOAPException e){
- e.printStackTrace();
- }
- }
-
+ public SOAPMessageImpl(Object initialContents) {
+ try {
+ setup(initialContents, false, null, null, null);
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ }
+ }
+
public SOAPMessageImpl(Object initialContents, boolean bodyInStream, javax.xml.soap.MimeHeaders headers) {
- try{
- setup(initialContents, bodyInStream, null, null, (MimeHeaders)headers);
- } catch(SOAPException e){
- e.printStackTrace();
- }
- }
-
- private void setup(Object initialContents, boolean bodyInStream,
- String contentType, String contentLocation,
- MimeHeaders mimeHeaders)throws SOAPException{
- if(null == mSOAPPart)
- mSOAPPart = new SOAPPartImpl(this, initialContents, bodyInStream);
- else
- mSOAPPart.setMessage(this);
-
- headers = (mimeHeaders == null) ? new MimeHeaders() : new MimeHeaders(mimeHeaders);
- }
-
+ try {
+ setup(initialContents, bodyInStream, null, null, (MimeHeaders) headers);
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void setup(Object initialContents, boolean bodyInStream,
+ String contentType, String contentLocation,
+ MimeHeaders mimeHeaders) throws SOAPException {
+ if (null == mSOAPPart)
+ mSOAPPart = new SOAPPartImpl(this, initialContents, bodyInStream);
+ else
+ mSOAPPart.setMessage(this);
+
+ headers = (mimeHeaders == null) ? new MimeHeaders() : new MimeHeaders(mimeHeaders);
+ }
+
/**
* Retrieves a description of this <CODE>SOAPMessage</CODE>
* object's content.
- * @return a <CODE>String</CODE> describing the content of this
- * message or <CODE>null</CODE> if no description has been
- * set
+ *
+ * @return a <CODE>String</CODE> describing the content of this
+ * message or <CODE>null</CODE> if no description has been
+ * set
* @see #setContentDescription(java.lang.String) setContentDescription(java.lang.String)
*/
public String getContentDescription() {
String values[] = headers.getHeader(HTTPConstants.HEADER_CONTENT_DESCRIPTION);
- if(values != null && values.length > 0)
+ if (values != null && values.length > 0)
return values[0];
return null;
}
@@ -81,21 +82,22 @@
/**
* Sets the description of this <CODE>SOAPMessage</CODE>
* object's content with the given description.
- * @param description a <CODE>String</CODE>
- * describing the content of this message
+ *
+ * @param description a <CODE>String</CODE>
+ * describing the content of this message
* @see #getContentDescription() getContentDescription()
*/
public void setContentDescription(String description) {
headers.setHeader(HTTPConstants.HEADER_CONTENT_DESCRIPTION, description);
}
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#getSOAPPart()
- */
- public SOAPPart getSOAPPart() {
- return mSOAPPart;
- }
-
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#getSOAPPart()
+ */
+ public SOAPPart getSOAPPart() {
+ return mSOAPPart;
+ }
+
public SOAPBody getSOAPBody() throws SOAPException {
return mSOAPPart.getEnvelope().getBody();
}
@@ -103,7 +105,7 @@
public SOAPHeader getSOAPHeader() throws SOAPException {
return mSOAPPart.getEnvelope().getHeader();
}
-
+
public void setProperty(String property, Object value) throws SOAPException {
mProps.put(property, value);
}
@@ -112,89 +114,89 @@
return mProps.get(property);
}
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#removeAllAttachments()
- */
- public void removeAllAttachments() {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#countAttachments()
- */
- public int countAttachments() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#getAttachments()
- */
- public Iterator getAttachments() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#getAttachments(javax.xml.soap.MimeHeaders)
- */
- public Iterator getAttachments(javax.xml.soap.MimeHeaders headers) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#addAttachmentPart(javax.xml.soap.AttachmentPart)
- */
- public void addAttachmentPart(AttachmentPart attachmentpart) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#createAttachmentPart()
- */
- public AttachmentPart createAttachmentPart() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#getMimeHeaders()
- */
- public javax.xml.soap.MimeHeaders getMimeHeaders() {
-
- return headers;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#saveChanges()
- */
- public void saveChanges() throws SOAPException {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#saveRequired()
- */
- public boolean saveRequired() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPMessage#writeTo(java.io.OutputStream)
- */
- public void writeTo(OutputStream out) throws SOAPException, IOException {
- try{
- OMOutput omOutput = new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(out));
- ((SOAPEnvelopeImpl)mSOAPPart.getEnvelope()).getOMEnvelope().serialize(omOutput);
- omOutput.flush();
- } catch(Exception e){
- throw new SOAPException(e);
- }
- }
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#removeAllAttachments()
+ */
+ public void removeAllAttachments() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#countAttachments()
+ */
+ public int countAttachments() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#getAttachments()
+ */
+ public Iterator getAttachments() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#getAttachments(javax.xml.soap.MimeHeaders)
+ */
+ public Iterator getAttachments(javax.xml.soap.MimeHeaders headers) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#addAttachmentPart(javax.xml.soap.AttachmentPart)
+ */
+ public void addAttachmentPart(AttachmentPart attachmentpart) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#createAttachmentPart()
+ */
+ public AttachmentPart createAttachmentPart() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#getMimeHeaders()
+ */
+ public javax.xml.soap.MimeHeaders getMimeHeaders() {
+
+ return headers;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#saveChanges()
+ */
+ public void saveChanges() throws SOAPException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#saveRequired()
+ */
+ public boolean saveRequired() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.xml.soap.SOAPMessage#writeTo(java.io.OutputStream)
+ */
+ public void writeTo(OutputStream out) throws SOAPException, IOException {
+ try {
+ OMOutput omOutput = new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(out));
+ ((SOAPEnvelopeImpl) mSOAPPart.getEnvelope()).getOMEnvelope().serialize(omOutput);
+ omOutput.flush();
+ } catch (Exception e) {
+ throw new SOAPException(e);
+ }
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java Mon Jul 11 08:49:30 2005
@@ -32,78 +32,79 @@
/**
* @author Ashutosh Shahi ashutosh.shahi@gmail.com
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * <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;
+ 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");
+
+ 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));
- org.apache.axis2.soap.SOAPEnvelope omEnv = stAXSOAPModelBuilder.getSOAPEnvelope();
- envelope = new SOAPEnvelopeImpl(omEnv);
- ((SOAPEnvelopeImpl)envelope).setOwnerDocument(this);
- }
-
- }catch(Exception e){
- throw new SOAPException(e);
+ 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));
+ 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(){
+ }
+
+ 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;
+ }
- /**
- * 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;
- }
-
- /* (non-Javadoc)
- * @see javax.xml.soap.SOAPPart#getEnvelope()
- */
- public SOAPEnvelope getEnvelope() throws SOAPException {
- //if(envelope != null)
- return (SOAPEnvelope)envelope;
-
- }
+ /* (non-Javadoc)
+ * @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
+ *
+ * @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.
*/
@@ -115,10 +116,11 @@
* 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"
+ *
+ * @param name the name of the header; example:
+ * "Content-Type"
* @return a <CODE>String</CODE> array giving all the values for
- * the specified header
+ * the specified header
* @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String)
*/
public String[] getMimeHeader(String name) {
@@ -127,39 +129,40 @@
/**
* 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.
+ * 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>
*
- * <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.
+ * @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
+ * 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);
+ 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
+ * @param header the header to add
+ * @param value the value of that header
*/
- public void addMimeHeader (String header, String value) {
+ public void addMimeHeader(String header, String value) {
mimeHeaders.addHeader(header, value);
}
@@ -167,8 +170,9 @@
* 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
+ * headers for this <CODE>SOAPPart</CODE> object
*/
public Iterator getAllMimeHeaders() {
return mimeHeaders.getAllHeaders();
@@ -177,57 +181,58 @@
/**
* Get all headers that match.
*
- * @param match an array of <code>String</code>s giving mime header names
+ * @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){
+ 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
+ * @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
+ * headers
*/
- public java.util.Iterator getNonMatchingMimeHeaders( final String[] match){
+ 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
+ /* (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
+ * @since SAAJ 1.2
*/
- public Document getSOAPDocument(){
- if(document == null){
+ public Document getSOAPDocument() {
+ if (document == null) {
document = new SOAPDocumentImpl(this);
}
return document;
@@ -236,14 +241,14 @@
/**
* @return
*/
- public DocumentType getDoctype(){
+ public DocumentType getDoctype() {
return document.getDoctype();
}
/**
* @return
*/
- public DOMImplementation getImplementation(){
+ public DOMImplementation getImplementation() {
return document.getImplementation();
}
@@ -252,17 +257,15 @@
*/
protected Document mDocument;
- public Element getDocumentElement()
- {
- try{
+ public Element getDocumentElement() {
+ try {
return getEnvelope();
- }catch(SOAPException se){
+ } catch (SOAPException se) {
return null;
}
}
/**
- *
* @param tagName
* @return
* @throws DOMException
@@ -279,7 +282,7 @@
return document.createTextNode(data);
}
- public Comment createComment(String data){
+ public Comment createComment(String data) {
return document.createComment(data);
}
@@ -288,11 +291,11 @@
}
public ProcessingInstruction createProcessingInstruction(String target, String data)
- throws DOMException {
- return document.createProcessingInstruction(target,data);
+ throws DOMException {
+ return document.createProcessingInstruction(target, data);
}
- public Attr createAttribute(String name)throws DOMException {
+ public Attr createAttribute(String name) throws DOMException {
return document.createAttribute(name);
}
@@ -305,86 +308,77 @@
}
public Node importNode(Node importedNode, boolean deep)
- throws DOMException {
+ throws DOMException {
return document.importNode(importedNode, deep);
}
public Element createElementNS(String namespaceURI, String qualifiedName)
- throws DOMException {
+ throws DOMException {
return document.createElementNS(namespaceURI, qualifiedName);
}
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
- throws DOMException {
+ throws DOMException {
return document.createAttributeNS(namespaceURI, qualifiedName);
}
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
- return document.getElementsByTagNameNS(namespaceURI,localName);
+ return document.getElementsByTagNameNS(namespaceURI, localName);
}
- public Element getElementById(String elementId){
+ public Element getElementById(String elementId) {
return document.getElementById(elementId);
}
/////////////////////////////////////////////////////////////
- public String getEncoding()
- {
+ public String getEncoding() {
return currentEncoding;
}
- public void setEncoding(String s)
- {
+ public void setEncoding(String s) {
currentEncoding = s;
}
- public boolean getStandalone()
- {
+ public boolean getStandalone() {
throw new UnsupportedOperationException("Not yet implemented.71");
}
- public void setStandalone(boolean flag)
- {
+ public void setStandalone(boolean flag) {
throw new UnsupportedOperationException("Not yet implemented.72");
}
- public boolean getStrictErrorChecking()
- {
+ public boolean getStrictErrorChecking() {
throw new UnsupportedOperationException("Not yet implemented.73");
}
- public void setStrictErrorChecking(boolean flag)
- {
+ public void setStrictErrorChecking(boolean flag) {
throw new UnsupportedOperationException("Not yet implemented. 74");
}
- public String getVersion()
- {
+ public String getVersion() {
throw new UnsupportedOperationException("Not yet implemented. 75");
}
- public void setVersion(String s)
- {
+ public void setVersion(String s) {
throw new UnsupportedOperationException("Not yet implemented.76");
}
- public Node adoptNode(Node node)
- throws DOMException
- {
+ public Node adoptNode(Node node)
+ throws DOMException {
throw new UnsupportedOperationException("Not yet implemented.77");
}
/**
- * Node Implementation
+ * Node Implementation
*/
- public String getNodeName(){
+ public String getNodeName() {
return document.getNodeName();
}
@@ -392,7 +386,7 @@
return document.getNodeValue();
}
- public void setNodeValue(String nodeValue) throws DOMException{
+ public void setNodeValue(String nodeValue) throws DOMException {
document.setNodeValue(nodeValue);
}
@@ -400,8 +394,8 @@
return document.getNodeType();
}
- public Node getParentNode(){
- return document.getParentNode();
+ public Node getParentNode() {
+ return document.getParentNode();
}
public NodeList getChildNodes() {
@@ -412,23 +406,23 @@
return document.getFirstChild();
}
- public Node getLastChild(){
+ public Node getLastChild() {
return document.getLastChild();
}
- public Node getPreviousSibling(){
+ public Node getPreviousSibling() {
return document.getPreviousSibling();
}
- public Node getNextSibling(){
+ public Node getNextSibling() {
return document.getNextSibling();
}
- public NamedNodeMap getAttributes(){
+ public NamedNodeMap getAttributes() {
return document.getAttributes();
}
- public Document getOwnerDocument(){
+ public Document getOwnerDocument() {
return document.getOwnerDocument();
}
@@ -448,18 +442,19 @@
return document.appendChild(newChild);
}
- public boolean hasChildNodes(){
+ public boolean hasChildNodes() {
return document.hasChildNodes();
}
+
public Node cloneNode(boolean deep) {
return document.cloneNode(deep);
}
- public void normalize(){
+ public void normalize() {
document.normalize();
}
- public boolean isSupported(String feature, String version){
+ public boolean isSupported(String feature, String version) {
return document.isSupported(feature, version);
}
@@ -474,11 +469,12 @@
public void setPrefix(String prefix) throws DOMException {
document.setPrefix(prefix);
}
+
public String getLocalName() {
return document.getLocalName();
}
- public boolean hasAttributes(){
+ public boolean hasAttributes() {
return document.hasAttributes();
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/TextImpl.java Mon Jul 11 08:49:30 2005
@@ -25,57 +25,57 @@
/**
* @author Ashutosh Shahi ashutosh.shahi@gmail.com
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * <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;
+ 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." );
+ 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());
- }
+ }
- /*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();
- }
+ /*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() {
+ public boolean isComment() {
- String temp = omText.getText();
- if(temp.startsWith("<!--") && temp.endsWith("-->"))
+ String temp = omText.getText();
+ if (temp.startsWith("<!--") && temp.endsWith("-->"))
return true;
return false;
- }
+ }
/**
* Implementation of DOM TEXT Interface
@@ -83,94 +83,94 @@
*/
- public org.w3c.dom.Text splitText(int offset) throws DOMException {
+ 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){
+ 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)){
+ 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() {
+ public int getLength() {
- return omText.getText().length();
- }
+ return omText.getText().length();
+ }
- public void deleteData(int offset, int count) throws DOMException {
+ 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);
+ 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 {
+ public String getData() throws DOMException {
- return omText.getText();
- }
+ return omText.getText();
+ }
- public String substringData(int offset, int count) throws DOMException {
+ 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);
- }
+ 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 {
+ 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());
- }
+ 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 {
+ 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());
- }
+ 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 {
+ 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());
+ 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 {
+ public void setData(String arg) throws DOMException {
- omText = org.apache.axis2.om.OMAbstractFactory.getOMFactory().createText(arg);
- }
+ omText = org.apache.axis2.om.OMAbstractFactory.getOMFactory().createText(arg);
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/Dom2OmUtils.java Mon Jul 11 08:49:30 2005
@@ -21,19 +21,19 @@
/**
* 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;
- }
+
+ 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;
+ }
}
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/IOUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/IOUtils.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/IOUtils.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/IOUtils.java Mon Jul 11 08:49:30 2005
@@ -21,36 +21,35 @@
/**
* Utility class containing IO helper methods
*/
-public class IOUtils
-{
+public class IOUtils {
private IOUtils() {
}
/**
* Read into a byte array; tries to ensure that the the
* full buffer is read.
- *
+ * <p/>
* Helper method, just calls <tt>readFully(in, b, 0, b.length)</tt>
+ *
* @see #readFully(java.io.InputStream, byte[], int, int)
*/
public static int readFully(InputStream in, byte[] b)
- throws IOException
- {
+ throws IOException {
return readFully(in, b, 0, b.length);
}
/**
* Same as the normal <tt>in.read(b, off, len)</tt>, but tries to ensure that
* the entire len number of bytes is read.
- * <p>
+ * <p/>
+ *
* @returns the number of bytes read, or -1 if the end of file is
- * reached before any bytes are read
+ * reached before any bytes are read
*/
public static int readFully(InputStream in, byte[] b, int off, int len)
- throws IOException
- {
+ throws IOException {
int total = 0;
- for (;;) {
+ for (; ;) {
int got = in.read(b, off + total, len - total);
if (got < 0) {
return (total == 0) ? -1 : total;
Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/XMLUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/XMLUtils.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/XMLUtils.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/util/XMLUtils.java Mon Jul 11 08:49:30 2005
@@ -26,10 +26,9 @@
/**
* Some XML utility functions
- *
*/
public class XMLUtils {
-
+
/**
* Get an empty new Document
*
@@ -37,16 +36,16 @@
* @throws ParserConfigurationException if construction problems occur
*/
public static Document newDocument()
- throws ParserConfigurationException {
- DocumentBuilder db = null;
-
+ throws ParserConfigurationException {
+ DocumentBuilder db = null;
+
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
return doc;
}
-
+
/**
* Method newDocument
*