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 pr...@apache.org on 2007/06/17 14:11:57 UTC
svn commit: r548033 [2/11] - in /webservices/axis2/branches/java/jaxws21: ./
etc/ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/s...
Modified: webservices/axis2/branches/java/jaxws21/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/etc/project.properties?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/etc/project.properties (original)
+++ webservices/axis2/branches/java/jaxws21/etc/project.properties Sun Jun 17 05:11:16 2007
@@ -71,12 +71,13 @@
maven.multiproject.includes.requiresJDK15=\
modules/metadata/project.xml,\
modules/jaxbri/project.xml,\
+modules/jws-api/project.xml,\
modules/jaxws/project.xml,\
modules/jaxws-api/project.xml,\
modules/saaj-api/project.xml,\
modules/saaj/project.xml, \
modules/clustering/project.xml
-#modules/scripting/project.xml
+modules/scripting/project.xml
# -------------------------------------------------------------------
Modified: webservices/axis2/branches/java/jaxws21/etc/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/etc/project.xml?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/etc/project.xml (original)
+++ webservices/axis2/branches/java/jaxws21/etc/project.xml Sun Jun 17 05:11:16 2007
@@ -19,7 +19,6 @@
-->
<project>
- <name>Axis2</name>
<pomVersion>3</pomVersion>
<!-- a unique name for this project -->
<name>Apache Axis2</name>
@@ -34,7 +33,6 @@
<logo>http://www.apache.org/images/asf-logo.gif</logo>
</organization>
<inceptionYear>2004</inceptionYear>
- <package>org.apache.axis2</package>
<logo>http://ws.apache.org/axis2/images/axis.jpg</logo>
<description>Axis2 is an effort to re-design and totally re-implement both Axis/Java and
(eventually) Axis/C++ on a new architecture. Evolving from the now standard "handler chain"
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Sun Jun 17 05:11:16 2007
@@ -11,13 +11,7 @@
import org.apache.ws.commons.schema.*;
import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -56,6 +50,10 @@
private HashMap simpleTypesMap;
private HashMap changedTypeMap;
+ private HashSet changedSimpleTypeSet;
+ private HashSet changedComplexTypeSet;
+ private HashSet changedElementSet;
+
// this map is necessary to retain the metainformation of types. The reason why these
// meta info 'bags' would be useful later is to cater for the extensions and restrictions
// of types
@@ -139,6 +137,10 @@
processedElementRefMap = new HashMap();
nillableElementList = new ArrayList();
+ changedComplexTypeSet = new HashSet();
+ changedSimpleTypeSet = new HashSet();
+ changedElementSet = new HashSet();
+
//load the writer and initiliaze the base types
writer = SchemaPropertyLoader.getBeanWriterInstance();
writer.init(this.options);
@@ -356,6 +358,26 @@
if (options.isWrapClasses()) {
writer.writeBatch();
}
+
+ // resets the changed types
+ XmlSchemaComplexType xmlSchemaComplexType = null;
+ for (Iterator iter = changedComplexTypeSet.iterator();iter.hasNext();){
+ xmlSchemaComplexType = (XmlSchemaComplexType) iter.next();
+ xmlSchemaComplexType.setName(null);
+ }
+
+ XmlSchemaSimpleType xmlSchemaSimpleType = null;
+ for (Iterator iter = changedSimpleTypeSet.iterator();iter.hasNext();){
+ xmlSchemaSimpleType = (XmlSchemaSimpleType) iter.next();
+ xmlSchemaSimpleType.setName(null);
+ }
+
+ XmlSchemaElement xmlSchemaElement = null;
+ for (Iterator iter = changedElementSet.iterator();iter.hasNext();){
+ xmlSchemaElement = (XmlSchemaElement) iter.next();
+ xmlSchemaElement.setSchemaTypeName(null);
+ }
+
}
/**
@@ -527,6 +549,7 @@
if (schemaType instanceof XmlSchemaComplexType) {
//set a name
schemaType.setName(generatedTypeName.getLocalPart());
+ changedComplexTypeSet.add(schemaType);
// Must do this up front to support recursive types
String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(schemaType.getQName());
processedTypemap.put(schemaType.getQName(), fullyQualifiedClassName);
@@ -551,6 +574,7 @@
} else if (schemaType instanceof XmlSchemaSimpleType) {
//set a name
schemaType.setName(generatedTypeName.getLocalPart());
+ changedSimpleTypeSet.add(schemaType);
// Must do this up front to support recursive types
String fullyQualifiedClassName = writer.makeFullyQualifiedClassName(schemaType.getQName());
processedTypemap.put(schemaType.getQName(), fullyQualifiedClassName);
@@ -572,7 +596,6 @@
xsElt.addMetaInfo(
SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
className);
-
}
}
} else {
@@ -921,7 +944,7 @@
*/
private String writeComplexType(XmlSchemaComplexType complexType, BeanWriterMetaInfoHolder metaInfHolder)
throws SchemaCompilationException {
- String javaClassName = writer.write(complexType.getQName(), processedTypemap, metaInfHolder);
+ String javaClassName = writer.write(complexType.getQName(), processedTypemap, metaInfHolder, complexType.isAbstract());
processedTypeMetaInfoMap.put(complexType.getQName(), metaInfHolder);
return javaClassName;
}
@@ -938,7 +961,7 @@
private String writeComplexParticle(QName qname,BeanWriterMetaInfoHolder metaInfHolder)
throws SchemaCompilationException {
- String javaClassName = writer.write(qname, processedTypemap, metaInfHolder);
+ String javaClassName = writer.write(qname, processedTypemap, metaInfHolder,false);
processedTypeMetaInfoMap.put(qname, metaInfHolder);
return javaClassName;
}
@@ -2403,6 +2426,8 @@
// we have to set this otherwise the ours attribute would not set properly if refered to this simple
// type from any other element
xsElt.setSchemaTypeName(fakeQname);
+ changedElementSet.add(xsElt);
+
} else {
fakeQname = qname;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Sun Jun 17 05:11:16 2007
@@ -68,7 +68,7 @@
*/
</xsl:if>
- public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> class <xsl:value-of select="$name"/> <xsl:if test="$extension"> extends <xsl:value-of select="$extension"/></xsl:if> <xsl:if test="$restriction"> extends <xsl:value-of select="$restriction"/></xsl:if>
+ public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> <xsl:if test="@isAbstract">abstract</xsl:if> class <xsl:value-of select="$name"/> <xsl:if test="$extension"> extends <xsl:value-of select="$extension"/></xsl:if> <xsl:if test="$restriction"> extends <xsl:value-of select="$restriction"/></xsl:if>
<xsl:if test="$union and not($restriction) and not($extension)"> extends org.apache.axis2.databinding.types.Union </xsl:if>
implements org.apache.axis2.databinding.ADBBean{
<xsl:choose>
@@ -675,9 +675,9 @@
* @param factory
* @return org.apache.axiom.om.OMElement
*/
- public org.apache.axiom.om.OMElement getOMElement(
+ public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
- final org.apache.axiom.om.OMFactory factory){
+ final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{
<xsl:choose>
@@ -710,7 +710,8 @@
public void serialize(final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory,
- javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
<xsl:choose>
<xsl:when test="$simple and $union">
@@ -760,7 +761,7 @@
</xsl:choose>
</xsl:for-each>
} else {
- throw new RuntimeException("Invalid object type");
+ throw new org.apache.axis2.databinding.ADBException("Invalid object type");
}
xmlWriter.writeEndElement();
</xsl:when>
@@ -884,7 +885,7 @@
}
<xsl:if test="not(@optional)">
else {
- throw new RuntimeException("required attribute <xsl:value-of select="$varName"/> is null");
+ throw new org.apache.axis2.databinding.ADBException("required attribute <xsl:value-of select="$varName"/> is null");
}
</xsl:if>
</xsl:when>
@@ -936,7 +937,7 @@
}
<xsl:if test="not(@optional)">
else {
- throw new RuntimeException("required attribute <xsl:value-of select="$varName"/> is null");
+ throw new org.apache.axis2.databinding.ADBException("required attribute <xsl:value-of select="$varName"/> is null");
}
</xsl:if>
</xsl:otherwise>
@@ -997,13 +998,13 @@
<xsl:choose>
<xsl:when test="$particleClassType">
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
<xsl:value-of select="$varName"/>.serialize(null,factory,xmlWriter);
</xsl:when>
<xsl:otherwise>
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
<xsl:value-of select="$varName"/>.serialize(new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
factory,xmlWriter);
@@ -1026,14 +1027,14 @@
// we don't have to do any thing since minOccures is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
}
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<xsl:otherwise>
@@ -1073,7 +1074,7 @@
// we don't have to do any thing since minOccures is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1107,7 +1108,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1173,7 +1174,7 @@
// we have to do nothing since minOccurs is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1206,7 +1207,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1265,7 +1266,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1368,7 +1369,7 @@
// we have to do nothing since minOccurs is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
@@ -1404,7 +1405,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1425,13 +1426,13 @@
// we have to do nothing since minOccures zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
}
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle any - non array case-->
@@ -1440,7 +1441,7 @@
if (<xsl:value-of select="$varName"/> != null) {
<xsl:value-of select="$varName"/>.serialize(xmlWriter);
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle all other cases -->
@@ -1487,7 +1488,7 @@
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}else{
@@ -1538,7 +1539,7 @@
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
} else {
@@ -1606,7 +1607,7 @@
</xsl:when>
<xsl:otherwise>
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("Property cannot be null!");
+ throw new org.apache.axis2.databinding.ADBException("Property cannot be null!");
}
<xsl:value-of select="$varName"/>.serialize(MY_QNAME,factory,xmlWriter);
</xsl:otherwise>
@@ -1647,7 +1648,7 @@
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("Value cannot be null !!");
+ throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!");
</xsl:otherwise>
</xsl:choose>
}else{
@@ -1698,7 +1699,7 @@
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("property value cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("property value cannot be null!!");
</xsl:otherwise>
</xsl:choose>
} else {
@@ -1862,7 +1863,8 @@
* databinding method to get an XML representation of this object
*
*/
- public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName){
+ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
+ throws org.apache.axis2.databinding.ADBException{
<xsl:choose>
@@ -1891,7 +1893,7 @@
</xsl:when>
<xsl:otherwise>
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
elementList.add(<xsl:value-of select="$varName"/>);
</xsl:otherwise>
@@ -1916,7 +1918,7 @@
// nothing to do
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null !!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null !!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1930,7 +1932,7 @@
elementList.add(<xsl:value-of select="$varName"/>);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1957,7 +1959,7 @@
// have to do nothing
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -1979,7 +1981,7 @@
elementList.add(null);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -2002,14 +2004,14 @@
// have to do nothing
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
}
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle any - non array case-->
@@ -2018,7 +2020,7 @@
elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY);
elementList.add(<xsl:value-of select="$varName"/>);
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle binary - Since it is a Datahandler, we can just add it to the list
@@ -2046,7 +2048,7 @@
if (<xsl:value-of select="$varName"/> != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:otherwise>
</xsl:choose>
@@ -2172,7 +2174,7 @@
<!-- generate methods for a union type -->
public static <xsl:value-of select="$name"/> fromString(javax.xml.stream.XMLStreamReader xmlStreamReader,
java.lang.String namespaceURI,
- java.lang.String type) {
+ java.lang.String type) throws org.apache.axis2.databinding.ADBException {
<xsl:value-of select="$name"/> object = null;
try {
@@ -2185,7 +2187,7 @@
}
return object;
} catch (java.lang.Exception e) {
- throw new RuntimeException("Error in parsing value");
+ throw new org.apache.axis2.databinding.ADBException("Error in parsing value");
}
}
</xsl:if>
@@ -2200,7 +2202,9 @@
select="concat(translate( substring($shortTypeNameUncapped, 1, 1 ),'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ), substring($shortTypeNameUncapped, 2, string-length($shortTypeNameUncapped)))" />
- public static <xsl:value-of select="$name"/> fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) {
+ public static <xsl:value-of select="$name"/> fromString(javax.xml.stream.XMLStreamReader xmlStreamReader,
+ java.lang.String content)
+ throws org.apache.axis2.databinding.ADBException {
<xsl:value-of select="$name"/> object = new <xsl:value-of select="$name"/>();
java.lang.String[] values = content.split(" +");
@@ -2250,7 +2254,7 @@
object.set<xsl:value-of select="$javaName"/>(objectValues);
return object;
} catch (java.lang.Exception e) {
- throw new RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
}
@@ -2334,7 +2338,9 @@
*/
public static <xsl:value-of select="$name"/> parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
<xsl:variable name="isEnumFacet" select="property/enumFacet"/>
- <xsl:if test="not($isEnumFacet)"><xsl:value-of select="$name"/> object = new <xsl:value-of select="$name"/>();</xsl:if>
+ <xsl:if test="not($isEnumFacet)"><xsl:value-of select="$name"/> object =
+ <xsl:choose><xsl:when test="@isAbstract">null;</xsl:when><xsl:otherwise>new <xsl:value-of select="$name"/>();</xsl:otherwise></xsl:choose>
+ </xsl:if>
<xsl:if test="$isEnumFacet">
<xsl:value-of select="$name"/> object = null;
// initialize a hash map to keep values
@@ -2417,6 +2423,9 @@
}
</xsl:otherwise>
</xsl:choose>
+ <xsl:if test="@isAbstract">
+ throw new org.apache.axis2.databinding.ADBException("The an abstract class can not be instantiated !!!");
+ </xsl:if>
}
@@ -2442,7 +2451,7 @@
select="concat(translate(substring($shortTypeNameUncapped, 1, 1 ),'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ), substring($shortTypeNameUncapped, 2, string-length($shortTypeNameUncapped)))" />
<xsl:variable name="javaName" select="@javaname"/>
<xsl:variable name="namespace" select="@nsuri"/>
- <xsl:variable name="attribName">tempAttrib<xsl:value-of select="$propertyName"/></xsl:variable>
+ <xsl:variable name="attribName">tempAttrib<xsl:value-of select="$javaName"/></xsl:variable>
<xsl:if test="$propertyName != 'extraAttributes'">
// handle attribute "<xsl:value-of select="$propertyName"/>"
@@ -2530,7 +2539,7 @@
</xsl:if>
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("Required attribute <xsl:value-of select="$propertyName"/> is missing");
+ throw new org.apache.axis2.databinding.ADBException("Required attribute <xsl:value-of select="$propertyName"/> is missing");
</xsl:otherwise>
</xsl:choose>
}
@@ -3331,7 +3340,7 @@
<xsl:if test="$ordered and $min!=0 and not(@innerchoice='yes')">
else{
// A start element we are not expecting indicates an invalid parameter was passed
- throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
</xsl:if>
<xsl:if test="$particleClassType and ($choice or ($min=0))">
@@ -3347,7 +3356,7 @@
<xsl:if test="not($particleClass)">
if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
- throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
</xsl:if>
</xsl:if>
@@ -3356,7 +3365,7 @@
<xsl:if test="not(property/enumFacet) and not($choice and $hasParticleType)">
else{
// A start element we are not expecting indicates an invalid parameter was passed
- throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
</xsl:if>
} else {
@@ -3494,10 +3503,10 @@
* Auto generated getter method
* Overridden from <xsl:value-of select="$restriction"/>
*
- * @throws RuntimeException
+ * @throws org.apache.axis2.databinding.ADBException
*/
public <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text>get<xsl:value-of select="$javaName"/>(){
- throw new java.lang.RuntimeException();
+ throw new java.lang.org.apache.axis2.databinding.ADBException("property has removed");
}
/**
@@ -3505,10 +3514,10 @@
* Overridden from <xsl:value-of select="$restriction"/>
*
* @param param <xsl:value-of select="$javaName"/>
- * @throws RuntimeException
+ * @throws org.apache.axis2.databinding.ADBException
*/
public void set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/> param){
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:when>
@@ -3526,12 +3535,12 @@
protected void validate<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/> param){
<xsl:if test="not(@unbound) and @array">
if ((param != null) && (param.length > <xsl:value-of select="@maxOccurs"/>)){
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:if>
<xsl:if test="$min!=0 and @array">
if ((param != null) && (param.length < <xsl:value-of select="$min"/>)){
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:if>
}
@@ -3701,12 +3710,12 @@
protected void validate<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/> param){
<xsl:if test="not(@unbound)">
if ((param != null) && (param.length > <xsl:value-of select="@maxOccurs"/>)){
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:if>
<xsl:if test="$min!=0">
if ((param != null) && (param.length < <xsl:value-of select="$min"/>)){
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:if>
}
@@ -3836,7 +3845,7 @@
this.<xsl:value-of select="$varName"/>=param;
}
else {
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:when>
<xsl:when test="(@lenFacet)">
@@ -3844,7 +3853,7 @@
this.<xsl:value-of select="$varName"/>=param;
}
else {
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:when>
<xsl:when test="(@maxLenFacet) or (@minLenFacet)">
@@ -3854,7 +3863,7 @@
this.<xsl:value-of select="$varName"/>=param;
}
else {
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:when>
<xsl:when test="(@maxExFacet) or (@minExFacet) or (@maxInFacet) or (@minInFacet)">
@@ -3863,7 +3872,7 @@
this.<xsl:value-of select="$varName"/>=param;
}
else {
- throw new java.lang.RuntimeException();
+ throw new org.apache.axis2.databinding.ADBException();
}
</xsl:when>
<xsl:otherwise>
@@ -3928,7 +3937,7 @@
public static org.apache.axiom.om.OMElement getOMElement(
final <xsl:value-of select="$fullyQualifiedName"/> bean,
final javax.xml.namespace.QName parentQName,
- final org.apache.axiom.om.OMFactory factory){
+ final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{
org.apache.axiom.om.OMDataSource dataSource = getOMDataSource(bean,parentQName, factory);
@@ -3953,7 +3962,7 @@
public static org.apache.axiom.om.OMDataSource getOMDataSource(
final <xsl:value-of select="$fullyQualifiedName"/> bean,
final javax.xml.namespace.QName parentQName,
- final org.apache.axiom.om.OMFactory factory){
+ final org.apache.axiom.om.OMFactory factory)throws org.apache.axis2.databinding.ADBException{
org.apache.axiom.om.OMDataSource dataSource =
@@ -4088,7 +4097,7 @@
</xsl:when>
<xsl:otherwise>
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
<xsl:value-of select="@type"/>Helper.getOMDataSource(<xsl:value-of select="$varName"/>,
new javax.xml.namespace.QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="$propertyName"/>"),
@@ -4134,7 +4143,7 @@
// we don't have to do any thing since minOccures is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -4168,7 +4177,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -4231,7 +4240,7 @@
// we have to do nothing since minOccurs is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -4264,7 +4273,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -4323,7 +4332,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -4413,7 +4422,7 @@
// we have to do nothing since minOccurs is zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
@@ -4449,7 +4458,7 @@
xmlWriter.writeEndElement();
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -4470,13 +4479,13 @@
// we have to do nothing since minOccures zero
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
}
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle any - non array case-->
@@ -4485,7 +4494,7 @@
if (<xsl:value-of select="$varName"/> != null) {
<xsl:value-of select="$varName"/>.serialize(xmlWriter);
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle all other cases -->
@@ -4532,7 +4541,7 @@
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}else{
@@ -4627,7 +4636,7 @@
</xsl:when>
<xsl:otherwise>
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("Property cannot be null!");
+ throw new org.apache.axis2.databinding.ADBException("Property cannot be null!");
}
<xsl:value-of select="property/@type"/>Helper.getOMDataSource(<xsl:value-of select="$varName"/>,
<xsl:value-of select="$fullyQualifiedName"/>.MY_QNAME,
@@ -4670,7 +4679,7 @@
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","nil","1",xmlWriter);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("Value cannot be null !!");
+ throw new org.apache.axis2.databinding.ADBException("Value cannot be null !!");
</xsl:otherwise>
</xsl:choose>
}else{
@@ -5480,7 +5489,7 @@
<xsl:if test="$ordered and $min!=0">
else{
// A start element we are not expecting indicates an invalid parameter was passed
- throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
</xsl:if>
</xsl:for-each>
@@ -5490,7 +5499,7 @@
reader.next();
if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
- throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
</xsl:if>
<xsl:if test="property[not(@attribute)]"> <!-- this if is needed to skip all this when there are no propoerties-->
@@ -5498,7 +5507,7 @@
<xsl:if test="not(property/enumFacet)">
else{
// A start element we are not expecting indicates an invalid parameter was passed
- throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
</xsl:if>
} else reader.next(); <!-- At neither a start nor an end element, skip it -->
@@ -5515,7 +5524,8 @@
}
- public static javax.xml.stream.XMLStreamReader getPullParser(java.lang.Object beanObject, javax.xml.namespace.QName qName){
+ public static javax.xml.stream.XMLStreamReader getPullParser(java.lang.Object beanObject, javax.xml.namespace.QName qName)
+ throws org.apache.axis2.databinding.ADBException{
<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/> bean =
(<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>)beanObject;
@@ -5546,7 +5556,7 @@
</xsl:when>
<xsl:otherwise>
if (<xsl:value-of select="$varName"/>==null){
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
elementList.add(<xsl:value-of select="$varName"/>);
</xsl:otherwise>
@@ -5571,7 +5581,7 @@
// nothing to do
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null !!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null !!");
</xsl:otherwise>
</xsl:choose>
}
@@ -5585,7 +5595,7 @@
elementList.add(<xsl:value-of select="$varName"/>);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -5612,7 +5622,7 @@
// have to do nothing
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -5634,7 +5644,7 @@
elementList.add(null);
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
@@ -5657,14 +5667,14 @@
// have to do nothing
</xsl:when>
<xsl:otherwise>
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
</xsl:otherwise>
</xsl:choose>
}
}
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle any - non array case-->
@@ -5673,7 +5683,7 @@
elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY);
elementList.add(<xsl:value-of select="$varName"/>);
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:when>
<!-- handle binary - Since it is a Datahandler, we can just add it to the list
@@ -5701,7 +5711,7 @@
if (<xsl:value-of select="$varName"/> != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(<xsl:value-of select="$varName"/>));
} else {
- throw new RuntimeException("<xsl:value-of select="$propertyName"/> cannot be null!!");
+ throw new org.apache.axis2.databinding.ADBException("<xsl:value-of select="$propertyName"/> cannot be null!!");
}
</xsl:otherwise>
</xsl:choose>
@@ -5836,7 +5846,7 @@
}
</xsl:for-each>
- throw new java.lang.RuntimeException("Unsupported type " + namespaceURI + " " + typeName);
+ throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl Sun Jun 17 05:11:16 2007
@@ -14,7 +14,9 @@
<!-- generate toOM for only non parts and non primitives!!! -->
<xsl:for-each select="param[not(@type = preceding-sibling::param/@type) and @type!='' and not(@primitive)]">
- private org.apache.axiom.om.OMElement toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent){
+ private org.apache.axiom.om.OMElement toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try{
<xsl:choose>
<xsl:when test="$helpermode">
return <xsl:value-of select="@type"/>Helper.getOMElement(
@@ -30,6 +32,9 @@
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
</xsl:otherwise>
</xsl:choose>
+ } catch(org.apache.axis2.databinding.ADBException e){
+ throw new org.apache.axis2.AxisFault(e.getMessage());
+ }
}
</xsl:for-each>
@@ -59,8 +64,9 @@
<xsl:value-of select="@type"/> param<xsl:value-of select="position()"/>,
</xsl:for-each>
<xsl:value-of select="$inputElementType"/> dummyWrappedType,
- boolean optimizeContent){
+ boolean optimizeContent) throws org.apache.axis2.AxisFault{
+ try{
<xsl:value-of select="$inputElementType"/> wrappedType = new <xsl:value-of select="$inputElementType"/>();
<xsl:choose>
@@ -90,18 +96,21 @@
</xsl:otherwise>
</xsl:choose>
- return emptyEnvelope;
+ return emptyEnvelope;
+ } catch(org.apache.axis2.databinding.ADBException e){
+ throw new org.apache.axis2.AxisFault(e.getMessage());
+ }
}
</xsl:when>
- <xsl:otherwise>
- </xsl:otherwise>
</xsl:choose>
<!-- Assumption - the parameter is always an ADB element-->
- private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="$inputElementType"/> param, boolean optimizeContent){
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="$inputElementType"/> param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault{
+ try{
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
<xsl:choose>
<xsl:when test="$helpermode">
@@ -117,6 +126,9 @@
</xsl:otherwise>
</xsl:choose>
return emptyEnvelope;
+ } catch(org.apache.axis2.databinding.ADBException e){
+ throw new org.apache.axis2.AxisFault(e.getMessage());
+ }
}
<!-- to support for backword compatiblity we have to add and wrapp method-->
@@ -201,21 +213,26 @@
<xsl:variable name="outElementType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"></xsl:variable>
<!-- Assumption - The ADBBean here is always an element based bean -->
<xsl:if test="generate-id($outElement) = generate-id(key('paramsOut', $outElementType)[1])">
- private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/> param, boolean optimizeContent){
- org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
- <xsl:choose>
- <xsl:when test="$helpermode">
- emptyEnvelope.getBody().addChild(
- <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>Helper.getOMElement(
- param,
- <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
- </xsl:when>
- <xsl:otherwise>
- emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
- </xsl:otherwise>
- </xsl:choose>
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/> param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault{
+ try{
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ <xsl:choose>
+ <xsl:when test="$helpermode">
+ emptyEnvelope.getBody().addChild(
+ <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>Helper.getOMElement(
+ param,
+ <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
+ </xsl:when>
+ <xsl:otherwise>
+ emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/>.MY_QNAME,factory));
+ </xsl:otherwise>
+ </xsl:choose>
- return emptyEnvelope;
+ return emptyEnvelope;
+ } catch(org.apache.axis2.databinding.ADBException e){
+ throw new org.apache.axis2.AxisFault(e.getMessage());
+ }
}
</xsl:if>
</xsl:when>
@@ -335,7 +352,7 @@
private java.lang.Object fromOM(
org.apache.axiom.om.OMElement param,
java.lang.Class type,
- java.util.Map extraNamespaces){
+ java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{
try {
<xsl:for-each select="param[not(@primitive) and @type!='']">
@@ -354,8 +371,8 @@
}
</xsl:for-each>
- } catch (Exception e) {
- throw new RuntimeException(e);
+ } catch (java.lang.Exception e) {
+ throw new org.apache.axis2.AxisFault(e.getMessage());
}
return null;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/BeanWriter.java Sun Jun 17 05:11:16 2007
@@ -69,7 +69,10 @@
* @return Returns String.
* @throws SchemaCompilationException
*/
- public String write(QName qname, Map typeMap, BeanWriterMetaInfoHolder metainf)
+ public String write(QName qname,
+ Map typeMap,
+ BeanWriterMetaInfoHolder metainf,
+ boolean isAbstract)
throws SchemaCompilationException;
/**
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java Sun Jun 17 05:11:16 2007
@@ -181,7 +181,10 @@
*
* @see org.apache.axis2.schema.writer.BeanWriter
*/
- public String write(QName qName, Map typeMap, BeanWriterMetaInfoHolder metainf)
+ public String write(QName qName,
+ Map typeMap,
+ BeanWriterMetaInfoHolder metainf,
+ boolean isAbstract)
throws SchemaCompilationException {
try {
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Sun Jun 17 05:11:16 2007
@@ -112,7 +112,6 @@
* meaning when the classes are supposed to be wrapped so the
*
* @return Returns Map.
- * @throws SchemaCompilationException
* @see BeanWriter#getModelMap()
*/
public Map getModelMap() {
@@ -210,7 +209,7 @@
try {
QName qName = element.getQName();
- return process(qName, metainf, typeMap, true);
+ return process(qName, metainf, typeMap, true, false);
} catch (Exception e) {
e.printStackTrace();
throw new SchemaCompilationException(e);
@@ -219,23 +218,23 @@
}
/**
- * @param complexType
+ * `
+ * @param qName
* @param typeMap
* @param metainf
- * @param fullyQualifiedClassName the name returned by makeFullyQualifiedClassName() or null if
- * it wasn't called
- * @throws org.apache.axis2.schema.SchemaCompilationException
- *
- * @see BeanWriter#write(org.apache.ws.commons.schema.XmlSchemaComplexType,
- * java.util.Map, org.apache.axis2.schema.BeanWriterMetaInfoHolder)
+ * @param isAbstract
+ * @return
+ * @throws SchemaCompilationException
*/
- public String write(QName qName, Map typeMap,
- BeanWriterMetaInfoHolder metainf)
+ public String write(QName qName,
+ Map typeMap,
+ BeanWriterMetaInfoHolder metainf,
+ boolean isAbstract)
throws SchemaCompilationException {
try {
// determine the package for this type.
- return process(qName, metainf, typeMap, false);
+ return process(qName, metainf, typeMap, false,isAbstract);
} catch (SchemaCompilationException e) {
throw e;
@@ -288,7 +287,7 @@
qName = (QName) simpleType.getMetaInfoMap().get(SchemaConstants.SchemaCompilerInfoHolder.FAKE_QNAME);
}
metainf.addtStatus(qName, SchemaConstants.SIMPLE_TYPE_OR_CONTENT);
- return process(qName, metainf, typeMap, true);
+ return process(qName, metainf, typeMap, true, false);
} catch (Exception e) {
throw new SchemaCompilationException(e);
}
@@ -374,8 +373,11 @@
* @return Returns String.
* @throws Exception
*/
- private String process(QName qName, BeanWriterMetaInfoHolder metainf,
- Map typeMap, boolean isElement)
+ private String process(QName qName,
+ BeanWriterMetaInfoHolder metainf,
+ Map typeMap,
+ boolean isElement,
+ boolean isAbstract)
throws Exception {
String fullyQualifiedClassName = metainf.getOwnClassName();
if (fullyQualifiedClassName == null)
@@ -406,7 +408,7 @@
if (wrapClasses) {
globalWrappedDocument.getDocumentElement().appendChild(
getBeanElement(globalWrappedDocument, className,
- originalName, basePackageName, qName, isElement,
+ originalName, basePackageName, qName, isElement,isAbstract,
metainf, propertyNames, typeMap));
} else {
@@ -414,7 +416,7 @@
Document model = XSLTUtils.getDocument();
// make the XML
model.appendChild(getBeanElement(model, className, originalName,
- basePackageName, qName, isElement, metainf, propertyNames,
+ basePackageName, qName, isElement,isAbstract, metainf, propertyNames,
typeMap));
if (writeClasses) {
@@ -470,6 +472,7 @@
String packageName,
QName qName,
boolean isElement,
+ boolean isAbstract,
BeanWriterMetaInfoHolder metainf,
ArrayList propertyNames,
Map typeMap)
@@ -485,6 +488,10 @@
if (!wrapClasses) {
XSLTUtils.addAttribute(model, "unwrapped", "yes", rootElt);
+ }
+
+ if (isAbstract){
+ XSLTUtils.addAttribute(model, "isAbstract", "yes", rootElt);
}
if (!writeClasses) {
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml Sun Jun 17 05:11:16 2007
@@ -312,6 +312,14 @@
<arg file="${testsuite.source.dir}/base64binary.xsd"/>
<arg file="${schema.generated.src.dir}"/>
</java>
+ <echo>Compiling abstract.xsd</echo>
+ <java classname="org.apache.axis2.schema.XSD2Java" fork="true">
+ <jvmarg line="${maven.junit.jvmargs}"/>
+ <classpath refid="maven.dependency.classpath"/>
+ <classpath location="${compiled.classes.dir}"/>
+ <arg file="${testsuite.source.dir}/abstract.xsd"/>
+ <arg file="${schema.generated.src.dir}"/>
+ </java>
</target>
</project>
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/all/AllTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/all/AllTest.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/all/AllTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/all/AllTest.java Sun Jun 17 05:11:16 2007
@@ -36,8 +36,9 @@
update.setArg1(true);
update.setId(2);
- OMElement omElement = update.getOMElement(Update.MY_QNAME, OMAbstractFactory.getOMFactory());
+
try {
+ OMElement omElement = update.getOMElement(Update.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("om string ==> " + omElementString);
omElementString = "<ns1:Update xmlns:ns1=\"http://tempuri.org/\"><ns1:arg1>true</ns1:arg1><ns1:id>2</ns1:id><ns1:arg0>test</ns1:arg0></ns1:Update>";
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/attribute/AttributeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/attribute/AttributeTest.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/attribute/AttributeTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/attribute/AttributeTest.java Sun Jun 17 05:11:16 2007
@@ -31,9 +31,9 @@
TestElement1 testElement = new TestElement1();
testElement.setAttribute1(1);
-
- OMElement omElement = testElement.getOMElement(TestElement1.MY_QNAME, OMAbstractFactory.getOMFactory());
+ OMElement omElement;
try {
+ omElement = testElement.getOMElement(TestElement1.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
@@ -46,8 +46,8 @@
testElement = new TestElement1();
testElement.setAttribute1(Integer.MIN_VALUE);
- omElement = testElement.getOMElement(TestElement1.MY_QNAME, OMAbstractFactory.getOMFactory());
try {
+ omElement = testElement.getOMElement(TestElement1.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
@@ -61,10 +61,10 @@
public void testElement2(){
TestElement2 testElement = new TestElement2();
testElement.setAttribute1(1);
-
- OMElement omElement = testElement.getOMElement(TestElement2.MY_QNAME, OMAbstractFactory.getOMFactory());
- try {
- String omElementString = omElement.toStringWithConsume();
+ OMElement omElement;
+ try {
+ omElement = testElement.getOMElement(TestElement2.MY_QNAME, OMAbstractFactory.getOMFactory());
+ String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
TestElement2 result = TestElement2.Factory.parse(xmlReader);
@@ -76,8 +76,8 @@
testElement = new TestElement2();
testElement.setAttribute1(Integer.MIN_VALUE);
- omElement = testElement.getOMElement(TestElement2.MY_QNAME, OMAbstractFactory.getOMFactory());
try {
+ omElement = testElement.getOMElement(TestElement2.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
fail();
@@ -89,10 +89,10 @@
public void testElement3(){
TestElement3 testElement = new TestElement3();
testElement.setAttribute1("test");
-
- OMElement omElement = testElement.getOMElement(TestElement3.MY_QNAME, OMAbstractFactory.getOMFactory());
- try {
- String omElementString = omElement.toStringWithConsume();
+ OMElement omElement;
+ try {
+ omElement = testElement.getOMElement(TestElement3.MY_QNAME, OMAbstractFactory.getOMFactory());
+ String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
TestElement3 result = TestElement3.Factory.parse(xmlReader);
@@ -103,9 +103,9 @@
testElement = new TestElement3();
- omElement = testElement.getOMElement(TestElement3.MY_QNAME, OMAbstractFactory.getOMFactory());
try {
+ omElement = testElement.getOMElement(TestElement3.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
@@ -119,9 +119,9 @@
public void testElement4(){
TestElement4 testElement = new TestElement4();
testElement.setAttribute1("test");
-
- OMElement omElement = testElement.getOMElement(TestElement4.MY_QNAME, OMAbstractFactory.getOMFactory());
+ OMElement omElement;
try {
+ omElement = testElement.getOMElement(TestElement4.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
@@ -133,9 +133,9 @@
testElement = new TestElement4();
- omElement = testElement.getOMElement(TestElement4.MY_QNAME, OMAbstractFactory.getOMFactory());
try {
+ omElement = testElement.getOMElement(TestElement4.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMElement ==> " + omElementString);
fail();
@@ -150,9 +150,9 @@
attribute1_type0.setAttribute1_type0("test attribute");
testAttributeSimpleType.setAttribute1(attribute1_type0);
- OMElement omElement = testAttributeSimpleType.getOMElement(TestAttributeSimpleType.MY_QNAME,
- OMAbstractFactory.getOMFactory());
try {
+ OMElement omElement = testAttributeSimpleType.getOMElement(TestAttributeSimpleType.MY_QNAME,
+ OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OMString ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
@@ -172,9 +172,9 @@
testAttributeReferenceElement.setTestAttributeReferenceElement(testAttributeReferenceType);
- OMElement omElement = testAttributeReferenceElement.getOMElement(TestAttributeReferenceElement.MY_QNAME,
- OMAbstractFactory.getOMFactory());
try {
+ OMElement omElement = testAttributeReferenceElement.getOMElement(TestAttributeReferenceElement.MY_QNAME,
+ OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OM Element ==> " + omElementString);
XMLStreamReader xmlReader =
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/base64binary/Base64BinaryTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/base64binary/Base64BinaryTest.java?view=diff&rev=548033&r1=548032&r2=548033
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/base64binary/Base64BinaryTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/base64binary/Base64BinaryTest.java Sun Jun 17 05:11:16 2007
@@ -51,9 +51,9 @@
contentType_type0.setContentType_type0("test content type");
base64Binary.setContentType(contentType_type0);
- OMElement omElement = testBase64Binary.getOMElement(TestBase64Binary.MY_QNAME, OMAbstractFactory.getOMFactory());
try {
+ OMElement omElement = testBase64Binary.getOMElement(TestBase64Binary.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OM String ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
@@ -86,9 +86,9 @@
contentType_type0.setContentType_type0("test content type");
hexBinary.setContentType(contentType_type0);
- OMElement omElement = testHexBinary.getOMElement(TestBase64Binary.MY_QNAME, OMAbstractFactory.getOMFactory());
try {
+ OMElement omElement = testHexBinary.getOMElement(TestBase64Binary.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OM String ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org