Author: veithen
Date: Tue Mar 3 23:22:06 2009
New Revision: 749837
URL: http://svn.apache.org/viewvc?rev=749837&view=rev
Log:
- Changed StAXSOAPModelBuilder so that an OMMetaFactory can be specified.
Rationale: StAXSOAPModelBuilder is able to detect the SOAP version
automatically. It then needs to get the right SOAPFactory instance for that
SOAP version. Until now it used OMAbstractFactory#getSOAP(11|12)Factory for
this, i.e. it always used the default Axiom implementation and there was no way
to specify another Axiom implementation (e.g. DOOM instead of LLOM).
- Using this new feature, fixed the SOAP unit tests for DOOM. They actually (at
least in part) didn't test DOOM, but LLOM...
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java?rev=749837&r1=749836&r2=749837&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
Tue Mar 3 23:22:06 2009
@@ -24,6 +24,7 @@
import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.impl.OMContainerEx;
@@ -57,6 +58,11 @@
private OMNamespace envelopeNamespace;
private String namespaceURI;
+ /**
+ * The meta factory used to get the SOAPFactory implementation when SOAP
version detection
+ * is enabled. This is only used if <code>soapFactory</code> is
<code>null</code>.
+ */
+ private OMMetaFactory metaFactory;
private SOAPFactory soapFactory;
@@ -93,11 +99,17 @@
* @param soapVersion parameter is to give the soap version for the
transport.
*/
public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {
- super(parser);
+ this(OMAbstractFactory.getMetaFactory(), parser, soapVersion);
+ }
+
+ public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader
parser,
+ String soapVersion) {
+ super(metaFactory.getOMFactory(), parser);
+ this.metaFactory = metaFactory;
parserVersion = parser.getVersion();
identifySOAPVersion(soapVersion);
}
-
+
/**
* Constructor StAXSOAPModelBuilder Users of this constructor needs to
externally take care
* validating the transport level soap version with the Envelope version.
@@ -105,7 +117,12 @@
* @param parser
*/
public StAXSOAPModelBuilder(XMLStreamReader parser) {
- super(parser);
+ this(OMAbstractFactory.getMetaFactory(), parser);
+ }
+
+ public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader
parser) {
+ super(metaFactory.getOMFactory(), parser);
+ this.metaFactory = metaFactory;
parserVersion = parser.getVersion();
SOAPEnvelope soapEnvelope = getSOAPEnvelope();
envelopeNamespace = soapEnvelope.getNamespace();
@@ -273,12 +290,12 @@
if (soapFactory == null) {
namespaceURI = this.parser.getNamespaceURI();
if
(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) {
- soapFactory = OMAbstractFactory.getSOAP12Factory();
+ soapFactory = metaFactory.getSOAP12Factory();
if (isDebugEnabled) {
log.debug("Starting to process SOAP 1.2 message");
}
} else if
(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) {
- soapFactory = OMAbstractFactory.getSOAP11Factory();
+ soapFactory = metaFactory.getSOAP11Factory();
if (isDebugEnabled) {
log.debug("Starting to process SOAP 1.1 message");
}
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java?rev=749837&r1=749836&r2=749837&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java
Tue Mar 3 23:22:06 2009
@@ -28,6 +28,7 @@
import javax.xml.stream.XMLStreamReader;
public abstract class SOAPTestCase extends AbstractTestCase {
+ protected OMMetaFactory omMetaFactory;
protected SOAPFactory soap11Factory;
protected SOAPFactory soap12Factory;
protected OMFactory omFactory;
@@ -42,6 +43,7 @@
protected static final String SOAP12_FILE_NAME = "soap/soap12message.xml";
public SOAPTestCase(OMMetaFactory omMetaFactory) {
+ this.omMetaFactory = omMetaFactory;
soap11Factory = omMetaFactory.getSOAP11Factory();
soap12Factory = omMetaFactory.getSOAP12Factory();
omFactory = omMetaFactory.getOMFactory();
@@ -64,7 +66,7 @@
protected StAXSOAPModelBuilder getSOAPBuilder(String fileName) throws
Exception {
XMLStreamReader parser =
XMLInputFactory.newInstance().createXMLStreamReader(
getTestResource(fileName));
- return new StAXSOAPModelBuilder(parser, null);
+ return new StAXSOAPModelBuilder(omMetaFactory, parser, null);
}
}