Let the ADB data sources implement QNameAwareOMDataSource so that one can use the OMFactory#createOMElement(OMDataSource) API.
diff --git a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
index b298692..9f9d564 100644
--- a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
+++ b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-bean.xsl
@@ -642,14 +642,10 @@
<xsl:choose>
<xsl:when test="@type">
- org.apache.axiom.om.OMDataSource dataSource =
- new org.apache.axis2.databinding.ADBDataSource(this,parentQName);
- return factory.createOMElement(dataSource,parentQName);
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(this,parentQName));
</xsl:when>
<xsl:otherwise>
- org.apache.axiom.om.OMDataSource dataSource =
- new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
- return factory.createOMElement(dataSource,MY_QNAME);
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME));
</xsl:otherwise>
</xsl:choose>
}
diff --git a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
index 1977552..22961a1 100644
--- a/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
+++ b/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate-helpermode.xsl
@@ -546,14 +546,10 @@
<xsl:choose>
<xsl:when test="@type">
- org.apache.axiom.om.OMDataSource dataSource =
- new org.apache.axis2.databinding.ADBHelperDataSource(bean,parentQName,this);
- return factory.createOMElement(dataSource,parentQName);
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBHelperDataSource(bean,parentQName,this));
</xsl:when>
<xsl:otherwise>
- org.apache.axiom.om.OMDataSource dataSource =
- new org.apache.axis2.databinding.ADBHelperDataSource(bean,<xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME,this);
- return factory.createOMElement(dataSource,<xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME);
+ return factory.createOMElement(new org.apache.axis2.databinding.ADBHelperDataSource(bean,<xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME,this));
</xsl:otherwise>
</xsl:choose>
}
diff --git a/modules/adb/src/org/apache/axis2/databinding/AbstractADBDataSource.java b/modules/adb/src/org/apache/axis2/databinding/AbstractADBDataSource.java
index 57366d1..c83767d 100644
--- a/modules/adb/src/org/apache/axis2/databinding/AbstractADBDataSource.java
+++ b/modules/adb/src/org/apache/axis2/databinding/AbstractADBDataSource.java
@@ -35,10 +35,11 @@
import org.apache.axiom.om.OMDataSourceExt;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.QNameAwareOMDataSource;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axis2.databinding.utils.writer.MTOMAwareOMBuilder;
-public abstract class AbstractADBDataSource implements OMDataSourceExt {
+public abstract class AbstractADBDataSource implements OMDataSourceExt, QNameAwareOMDataSource {
protected QName parentQName;
HashMap map = null; // Map of properties
@@ -47,6 +48,18 @@
this.parentQName = parentQName;
}
+ public final String getLocalName() {
+ return parentQName.getLocalPart();
+ }
+
+ public final String getNamespaceURI() {
+ return parentQName.getNamespaceURI();
+ }
+
+ public final String getPrefix() {
+ return parentQName.getPrefix();
+ }
+
/**
* @param output
* @param format