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 2011/10/16 14:25:03 UTC
svn commit: r1184810 - in
/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json:
AbstractJSONDataSource.java AbstractJSONMessageFormatter.java
AbstractJSONOMBuilder.java JSONOMBuilder.java
Author: veithen
Date: Sun Oct 16 12:25:02 2011
New Revision: 1184810
URL: http://svn.apache.org/viewvc?rev=1184810&view=rev
Log:
AXIS2-4902: Removed illegal references to Axiom implementation classes.
Modified:
axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java
axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java
axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java
Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java?rev=1184810&r1=1184809&r2=1184810&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java (original)
+++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java Sun Oct 16 12:25:02 2011
@@ -35,7 +35,7 @@ import java.io.BufferedReader;
/**
* JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in
- * the OMSourcedElementImpl and can be used either to expand the tree or get the JSON String
+ * the OMSourcedElement and can be used either to expand the tree or get the JSON String
* directly without expanding. This uses the "Mapped" JSON convention.
*/
Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java?rev=1184810&r1=1184809&r2=1184810&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java (original)
+++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java Sun Oct 16 12:25:02 2011
@@ -22,8 +22,7 @@ package org.apache.axis2.json;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.llom.OMElementImpl;
-import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
+import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.soap.SOAPFault;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
@@ -66,7 +65,7 @@ public abstract class AbstractJSONMessag
}
/**
- * Gives the JSON message as an array of bytes. If the payload is an OMSourcedElementImpl and
+ * Gives the JSON message as an array of bytes. If the payload is an OMSourcedElement and
* it contains a JSONDataSource with a correctly formatted JSON String, gets it directly from
* the DataSource and returns as a byte array. If not, the OM tree is expanded and it is
* serialized into the output stream and byte array is returned.
@@ -81,12 +80,12 @@ public abstract class AbstractJSONMessag
public byte[] getBytes(MessageContext msgCtxt, OMOutputFormat format) throws AxisFault {
OMElement element = msgCtxt.getEnvelope().getBody().getFirstElement();
- //if the element is an OMSourcedElementImpl and it contains a JSONDataSource with
+ //if the element is an OMSourcedElement and it contains a JSONDataSource with
//correct convention, directly get the JSON string.
- if (element instanceof OMSourcedElementImpl &&
- getStringToWrite(((OMSourcedElementImpl)element).getDataSource()) != null) {
- String jsonToWrite = getStringToWrite(((OMSourcedElementImpl)element).getDataSource());
+ if (element instanceof OMSourcedElement &&
+ getStringToWrite(((OMSourcedElement)element).getDataSource()) != null) {
+ String jsonToWrite = getStringToWrite(((OMSourcedElement)element).getDataSource());
return jsonToWrite.getBytes();
//otherwise serialize the OM by expanding the tree
} else {
@@ -139,7 +138,7 @@ public abstract class AbstractJSONMessag
/**
* Writes the JSON message to the output stream with the correct convention. If the payload is
- * an OMSourcedElementImpl and it contains a JSONDataSource with a correctly formatted JSON
+ * an OMSourcedElement and it contains a JSONDataSource with a correctly formatted JSON
* String, gets it directly from the DataSource and writes to the output stream. If not, the OM
* tree is expanded and it is serialized into the output stream. *
*
@@ -159,14 +158,14 @@ public abstract class AbstractJSONMessag
//Mapped format cannot handle element with namespaces.. So cannot handle Faults
if (element instanceof SOAPFault) {
SOAPFault fault = (SOAPFault)element;
- OMElement element2 = new OMElementImpl("Fault", null, element.getOMFactory());
+ OMElement element2 = element.getOMFactory().createOMElement("Fault", null);
element2.setText(fault.toString());
element = element2;
}
- if (element instanceof OMSourcedElementImpl &&
- getStringToWrite(((OMSourcedElementImpl)element).getDataSource()) != null) {
+ if (element instanceof OMSourcedElement &&
+ getStringToWrite(((OMSourcedElement)element).getDataSource()) != null) {
String jsonToWrite =
- getStringToWrite(((OMSourcedElementImpl)element).getDataSource());
+ getStringToWrite(((OMSourcedElement)element).getDataSource());
out.write(jsonToWrite.getBytes());
} else {
@@ -200,9 +199,9 @@ public abstract class AbstractJSONMessag
&& Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
try {
String jsonString;
- if (dataOut instanceof OMSourcedElementImpl && getStringToWrite(
- ((OMSourcedElementImpl) dataOut).getDataSource()) != null) {
- jsonString = getStringToWrite(((OMSourcedElementImpl)
+ if (dataOut instanceof OMSourcedElement && getStringToWrite(
+ ((OMSourcedElement) dataOut).getDataSource()) != null) {
+ jsonString = getStringToWrite(((OMSourcedElement)
dataOut).getDataSource());
} else {
StringWriter out = new StringWriter();
Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java?rev=1184810&r1=1184809&r2=1184810&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java (original)
+++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONOMBuilder.java Sun Oct 16 12:25:02 2011
@@ -23,7 +23,6 @@ import org.apache.axiom.om.OMAbstractFac
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
@@ -38,7 +37,7 @@ import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
-/** Makes the OMSourcedElementImpl object with the JSONDataSource inside. */
+/** Makes the OMSourcedElement object with the JSONDataSource inside. */
public abstract class AbstractJSONOMBuilder implements Builder {
@@ -47,12 +46,12 @@ public abstract class AbstractJSONOMBuil
}
/**
- * gives the OMSourcedElementImpl using the incoming JSON stream
+ * gives the OMSourcedElement using the incoming JSON stream
*
* @param inputStream - incoming message as an input stream
* @param contentType - content type of the message (eg: application/json)
* @param messageContext - inflow message context
- * @return OMSourcedElementImpl with JSONDataSource inside
+ * @return OMSourcedElement with JSONDataSource inside
* @throws AxisFault
*/
@@ -146,7 +145,7 @@ public abstract class AbstractJSONOMBuil
throw AxisFault.makeFault(e);
}
AbstractJSONDataSource jsonDataSource = getDataSource(reader, prefix, localName);
- return new OMSourcedElementImpl(localName, ns, factory, jsonDataSource);
+ return factory.createOMElement(jsonDataSource, localName, ns);
}
protected abstract AbstractJSONDataSource getDataSource(Reader
Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java?rev=1184810&r1=1184809&r2=1184810&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java (original)
+++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONOMBuilder.java Sun Oct 16 12:25:02 2011
@@ -21,7 +21,7 @@ package org.apache.axis2.json;
import java.io.Reader;
-/** Makes the OMSourcedElementImpl object with the JSONDataSource inside. */
+/** Makes the OMSourcedElement object with the JSONDataSource inside. */
public class JSONOMBuilder extends AbstractJSONOMBuilder {
@Override