Skip to content

Commit dedb888

Browse files
author
Brian DePradine
committed
Sync with trunk to revision 576270.
git-svn-id: https://svn.apache.org/repos/asf/webservices/axis2/branches/java@576381 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4c0e206 commit dedb888

61 files changed

Lines changed: 2365 additions & 722 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public class BeanWriterMetaInfoHolder {
6161
protected String minInclusiveFacet = null;
6262

6363
protected Map memberTypes = new HashMap();
64+
protected List memberTypesKeys = new ArrayList();
65+
6466
protected QName itemTypeQName;
6567
protected String itemTypeClassName;
6668
protected boolean isUnion;
@@ -809,8 +811,17 @@ public void setMemberTypes(Map memberTypes) {
809811
this.memberTypes = memberTypes;
810812
}
811813

814+
public List getMemberTypesKeys() {
815+
return memberTypesKeys;
816+
}
817+
818+
public void setMemberTypesKeys(List memberTypesKeys) {
819+
this.memberTypesKeys = memberTypesKeys;
820+
}
821+
812822
public void addMemberType(QName qname,String className){
813823
this.memberTypes.put(qname,className);
824+
this.memberTypesKeys.add(qname);
814825
}
815826

816827
public boolean isList() {

jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,9 +1619,7 @@ public void processAttribute(XmlSchemaAttribute att, BeanWriterMetaInfoHolder me
16191619
if (type instanceof XmlSchemaSimpleType) {
16201620
XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) type;
16211621

1622-
if ((simpleType != null) &&
1623-
(simpleType.getContent() instanceof XmlSchemaSimpleTypeRestriction)) {
1624-
// we only support simple type restriction
1622+
if (simpleType != null) {
16251623
if (!isAlreadyProcessed(schemaTypeName)) {
16261624
//process simple type
16271625
processSimpleSchemaType(simpleType, null, parentSchema, null);
@@ -1991,34 +1989,6 @@ private void process(QName parentElementQName,
19911989
} else {
19921990
throw new SchemaCompilationException("Referenced name is null");
19931991
}
1994-
1995-
} else if (order && (item instanceof XmlSchemaChoice)) {
1996-
1997-
// this is a tempory patch for process only inner sequence choices
1998-
// but we have do this with a proper design
1999-
XmlSchemaChoice choice = (XmlSchemaChoice) item;
2000-
XmlSchemaObject choiceChild;
2001-
XmlSchemaObjectCollection schemaItems = choice.getItems();
2002-
for (int j = 0; j < schemaItems.getCount(); j++) {
2003-
choiceChild = schemaItems.getItem(j);
2004-
if (choiceChild instanceof XmlSchemaElement){
2005-
// i.e this is an inner choice element
2006-
//recursively process the element
2007-
XmlSchemaElement xsElt = (XmlSchemaElement) choiceChild;
2008-
2009-
boolean isArray = isArray(xsElt);
2010-
processElement(xsElt, processedElementTypeMap, localNillableList, parentSchema); //we know for sure this is not an outer type
2011-
processedElementArrayStatusMap.put(xsElt, (isArray) ? Boolean.TRUE : Boolean.FALSE);
2012-
if (order) {
2013-
//we need to keep the order of the elements. So push the elements to another
2014-
//hashmap with the order number
2015-
elementOrderMap.put(xsElt, new Integer(sequenceCounter));
2016-
sequenceCounter++;
2017-
}
2018-
innerChoiceElementList.add(xsElt.getQName());
2019-
}
2020-
}
2021-
20221992
} else {
20231993
//there may be other types to be handled here. Add them
20241994
//when we are ready

jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl

Lines changed: 100 additions & 30 deletions
Large diffs are not rendered by default.

jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
#include &lt;stdio.h&gt;
8888
#include &lt;axiom.h&gt;
89-
#include &lt;axutil_utils.h&gt;
89+
#include &lt;axis2_util.h&gt;
9090
#include &lt;axiom_soap.h&gt;
9191
#include &lt;axis2_client.h&gt;
9292

jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
</xsl:if>
241241

242242
<!-- the following element can be inside array or independent one -->
243-
<xsl:if test="$nativePropertyType!='axis2_char_t*'">
243+
<!--xsl:if test="$nativePropertyType!='axis2_char_t*'"-->
244244
if( <xsl:value-of select="$justAttriName"/> != NULL)
245245
{
246246
<!-- how to free all the ours things -->
@@ -258,7 +258,7 @@
258258
</xsl:when>
259259

260260
<!-- free axis2_char_t s -->
261-
<xsl:when test="$nativePropertyType='axis2_char_t*'">
261+
<xsl:when test="$nativePropertyType='axis2_char_t*' and not(@isarray)">
262262
AXIS2_FREE( env-> allocator, <xsl:value-of select="$attriName"/>);
263263
</xsl:when>
264264

@@ -294,7 +294,7 @@
294294
<xsl:value-of select="$justAttriName"/> = NULL;
295295
}
296296

297-
</xsl:if>
297+
<!--/xsl:if-->
298298
<!-- close tags arrays -->
299299
<xsl:if test="@isarray">
300300
}
@@ -405,7 +405,7 @@
405405
<xsl:when test="not(@type)">
406406
<xsl:for-each select="property">
407407
<xsl:if test="position()=1">
408-
current_element = axiom_node_get_data_element( parent, env);
408+
current_element = (axiom_element_t *)axiom_node_get_data_element( parent, env);
409409
qname = axiom_element_get_qname( current_element, env, parent);
410410
if ( axutil_qname_equals( qname, env, <xsl:value-of select="$name"/>-> qname ) )
411411
{
@@ -436,7 +436,7 @@
436436

437437
<xsl:for-each select="property/@attribute">
438438
<xsl:if test="position()=1">
439-
parent_element = axiom_node_get_data_element( parent, env);
439+
parent_element = (axiom_element_t *)axiom_node_get_data_element( parent, env);
440440
</xsl:if>
441441
</xsl:for-each>
442442

@@ -635,9 +635,7 @@
635635
/**
636636
* building <xsl:value-of select="$CName"/> array
637637
*/
638-
<xsl:if test="position()=1">
639638
arr_list = axutil_array_list_create( env, 10);
640-
</xsl:if>
641639
</xsl:if>
642640

643641
<!-- for each non attribute properties there will always be an element-->
@@ -673,7 +671,7 @@
673671
for ( current_node = first_node; current_node != NULL;
674672
current_node = axiom_node_get_next_sibling( current_node, env))
675673
{
676-
current_element = axiom_node_get_data_element( current_node, env);
674+
current_element = (axiom_element_t *)axiom_node_get_data_element( current_node, env);
677675
qname = axiom_element_get_qname( current_element, env, current_node);
678676
element_qname = axutil_qname_create( env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", "<xsl:choose>
679677
<xsl:when test="@prefix!=''"><xsl:value-of select="@prefix"/></xsl:when>
@@ -686,9 +684,12 @@
686684
}
687685
</xsl:otherwise>
688686
</xsl:choose>
689-
if ( current_node != NULL)
687+
688+
if (current_node <xsl:if test="(@minOccurs=0)"> &amp;&amp; axiom_node_get_data_element( current_node, env) &amp;&amp; !axutil_strcmp(&quot;<xsl:value-of select="$propertyName"/>&quot;,
689+
axiom_element_get_localname((axiom_element_t *)axiom_node_get_data_element( current_node, env), env))
690+
</xsl:if>)
690691
{
691-
<xsl:if test="../@ordered or not($anon or $istype)">current_element = axiom_node_get_data_element( current_node, env);</xsl:if>
692+
<xsl:if test="../@ordered or not($anon or $istype)">current_element = (axiom_element_t *)axiom_node_get_data_element( current_node, env);</xsl:if>
692693
<!-- changes to following choose tag should be changed in another 2 places -->
693694
<xsl:choose>
694695
<xsl:when test="@ours">
@@ -957,7 +958,7 @@
957958
<xsl:when test="position()=1">first_node</xsl:when>
958959
<xsl:otherwise>axiom_node_get_next_sibling( current_node, env)</xsl:otherwise></xsl:choose>; current_node != NULL; current_node = axiom_node_get_next_sibling( current_node, env))
959960
{
960-
current_element = axiom_node_get_data_element( current_node, env);
961+
current_element = (axiom_element_t *)axiom_node_get_data_element( current_node, env);
961962
qname = axiom_element_get_qname( current_element, env, current_node);
962963

963964
if ( axutil_qname_equals( element_qname, env, qname) )
@@ -1129,7 +1130,7 @@
11291130
*/
11301131
for ( i = 0, current_node = first_node; current_node != NULL; current_node = axiom_node_get_next_sibling( current_node, env))
11311132
{
1132-
current_element = axiom_node_get_data_element( current_node, env);
1133+
current_element = (axiom_element_t *)axiom_node_get_data_element( current_node, env);
11331134
qname = axiom_element_get_qname( current_element, env, current_node);
11341135

11351136
if ( axutil_qname_equals( element_qname, env, qname)
@@ -1373,13 +1374,13 @@
13731374
</xsl:if>
13741375
<xsl:for-each select="property/@attribute">
13751376
<xsl:if test="position()=1">
1376-
parent_element = axiom_node_get_data_element( parent, env);
1377+
parent_element = (axiom_element_t *)axiom_node_get_data_element( parent, env);
13771378
</xsl:if>
13781379
</xsl:for-each>
13791380
<xsl:if test="property and (not(property/@attribute) or property/@attribute='' or property/@notattribute)">
13801381
if(has_parent)
13811382
{
1382-
data_source = axiom_node_get_data_element(parent, env);
1383+
data_source = (axiom_data_source_t *)axiom_node_get_data_element(parent, env);
13831384
if (!data_source)
13841385
return NULL;
13851386
stream = axiom_data_source_get_stream(data_source, env); /* assume parent is of type data source */
@@ -1790,7 +1791,7 @@
17901791
axutil_stream_write(stream, env, start_input_str, start_input_str_len);
17911792

17921793
text_value_<xsl:value-of select="$position"/>_temp = axutil_xml_quote_string(env, text_value_<xsl:value-of select="$position"/>, AXIS2_TRUE);
1793-
if (text_value_2_temp)
1794+
if (text_value_<xsl:value-of select="$position"/>_temp)
17941795
{
17951796
axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>_temp, axutil_strlen(text_value_<xsl:value-of select="$position"/>_temp));
17961797
AXIS2_FREE(env->allocator, text_value_<xsl:value-of select="$position"/>_temp);
@@ -1942,7 +1943,14 @@
19421943
return AXIS2_FAILURE;
19431944
}
19441945
</xsl:if>
1945-
<xsl:value-of select="$name"/>-> attrib_<xsl:value-of select="$CName"/> = param_<xsl:value-of select="$CName"/>;
1946+
<xsl:choose>
1947+
<xsl:when test="@type='axis2_char_t*' and not(@isarray)">
1948+
<xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/> = (axis2_char_t *)axutil_strdup(env, param_<xsl:value-of select="$CName"/>);
1949+
</xsl:when>
1950+
<xsl:otherwise>
1951+
<xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/> = param_<xsl:value-of select="$CName"/>;
1952+
</xsl:otherwise>
1953+
</xsl:choose>
19461954
return AXIS2_SUCCESS;
19471955
}
19481956

jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
*/
5252
public class JavaBeanWriter implements BeanWriter {
5353

54-
private static final Log log = LogFactory.getLog(JavaBeanWriter .class);
54+
private static final Log log = LogFactory.getLog(JavaBeanWriter.class);
5555

5656
public static final String WRAPPED_DATABINDING_CLASS_NAME = "WrappedDatabinder";
5757

@@ -602,7 +602,7 @@ protected void populateMemberInfo(BeanWriterMetaInfoHolder metainf,
602602
Map typeMap) {
603603
Map memberTypes = metainf.getMemberTypes();
604604
QName memberQName;
605-
for (Iterator iter = memberTypes.keySet().iterator(); iter.hasNext();) {
605+
for (Iterator iter = metainf.getMemberTypesKeys().iterator(); iter.hasNext();) {
606606
memberQName = (QName) iter.next();
607607
String memberClass = (String) memberTypes.get(memberQName);
608608
if (PrimitiveTypeFinder.isPrimitive(memberClass)) {
@@ -742,6 +742,13 @@ private void addPropertyEntries(BeanWriterMetaInfoHolder metainf,
742742
XSLTUtils.addAttribute(model, "particleClassType", "yes", property);
743743
}
744744

745+
// if we have an particle class in a extension class then we have
746+
// to consider the whole class has a particle type.
747+
748+
if (metainf.isHasParticleType()) {
749+
XSLTUtils.addAttribute(model, "hasParticleType", "yes", rootElt);
750+
}
751+
745752
// what happed if this contain attributes
746753
// TODO: check the meaning of this removed property
747754

jaxws21/modules/adb-codegen/sub-build.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,22 @@
362362
<arg file="${testsuite.source.dir}/rampart.xsd"/>
363363
<arg file="${schema.generated.src.dir}"/>
364364
</java>
365+
<echo>Compiling innerParticleExtension.xsd</echo>
366+
<java classname="org.apache.axis2.schema.XSD2Java" fork="true">
367+
<jvmarg line="${maven.junit.jvmargs}"/>
368+
<classpath refid="maven.dependency.classpath"/>
369+
<classpath location="${compiled.classes.dir}"/>
370+
<arg file="${testsuite.source.dir}/innerParticleExtension.xsd"/>
371+
<arg file="${schema.generated.src.dir}"/>
372+
</java>
373+
<echo>Compiling union2.xsd</echo>
374+
<java classname="org.apache.axis2.schema.XSD2Java" fork="true">
375+
<jvmarg line="${maven.junit.jvmargs}"/>
376+
<classpath refid="maven.dependency.classpath"/>
377+
<classpath location="${compiled.classes.dir}"/>
378+
<arg file="${testsuite.source.dir}/union2.xsd"/>
379+
<arg file="${schema.generated.src.dir}"/>
380+
</java>
365381
</target>
366382

367383
</project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<s:schema elementFormDefault="qualified"
2+
xmlns:s="http://www.w3.org/2001/XMLSchema"
3+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4+
xmlns:tns="http://tempuri.org/innerparticalextension"
5+
targetNamespace="http://tempuri.org/innerparticalextension">
6+
7+
<s:complexType name="ParentType">
8+
<s:choice minOccurs="0" maxOccurs="unbounded">
9+
<s:element name="param1" type="s:string"/>
10+
<s:element name="param2" type="s:string"/>
11+
</s:choice>
12+
</s:complexType>
13+
<s:element name="TestElement">
14+
<s:complexType>
15+
<s:sequence>
16+
<s:element name="ChildElement" maxOccurs="unbounded">
17+
<s:complexType>
18+
<s:complexContent>
19+
<s:extension base="tns:ParentType">
20+
<s:attribute name="testAttribute" type="s:string"/>
21+
</s:extension>
22+
</s:complexContent>
23+
</s:complexType>
24+
</s:element>
25+
</s:sequence>
26+
</s:complexType>
27+
</s:element>
28+
</s:schema>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<s:schema elementFormDefault="qualified"
2+
xmlns:s="http://www.w3.org/2001/XMLSchema"
3+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4+
xmlns:tns="http://tempuri.org/union2"
5+
targetNamespace="http://tempuri.org/union2">
6+
7+
<s:simpleType name="TestUnion1">
8+
<s:union memberTypes="s:string s:boolean tns:TestRestriction"/>
9+
</s:simpleType>
10+
<s:simpleType name="TestRestriction">
11+
<s:restriction base="s:string">
12+
</s:restriction>
13+
</s:simpleType>
14+
<s:element name="TestUnionElement1" type="tns:TestUnion1"/>
15+
<s:element name="TestUnionElement2">
16+
<s:complexType>
17+
<s:sequence>
18+
<s:element name="param1" type="tns:TestUnion1"/>
19+
</s:sequence>
20+
<s:attribute name="attribute1" type="tns:TestUnion1"/>
21+
</s:complexType>
22+
</s:element>
23+
<s:simpleType name="TestList1">
24+
<s:list itemType="s:string"/>
25+
</s:simpleType>
26+
<s:element name="TestListElement1">
27+
<s:complexType>
28+
<s:sequence>
29+
<s:element name="param1" type="tns:TestList1"/>
30+
</s:sequence>
31+
<s:attribute name="attribute1" type="tns:TestList1"/>
32+
</s:complexType>
33+
</s:element>
34+
</s:schema>

0 commit comments

Comments
 (0)