You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2016/02/08 00:54:56 UTC
svn commit: r1729054 - in /axis/axis2/java/core/trunk/modules/jaxws:
src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java
test/org/apache/axis2/datasource/jaxb/JAXBCustomBuilderDisableStreamingTests.java
Author: veithen
Date: Sun Feb 7 23:54:56 2016
New Revision: 1729054
URL: http://svn.apache.org/viewvc?rev=1729054&view=rev
Log:
Adapt to changes in Axiom's CustomBuilder API.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/datasource/jaxb/JAXBCustomBuilderDisableStreamingTests.java
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java?rev=1729054&r1=1729053&r2=1729054&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java Sun Feb 7 23:54:56 2016
@@ -19,16 +19,9 @@
package org.apache.axis2.datasource.jaxb;
-import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.impl.builder.CustomBuilder;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.jaxws.Constants;
import org.apache.axis2.jaxws.handler.HandlerUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -58,11 +51,12 @@ public class JAXBCustomBuilder implement
}
- public OMElement create(String namespace,
- String localPart,
- OMContainer parent,
- XMLStreamReader reader,
- OMFactory factory) throws OMException {
+ public OMDataSource create(XMLStreamReader reader) throws OMException {
+ String namespace = reader.getNamespaceURI();
+ if (namespace == null) {
+ namespace = "";
+ }
+ String localPart = reader.getLocalName();
if (log.isDebugEnabled()) {
log.debug("create namespace = " + namespace);
@@ -79,10 +73,6 @@ public class JAXBCustomBuilder implement
try {
// Create an OMSourcedElement backed by an unmarshalled JAXB object
- // Currently we cannot control how the unmarshaller will emit the prefix
- // So if the value of the prefix is needed, full expansion is necessary.
- OMNamespace ns = factory.createOMNamespace(namespace, null);
-
Object jaxb = jdsContext.unmarshal(reader);
if (log.isDebugEnabled()) {
log.debug("Successfully unmarshalled jaxb object " + jaxb);
@@ -92,11 +82,8 @@ public class JAXBCustomBuilder implement
if (log.isDebugEnabled()) {
log.debug("The JAXBDataSource is " + ds);
}
- OMSourcedElement omse = factory.createOMElement(ds, localPart, ns);
-
- parent.addChild(omse);
JAXBCustomBuilderMonitor.updateTotalCreates();
- return omse;
+ return ds;
} catch (JAXBException e) {
JAXBCustomBuilderMonitor.updateTotalFailedCreates();
throw new OMException(e);
Modified: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/datasource/jaxb/JAXBCustomBuilderDisableStreamingTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/datasource/jaxb/JAXBCustomBuilderDisableStreamingTests.java?rev=1729054&r1=1729053&r2=1729054&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/datasource/jaxb/JAXBCustomBuilderDisableStreamingTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/datasource/jaxb/JAXBCustomBuilderDisableStreamingTests.java Sun Feb 7 23:54:56 2016
@@ -43,7 +43,7 @@ public class JAXBCustomBuilderDisableStr
msgCtx.setProperty(Constants.JAXWS_ENABLE_JAXB_PAYLOAD_STREAMING, new Boolean(false));
jaxbDSC.setMessageContext(msgCtx);
try {
- assertNull(jaxbCB.create("ns", "lp", null, new MockXMLStreamReader(), null));
+ assertNull(jaxbCB.create(new MockXMLStreamReader("ns", "lp")));
} catch (Exception e) {
// Since we didn't set up the JAXBDSContext fully, if the disabling of it didn't
// work, then we'll get some sort of exception.
@@ -60,7 +60,7 @@ public class JAXBCustomBuilderDisableStr
msgCtx.setProperty(Constants.JAXWS_PAYLOAD_HIGH_FIDELITY, new Boolean(true));
jaxbDSC.setMessageContext(msgCtx);
try {
- assertNull(jaxbCB.create("ns", "lp", null, new MockXMLStreamReader(), null));
+ assertNull(jaxbCB.create(new MockXMLStreamReader("ns", "lp")));
} catch (Exception e) {
// Since we didn't set up the JAXBDSContext fully, if the disabling of it didn't
// work, then we'll get some sort of exception.
@@ -79,7 +79,7 @@ public class JAXBCustomBuilderDisableStr
jaxbDSC.setMessageContext(msgCtx);
try {
- assertNull(jaxbCB.create("ns", "lp", null, new MockXMLStreamReader(), null));
+ assertNull(jaxbCB.create(new MockXMLStreamReader("ns", "lp")));
} catch (Exception e) {
// Since we didn't set up the JAXBDSContext fully, if the disabling of it didn't
// work, then we'll get some sort of exception.
@@ -96,7 +96,7 @@ public class JAXBCustomBuilderDisableStr
// msgCtx.setProperty(Constants.JAXWS_ENABLE_JAXB_PAYLOAD_STREAMING, new Boolean(false));
jaxbDSC.setMessageContext(msgCtx);
try {
- jaxbCB.create("ns", "lp", null, new MockXMLStreamReader(), null);
+ jaxbCB.create(new MockXMLStreamReader("ns", "lp"));
fail("JAXB Payload streaming default was not enabled");
} catch (Exception e) {
// Expected code path
@@ -107,6 +107,13 @@ public class JAXBCustomBuilderDisableStr
class MockXMLStreamReader implements javax.xml.stream.XMLStreamReader {
+ private final String namespaceURI;
+ private final String localName;
+
+ MockXMLStreamReader(String namespaceURI, String localName) {
+ this.namespaceURI = namespaceURI;
+ this.localName = localName;
+ }
public void close() throws XMLStreamException {
}
@@ -160,7 +167,7 @@ public class JAXBCustomBuilderDisableStr
}
public String getLocalName() {
- return null;
+ return localName;
}
public Location getLocation() {
@@ -184,7 +191,7 @@ public class JAXBCustomBuilderDisableStr
}
public String getNamespaceURI() {
- return null;
+ return namespaceURI;
}
public String getNamespaceURI(int i) {