You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/01/15 17:22:27 UTC
svn commit: r612147 [2/17] - in /webservices/axis2/branches/java/jaxws21: ./
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/schema...
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java Tue Jan 15 08:21:22 2008
@@ -83,6 +83,57 @@
public static final QName XSD_NORMALIZEDSTRING = new QName(URI_DEFAULT_SCHEMA_XSD, "normalizedString");
public static final QName XSD_TOKEN = new QName(URI_DEFAULT_SCHEMA_XSD, "token");
+ //soap encoding constants
+ public static final String URI_DEFAULT_SCHEMA_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
+ public static final QName SOAP_ENCODING_ARRAY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "Array");
+ public static final QName SOAP_ENCODING_STRUCT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "Struct");
+ public static final QName SOAP_ENCODING_BASE64 = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "base64");
+ public static final QName SOAP_ENCODING_DURATION = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "duration");
+ public static final QName SOAP_ENCODING_DATETIME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "dateTime");
+ public static final QName SOAP_ENCODING_NOTATION = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NOTATION");
+ public static final QName SOAP_ENCODING_TIME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "time");
+ public static final QName SOAP_ENCODING_DATE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "date");
+ public static final QName SOAP_ENCODING_GYEARMONTH = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gYearMonth");
+ public static final QName SOAP_ENCODING_GYEAR = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gYear");
+ public static final QName SOAP_ENCODING_GMONTHDAY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gMonthDay");
+ public static final QName SOAP_ENCODING_GDAY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gDay");
+ public static final QName SOAP_ENCODING_GMONTH = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "gMonth");
+ public static final QName SOAP_ENCODING_BOOLEAN = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "boolean");
+ public static final QName SOAP_ENCODING_BASE64BINARY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "base64Binary");
+ public static final QName SOAP_ENCODING_HEXBINARY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "hexBinary");
+ public static final QName SOAP_ENCODING_FLOAT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "float");
+ public static final QName SOAP_ENCODING_DOUBLE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "double");
+ public static final QName SOAP_ENCODING_ANYURI = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "anyURI");
+ public static final QName SOAP_ENCODING_QNAME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "QName");
+ public static final QName SOAP_ENCODING_STRING = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "string");
+ public static final QName SOAP_ENCODING_NORMALIZEDSTRING = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "normalizedString");
+ public static final QName SOAP_ENCODING_TOKEN = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "token");
+ public static final QName SOAP_ENCODING_LANGUAGE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "language");
+ public static final QName SOAP_ENCODING_NAME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "Name");
+ public static final QName SOAP_ENCODING_NMTOKEN = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NMTOKEN");
+ public static final QName SOAP_ENCODING_NCNAME = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NCName");
+ public static final QName SOAP_ENCODING_NMTOKENS = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "NMTOKENS");
+ public static final QName SOAP_ENCODING_ID = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "ID");
+ public static final QName SOAP_ENCODING_IDREF = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "IDREF");
+ public static final QName SOAP_ENCODING_ENTITY = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "ENTITY");
+ public static final QName SOAP_ENCODING_IDREFS = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "IDREFS");
+ public static final QName SOAP_ENCODING_ENTITIES = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "ENTITIES");
+ public static final QName SOAP_ENCODING_DECIMAL = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "decimal");
+ public static final QName SOAP_ENCODING_INTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "integer");
+ public static final QName SOAP_ENCODING_NONPOSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "nonPositiveInteger");
+ public static final QName SOAP_ENCODING_NEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "negativeInteger");
+ public static final QName SOAP_ENCODING_LONG = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "long");
+ public static final QName SOAP_ENCODING_INT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "int");
+ public static final QName SOAP_ENCODING_SHORT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "short");
+ public static final QName SOAP_ENCODING_BYTE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "byte");
+ public static final QName SOAP_ENCODING_NONNEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "nonNegativeInteger");
+ public static final QName SOAP_ENCODING_UNSIGNEDLONG = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedLong");
+ public static final QName SOAP_ENCODING_UNSIGNEDINT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedInt");
+ public static final QName SOAP_ENCODING_UNSIGNEDSHORT = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedShort");
+ public static final QName SOAP_ENCODING_UNSIGNEDBYTE = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "unsignedByte");
+ public static final QName SOAP_ENCODING_POSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_SOAP_ENCODING, "positiveInteger");
+
+
//bit patterns for the types
public static final int ATTRIBUTE_TYPE = 0x0001;
public static final int ELEMENT_TYPE = 0x0002;
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/XSD2Java.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/XSD2Java.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/XSD2Java.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/XSD2Java.java Tue Jan 15 08:21:22 2008
@@ -27,6 +27,8 @@
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
public class XSD2Java {
@@ -76,6 +78,12 @@
CompilerOptions compilerOptions = new CompilerOptions();
compilerOptions.setOutputLocation(outputFolder);
compilerOptions.setGenerateAll(true);
+
+// Map namespace2PackageMap = new HashMap();
+// namespace2PackageMap.put("http://www.w3.org/2001/XMLSchema/schema",
+// "org.apache.axis2.databinding.types.xsd");
+// compilerOptions.setNs2PackageMap(namespace2PackageMap);
+// compilerOptions.setMapperClassPackage("org.apache.axis2.databinding.types.xsd");
//todo - this should come from the users preferences
compilerOptions.setWrapClasses(false);
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?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- 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 Tue Jan 15 08:21:22 2008
@@ -68,6 +68,7 @@
<xsl:variable name="mapperClass" select="@mapperClass"/>
<xsl:variable name="particleClass" select="@particleClass"/>
<xsl:variable name="hasParticleType" select="@hasParticleType"/>
+ <xsl:variable name="usewrapperclasses" select="@usewrapperclasses"/>
<!-- write the class header. this should be done only when unwrapped -->
<xsl:if test="not(not(@unwrapped) or (@skip-write))">
@@ -85,7 +86,6 @@
* <xsl:value-of select="$name"/> bean class
*/
</xsl:if>
-
public <xsl:if test="not(@unwrapped) or (@skip-write)">static</xsl:if> <xsl:if test="@isAbstract and @unwrapped and not(@skip-write)">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{
@@ -478,6 +478,9 @@
<xsl:when test="@primitive and not(@array)">
// setting primitive attribute tracker to true
<xsl:choose>
+ <xsl:when test="$usewrapperclasses">
+ if (false) {
+ </xsl:when>
<xsl:when test="$propertyType='int'">
if (param==java.lang.Integer.MIN_VALUE) {
</xsl:when>
@@ -797,7 +800,7 @@
writeQName((javax.xml.namespace.QName)localObject,xmlWriter);
</xsl:when>
<xsl:otherwise>
- xmlWriter.writeCharacters(localObject.toString());
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString((<xsl:value-of select="@type"/>)localObject));
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
@@ -882,6 +885,7 @@
<xsl:if test="not($extension) or @anon">
if (serializeType){
</xsl:if>
+
java.lang.String namespacePrefix = registerPrefix(xmlWriter,"<xsl:value-of select="$nsuri"/>");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
@@ -938,6 +942,9 @@
<xsl:choose>
<xsl:when test="@primitive">
<xsl:choose>
+ <xsl:when test="$usewrapperclasses">
+ if (true) {
+ </xsl:when>
<xsl:when test="$propertyType='int'">
if (<xsl:value-of select="$varName"/>!=java.lang.Integer.MIN_VALUE) {
</xsl:when>
@@ -1339,6 +1346,9 @@
for (int i = 0;i < <xsl:value-of select="$varName"/>.length;i++){
<xsl:if test="@primitive">
<xsl:choose>
+ <xsl:when test="$usewrapperclasses">
+ if (true) {
+ </xsl:when>
<xsl:when test="$propertyBaseType='int'">
if (<xsl:value-of select="$varName"/>[i]!=java.lang.Integer.MIN_VALUE) {
</xsl:when>
@@ -1566,6 +1576,9 @@
<xsl:if test="@primitive">
<!-- we have to check for nillability with min value -->
<xsl:choose>
+ <xsl:when test="$usewrapperclasses">
+ if (false) {
+ </xsl:when>
<xsl:when test="$propertyType='int'">
if (<xsl:value-of select="$varName"/>==java.lang.Integer.MIN_VALUE) {
</xsl:when>
@@ -1750,6 +1763,9 @@
<!-- we have to check for nillability with min value -->
<xsl:choose>
+ <xsl:when test="$usewrapperclasses">
+ if (false) {
+ </xsl:when>
<xsl:when test="$propertyType='int'">
if (<xsl:value-of select="$varName"/>==java.lang.Integer.MIN_VALUE) {
</xsl:when>
@@ -2562,7 +2578,8 @@
}
</xsl:if>
- <xsl:if test="$isType or $anon or $union">
+ <!-- partical classes can not have any types -->
+ <xsl:if test="(($isType or $anon or $union) and not($particleClass))">
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
@@ -2863,7 +2880,18 @@
reader.next();
} else {
</xsl:if>
- <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+ <xsl:choose>
+ <!-- if the base property type is a soap encoding array then extension
+ mapper class should also passed-->
+ <xsl:when test="$basePropertyType='org.apache.axis2.databinding.types.soapencoding.Array'">
+ <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader,
+ <xsl:value-of select="$mapperClass"/>.class));
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+ </xsl:otherwise>
+ </xsl:choose>
+
<xsl:if test="@nillable">}</xsl:if>
//loop until we find a start element that is not part of this array
boolean <xsl:value-of select="$loopBoolName"/> = false;
@@ -2888,7 +2916,17 @@
reader.next();
} else {
</xsl:if>
- <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+ <xsl:choose>
+ <!-- if the base property type is a soap encoding array then extension
+ mapper class should also passed-->
+ <xsl:when test="$basePropertyType='org.apache.axis2.databinding.types.soapencoding.Array'">
+ <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader,
+ <xsl:value-of select="$mapperClass"/>.class));
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$listName"/>.add(<xsl:value-of select="$basePropertyType"/>.Factory.parse(reader));
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:if test="@nillable">}</xsl:if>
}else{
<xsl:value-of select="$loopBoolName"/> = true;
@@ -3282,7 +3320,18 @@
</xsl:if>
}else{
</xsl:if>
- object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/>.Factory.parse(reader));
+ <xsl:choose>
+ <!-- if the base property type is a soap encoding array then extension
+ mapper class should also passed-->
+ <xsl:when test="$propertyType='org.apache.axis2.databinding.types.soapencoding.Array'">
+ object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/>.Factory.parse(reader,
+ <xsl:value-of select="$mapperClass"/>.class));
+ </xsl:when>
+ <xsl:otherwise>
+ object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/>.Factory.parse(reader));
+ </xsl:otherwise>
+ </xsl:choose>
+
<xsl:if test="($isType or $anon) and not($particleClassType)"> <!-- This is a subelement property to be consumed -->
reader.next();
</xsl:if>
@@ -3488,13 +3537,15 @@
}
</xsl:if>
</xsl:if>
- <xsl:if test="$ordered and $min!=0">
+ <!-- in a particle class all inner elements may be min=0 their validation done
+ inside the sequce class -->
+ <xsl:if test="$ordered and $min!=0 and not($particleClassType)">
else{
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
</xsl:if>
- <xsl:if test="$particleClassType and ($choice or ($min=0))">
+ <xsl:if test="$particleClassType and ($choice or ($min=0)) and not($shortTypeName='OMElement')">
<!-- since we can not validate the parser before going to next class
we have to sollow an excpetions : todo find a better solsution-->
} catch (java.lang.Exception e) {}
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?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- 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 Tue Jan 15 08:21:22 2008
@@ -78,12 +78,13 @@
<xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
<xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
<xsl:variable name="inputElementComplexType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@complextype"></xsl:variable>
- <xsl:variable name="wrappedParameterCount" select="count(../../param[@type!='' and @direction='in' and @opname=$opname]/param)"></xsl:variable>
+ <!--<xsl:variable name="wrappedParameterCount" select="count(../../param[@type!='' and @direction='in' and @opname=$opname]/param)"></xsl:variable>-->
+ <xsl:variable name="isUnwrapParameters" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@unwrappParameters"/>
<xsl:if test="generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1])">
<!-- if the unwrapping mode is on then we have to generate the unwrapped methods -->
<xsl:choose>
- <xsl:when test="$wrappedParameterCount > 0">
+ <xsl:when test="$isUnwrapParameters">
<!-- geneate the toEnvelope method-->
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
<xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
@@ -131,43 +132,43 @@
</xsl:when>
+ <xsl:otherwise>
+ <!-- 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)
+ throws org.apache.axis2.AxisFault{
+
+ <xsl:choose>
+ <xsl:when test="$helpermode">
+ try{
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
+ param,
+ <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+ return emptyEnvelope;
+ } catch(org.apache.axis2.databinding.ADBException e){
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ </xsl:when>
+ <xsl:when test="$inputElementType = 'org.apache.axiom.om.OMElement'">
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody().addChild(param);
+ return emptyEnvelope;
+ </xsl:when>
+ <xsl:otherwise>
+ try{
+
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+ return emptyEnvelope;
+ } catch(org.apache.axis2.databinding.ADBException e){
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ </xsl:otherwise>
+ </xsl:choose>
+ }
+ </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)
- throws org.apache.axis2.AxisFault{
-
- <xsl:choose>
- <xsl:when test="$helpermode">
- try{
- org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
- emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
- param,
- <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
- return emptyEnvelope;
- } catch(org.apache.axis2.databinding.ADBException e){
- throw org.apache.axis2.AxisFault.makeFault(e);
- }
- </xsl:when>
- <xsl:when test="$inputElementType = 'org.apache.axiom.om.OMElement'">
- org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
- emptyEnvelope.getBody().addChild(param);
- return emptyEnvelope;
- </xsl:when>
- <xsl:otherwise>
- try{
-
- org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
- emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
- return emptyEnvelope;
- } catch(org.apache.axis2.databinding.ADBException e){
- throw org.apache.axis2.AxisFault.makeFault(e);
- }
- </xsl:otherwise>
- </xsl:choose>
-
- }
-
<!-- to support for backword compatiblity we have to add and wrapp method-->
/* methods to provide back word compatibility */
@@ -361,20 +362,24 @@
<xsl:if test="generate-id($outputElement) = generate-id(key('paramsOut', $outputElementType)[1]) or
generate-id($outputElement) = generate-id(key('outOperationName', $opname)[1])">
- <xsl:if test="string-length(normalize-space($outputElementComplexType)) > 0">
- <!-- in server side we do not want to unwrap the output type -->
- <!--
- private <xsl:value-of select="$outputElementComplexType"/> get<xsl:value-of select="$opname"/>(
- <xsl:value-of select="$outputElementType"/> wrappedType){
- return wrappedType.get<xsl:value-of select="$outputElementShortType"/>();
- } -->
- private <xsl:value-of select="$outputElementType"/> wrap<xsl:value-of select="$opname"/>(
- <xsl:value-of select="$outputElementComplexType"/> innerType){
- <xsl:value-of select="$outputElementType"/> wrappedElement = new <xsl:value-of select="$outputElementType"/>();
- wrappedElement.set<xsl:value-of select="$outputElementShortType"/>(innerType);
- return wrappedElement;
- }
- </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($outputElementComplexType)) > 0" >
+ private <xsl:value-of select="$outputElementType"/> wrap<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$outputElementComplexType"/> innerType){
+ <xsl:value-of select="$outputElementType"/> wrappedElement = new <xsl:value-of select="$outputElementType"/>();
+ wrappedElement.set<xsl:value-of select="$outputElementShortType"/>(innerType);
+ return wrappedElement;
+ }
+ </xsl:when>
+ <xsl:otherwise>
+ private <xsl:value-of select="$outputElementType"/> wrap<xsl:value-of select="$opname"/>(){
+ <xsl:value-of select="$outputElementType"/> wrappedElement = new <xsl:value-of select="$outputElementType"/>();
+ return wrappedElement;
+ }
+ </xsl:otherwise>
+ </xsl:choose>
+
</xsl:if>
</xsl:if>
</xsl:if>
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl Tue Jan 15 08:21:22 2008
@@ -29,6 +29,9 @@
#define ADB_DEFAULT_DIGIT_LIMIT 64
#define ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT 64
+ <xsl:if test="itemtype">
+ #define ADB_DEFAULT_LIST_SEPERATOR " "
+ </xsl:if>
/**
* <xsl:value-of select="$axis2_name"/> wrapped class classes ( structure for C )
@@ -106,13 +109,18 @@
#define ADB_DEFAULT_DIGIT_LIMIT 64
#define ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT 64
+ <xsl:if test="itemtype">
+ #define ADB_DEFAULT_LIST_SEPERATOR " "
+ </xsl:if>
+
+ /******************************* Create and Free functions *********************************/
/**
* Constructor for creating <xsl:value-of select="$axis2_name"/>_t
* @param env pointer to environment struct
* @return newly created <xsl:value-of select="$axis2_name"/>_t object
*/
- AXIS2_EXTERN <xsl:value-of select="$axis2_name"/>_t* AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_t* AXIS2_CALL
<xsl:value-of select="$axis2_name"/>_create(
const axutil_env_t *env );
@@ -127,89 +135,186 @@
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env);
- <xsl:if test="@simple">
- /**
- * Deserialize the content from a string to adb objects
- * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/><xsl:text> </xsl:text> <xsl:value-of select="$axis2_name"/>_t object
- * @param env pointer to environment struct
- * @param node_value to deserialize
- * @param parent_element The parent element if it is an element, NULL otherwise
- * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
- */
- axis2_status_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_deserialize_from_string(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env,
- axis2_char_t *node_value,
- axiom_node_t *parent);
- </xsl:if>
+
+
+ /********************************** Getters and Setters **************************************/
+ <xsl:if test="count(property[@array])!=0">/******** Deprecated for array types, Use 'Getters and Setters for Arrays' instead ***********/</xsl:if>
+ <xsl:if test="@choice">/******** In a case of a choose among elements, the last one to set will be chooosen *********/</xsl:if>
+ <xsl:if test="@list">/******* This is a list, please use Getters and 'Setters for Array' Instead of following *****/</xsl:if>
+
+ <xsl:for-each select="property">
+ <xsl:variable name="propertyType">
+ <xsl:choose>
+ <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
+
+ <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="PropertyTypeArrayParam"> <!--these are used in arrays to take the type stored in the arraylist-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:when test="@type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="paramComment">
+ <xsl:choose>
+ <xsl:when test="@isarray"><xsl:text>Array of </xsl:text><xsl:value-of select="$PropertyTypeArrayParam"/><xsl:text>s.</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$nativePropertyType"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="constValue">
+ <xsl:choose>
+ <xsl:when test="@isarray"></xsl:when>
+ <xsl:when test="@type='axis2_char_t*' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'">const </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
/**
- * Deserialize an XML to adb objects
+ * Getter for <xsl:value-of select="$propertyName"/>. <xsl:if test="@isarray">Deprecated for array types, Use <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>_at instead</xsl:if>
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @return <xsl:value-of select="$paramComment"/>
+ */
+ <xsl:value-of select="$propertyType"/> AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
+
+ /**
+ * Setter for <xsl:value-of select="$propertyName"/>.<xsl:if test="@isarray">Deprecated for array types, Use <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_at
+ * or <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/> instead.</xsl:if>
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
- * @param parent double pointer to the parent node to deserialize
+ * @param arg_<xsl:value-of select="$CName"/><xsl:text> </xsl:text> <xsl:value-of select="$paramComment"/>
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
axis2_status_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_deserialize(
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env, axiom_node_t** parent);
-
- <!-- Here the double pointer is used to change the parent pointer - This can be happned when deserialize is called in a particle class -->
+ const axutil_env_t *env,
+ <xsl:value-of select="$constValue"/><xsl:value-of select="$propertyType"/><xsl:text> </xsl:text> arg_<xsl:value-of select="$CName"/>);
- /**
- * Declare namespace in the most parent node
- * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/><xsl:text> </xsl:text> <xsl:value-of select="$axis2_name"/>_t object
+ /**
+ * Resetter for <xsl:value-of select="$propertyName"/>
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
- * @param parent_element parent element
- * @param namespaces hash of namespace uri to prefix
- * @param next_ns_index pointer to an int which contain the next namespace index
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
- void AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_declare_parent_namespaces(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env, axiom_element_t *parent_element,
- axutil_hash_t *namespaces, int *next_ns_index);
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_reset_<xsl:value-of select="$CName"/>(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
+
+ </xsl:for-each>
+
+ <!-- The following take care of list items -->
+
+ <xsl:for-each select="itemtype">
+ <xsl:variable name="propertyType">axutil_array_list_t*</xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="$name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="$name"></xsl:value-of></xsl:variable>
+
+ <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="PropertyTypeArrayParam"> <!--these are used in arrays to take the type stored in the arraylist-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:when test="@type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="paramComment"><xsl:text>Array of </xsl:text><xsl:value-of select="$PropertyTypeArrayParam"/><xsl:text>s.</xsl:text></xsl:variable>
+ <xsl:variable name="constValue">
+ <xsl:choose>
+ <xsl:when test="@type='axis2_char_t*' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'">const </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
- <xsl:if test="@simple">
/**
- * Serialize to a String from the adb objects
+ * Getter for <xsl:value-of select="$propertyName"/>. Deprecated for array types, Use <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>_at instead
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
- * @param namespaces hash of namespace uri to prefix
- * @return serialized string
+ * @return <xsl:value-of select="$paramComment"/>
*/
- axis2_char_t* AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_serialize_to_string(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env, axutil_hash_t *namespaces);
- </xsl:if>
+ <xsl:value-of select="$propertyType"/> AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
/**
- * Serialize to an XML from the adb objects
+ * Setter for <xsl:value-of select="$propertyName"/>. Deprecated for array types, Use <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_at
+ * or <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/> instead.
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
- * @param <xsl:value-of select="$name"/>_om_node node to serialize from
- * @param <xsl:value-of select="$name"/>_om_element parent element to serialize from
- * @param tag_closed whether the parent tag is closed or not
- * @param namespaces hash of namespace uri to prefix
- * @param next_ns_index an int which contain the next namespace index
+ * @param arg_<xsl:value-of select="$CName"/><xsl:text> </xsl:text> <xsl:value-of select="$paramComment"/>
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
- axiom_node_t* AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_serialize(
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env,
- axiom_node_t* <xsl:value-of select="$name"/>_om_node, axiom_element_t *<xsl:value-of select="$name"/>_om_element, int tag_closed, axutil_hash_t *namespaces, int *next_ns_index);
+ <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text> arg_<xsl:value-of select="$CName"/>);
/**
- * Check whether the <xsl:value-of select="$axis2_name"/> is a particle class (E.g. A group)
- * @return whether this is a particle class.
+ * Resetter for <xsl:value-of select="$propertyName"/>
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_reset_<xsl:value-of select="$CName"/>(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
+
+ </xsl:for-each>
+
+
+ <xsl:if test="count(property[@array])!=0 or count(itemtype)!=0">
+ /****************************** Getters and Setters For Arrays **********************************/
+ /************ Array Specific Operations: get_at, set_at, add, remove_at, sizeof *****************/
+
+ /**
+ * E.g. use of get_at, set_at, add and sizeof
+ *
+ * for(i = 0; i < adb_element_sizeof_property(adb_object, env); i ++ )
+ * {
+ * // Getting ith value to property_object variable
+ * property_object = adb_element_get_property_at(adb_object, env, i);
+ *
+ * // Setting ith value from property_object variable
+ * adb_element_set_property_at(adb_object, env, i, property_object);
+ *
+ * // Appending the value to the end of the array from property_object variable
+ * adb_element_add_property(adb_object, env, property_object);
+ *
+ * // Removing the ith value from an array
+ * adb_element_remove_property_at(adb_object, env, i);
+ *
+ * }
+ *
*/
- axis2_bool_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_is_particle();
+ </xsl:if>
<xsl:for-each select="property">
<xsl:variable name="propertyType">
@@ -234,7 +339,7 @@
<xsl:choose>
<xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
<xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+ <xsl:when test="@type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
<xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -244,73 +349,111 @@
<xsl:otherwise><xsl:value-of select="$nativePropertyType"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
+ <xsl:variable name="constValue">
+ <xsl:choose>
+ <xsl:when test="@type='axis2_char_t*' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'">const </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+
+ <xsl:if test="@isarray">
+
/**
- * Getter for <xsl:value-of select="$propertyName"/>. <xsl:if test="@isarray">Deprecated for array types, Use <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>_at instead</xsl:if>
+ * Get the ith element of <xsl:value-of select="$propertyName"/>.
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
- * @return <xsl:value-of select="$paramComment"/>
+ * @param i index of the item to return
+ * @return ith <xsl:value-of select="$nativePropertyType"/> of the array
*/
- <xsl:value-of select="$propertyType"/> AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env);
+ <xsl:value-of select="$nativePropertyType"/> AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>_at(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env, int i);
/**
- * Setter for <xsl:value-of select="$propertyName"/>.<xsl:if test="@isarray">Deprecated for array types, Use <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_at
- * or <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/> instead.</xsl:if>
+ * Set the ith element of <xsl:value-of select="$propertyName"/>. (If the ith already exist, it will be replaced)
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
- * @param arg_<xsl:value-of select="$CName"/><xsl:text> </xsl:text> <xsl:value-of select="$paramComment"/>
- * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ * @param i index of the item to return
+ * @param <xsl:text>arg_</xsl:text> <xsl:value-of select="$CName"/> element to set <xsl:value-of select="$nativePropertyType"/> to the array
+ * @return ith <xsl:value-of select="$nativePropertyType"/> of the array
*/
axis2_status_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env,
- <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text> arg_<xsl:value-of select="$CName"/>);
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_at(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env, int i,
+ <xsl:value-of select="$constValue"/><xsl:value-of select="$nativePropertyType"/><xsl:text> arg_</xsl:text> <xsl:value-of select="$CName"/>);
+
/**
- * Resetter for <xsl:value-of select="$propertyName"/>
+ * Add to <xsl:value-of select="$propertyName"/>.
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
+ * @param <xsl:text>arg_</xsl:text> <xsl:value-of select="$CName"/> element to add <xsl:value-of select="$nativePropertyType"/> to the array
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
axis2_status_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_reset_<xsl:value-of select="$CName"/>(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env);
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env,
+ <xsl:value-of select="$constValue"/><xsl:value-of select="$nativePropertyType"/><xsl:text> arg_</xsl:text> <xsl:value-of select="$CName"/>);
-
/**
- * Check whether <xsl:value-of select="$propertyName"/> is nill
+ * Get the size of the <xsl:value-of select="$propertyName"/> array.
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
- * @param env pointer to environment struct
- * @return AXIS2_TRUE if the element is nil or AXIS2_FALSE otherwise
+ * @param env pointer to environment struct.
+ * @return the size of the <xsl:value-of select="$propertyName"/> array.
*/
- axis2_bool_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_is_<xsl:value-of select="$CName"/>_nil(
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env);
-
+ int AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_sizeof_<xsl:value-of select="$CName"/>(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
- <xsl:if test="@nillable or @optional">
/**
- * Set <xsl:value-of select="$propertyName"/> to nill (currently the same as reset)
+ * Remove the ith element of <xsl:value-of select="$propertyName"/>.
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
+ * @param i index of the item to remove
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
axis2_status_t AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_nil(
+ <xsl:value-of select="$axis2_name"/>_remove_<xsl:value-of select="$CName"/>_at(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env);
- </xsl:if>
+ const axutil_env_t *env, int i);
+ </xsl:if> <!-- xsl:if test="@isarray" -->
+ </xsl:for-each> <!-- xsl:for-each select="property" -->
- <xsl:if test="@isarray">
+ <!-- The section covers the list types -->
+ <xsl:for-each select="itemtype">
+ <xsl:variable name="propertyType">axutil_array_list_t*</xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="$name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="$name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="PropertyTypeArrayParam"> <!--these are used in arrays to take the type stored in the arraylist-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:when test="@type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="paramComment"><xsl:text>Array of </xsl:text><xsl:value-of select="$PropertyTypeArrayParam"/><xsl:text>s.</xsl:text></xsl:variable>
+ <xsl:variable name="constValue">
+ <xsl:choose>
+ <xsl:when test="@type='axis2_char_t*' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'">const </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
/**
- * Get ith element of <xsl:value-of select="$propertyName"/>.
+ * Get the ith element of <xsl:value-of select="$propertyName"/>.
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
* @param i index of the item to return
@@ -322,7 +465,7 @@
const axutil_env_t *env, int i);
/**
- * Set ith element of <xsl:value-of select="$propertyName"/>.
+ * Set the ith element of <xsl:value-of select="$propertyName"/>. (If the ith already exist, it will be replaced)
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct
* @param i index of the item to return
@@ -333,7 +476,7 @@
<xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_at(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env, int i,
- <xsl:value-of select="$nativePropertyType"/><xsl:text> arg_</xsl:text> <xsl:value-of select="$CName"/>);
+ <xsl:value-of select="$constValue"/><xsl:value-of select="$nativePropertyType"/><xsl:text> arg_</xsl:text> <xsl:value-of select="$CName"/>);
/**
@@ -347,7 +490,7 @@
<xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env,
- <xsl:value-of select="$nativePropertyType"/><xsl:text> arg_</xsl:text> <xsl:value-of select="$CName"/>);
+ <xsl:value-of select="$constValue"/><xsl:value-of select="$nativePropertyType"/><xsl:text> arg_</xsl:text> <xsl:value-of select="$CName"/>);
/**
* Get the size of the <xsl:value-of select="$propertyName"/> array.
@@ -361,6 +504,133 @@
const axutil_env_t *env);
/**
+ * Remove the ith element of <xsl:value-of select="$propertyName"/>.
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @param i index of the item to remove
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_remove_<xsl:value-of select="$CName"/>_at(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env, int i);
+
+
+ </xsl:for-each>
+
+
+ /******************************* Checking and Setting NIL values *********************************/
+ <xsl:if test="count(property[@array])!=0">/* Use 'Checking and Setting NIL values for Arrays' to check and set nil for individual elements */</xsl:if>
+
+ /**
+ * NOTE: set_nil is only available for nillable properties
+ */
+
+ <xsl:for-each select="property">
+ <xsl:variable name="propertyType">
+ <xsl:choose>
+ <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
+
+ <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="PropertyTypeArrayParam"> <!--these are used in arrays to take the type stored in the arraylist-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:when test="@type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="paramComment">
+ <xsl:choose>
+ <xsl:when test="@isarray"><xsl:text>Array of </xsl:text><xsl:value-of select="$PropertyTypeArrayParam"/><xsl:text>s.</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$nativePropertyType"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ /**
+ * Check whether <xsl:value-of select="$propertyName"/> is nill
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @return AXIS2_TRUE if the element is nil or AXIS2_FALSE otherwise
+ */
+ axis2_bool_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_is_<xsl:value-of select="$CName"/>_nil(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
+
+
+ <xsl:if test="@nillable or @optional">
+ /**
+ * Set <xsl:value-of select="$propertyName"/> to nill (currently the same as reset)
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_nil(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env);
+ </xsl:if>
+
+ </xsl:for-each> <!-- for-each select="proprety" -->
+
+ <xsl:if test="count(property[@array])!=0">
+ /*************************** Checking and Setting 'NIL' values in Arrays *****************************/
+
+ /**
+ * NOTE: You may set this to remove specific elements in the array
+ * But you can not remove elements, if the specific property is declared to be non-nillable or sizeof(array) < minOccurs
+ */
+ </xsl:if>
+
+ <xsl:for-each select="property">
+ <xsl:variable name="propertyType">
+ <xsl:choose>
+ <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
+
+ <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="PropertyTypeArrayParam"> <!--these are used in arrays to take the type stored in the arraylist-->
+ <xsl:choose>
+ <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+ <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+ <xsl:when test="@type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @type='unsigned char' or @type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="paramComment">
+ <xsl:choose>
+ <xsl:when test="@isarray"><xsl:text>Array of </xsl:text><xsl:value-of select="$PropertyTypeArrayParam"/><xsl:text>s.</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$nativePropertyType"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="@isarray">
+ /**
* Check whether <xsl:value-of select="$propertyName"/> is nill at i
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
* @param env pointer to environment struct.
@@ -371,9 +641,8 @@
<xsl:value-of select="$axis2_name"/>_is_<xsl:value-of select="$CName"/>_nil_at(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env, int i);
-
+
- <xsl:if test="@nillable or @optional">
/**
* Set <xsl:value-of select="$propertyName"/> to nill at i
* @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> _<xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
@@ -385,10 +654,101 @@
<xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_nil_at(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env, int i);
- </xsl:if>
</xsl:if> <!-- closes isarray -->
- </xsl:for-each>
+ </xsl:for-each>
+
+ /**************************** Serialize and Deserialize functions ***************************/
+ /*********** These functions are for use only inside the generated code *********************/
+
+ <xsl:if test="@simple">
+ /**
+ * Deserialize the content from a string to adb objects
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/><xsl:text> </xsl:text> <xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @param node_value to deserialize
+ * @param parent_element The parent element if it is an element, NULL otherwise
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_deserialize_from_string(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env,
+ axis2_char_t *node_value,
+ axiom_node_t *parent);
+ </xsl:if>
+ /**
+ * Deserialize an XML to adb objects
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @param dp_parent double pointer to the parent node to deserialize
+ * @param dp_is_early_node_valid double pointer to a flag (is_early_node_valid?)
+ * @param dont_care_minoccurs Dont set errors on validating minoccurs,
+ * (Parent will order this in a case of choice)
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ axis2_status_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_deserialize(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env,
+ axiom_node_t** dp_parent,
+ axis2_bool_t *dp_is_early_node_valid,
+ axis2_bool_t dont_care_minoccurs);
+
+ <!-- Here the double pointer is used to change the parent pointer - This can be happned when deserialize is called in a particle class -->
+
+ /**
+ * Declare namespace in the most parent node
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/><xsl:text> </xsl:text> <xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @param parent_element parent element
+ * @param namespaces hash of namespace uri to prefix
+ * @param next_ns_index pointer to an int which contain the next namespace index
+ */
+ void AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_declare_parent_namespaces(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env, axiom_element_t *parent_element,
+ axutil_hash_t *namespaces, int *next_ns_index);
+
+ <xsl:if test="@simple">
+ /**
+ * Serialize to a String from the adb objects
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @param namespaces hash of namespace uri to prefix
+ * @return serialized string
+ */
+ axis2_char_t* AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_serialize_to_string(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env, axutil_hash_t *namespaces);
+ </xsl:if>
+
+ /**
+ * Serialize to an XML from the adb objects
+ * @param <xsl:text> _</xsl:text><xsl:value-of select="$name"/> <xsl:text> </xsl:text><xsl:value-of select="$axis2_name"/>_t object
+ * @param env pointer to environment struct
+ * @param <xsl:value-of select="$name"/>_om_node node to serialize from
+ * @param <xsl:value-of select="$name"/>_om_element parent element to serialize from
+ * @param tag_closed whether the parent tag is closed or not
+ * @param namespaces hash of namespace uri to prefix
+ * @param next_ns_index an int which contain the next namespace index
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ axiom_node_t* AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_serialize(
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+ const axutil_env_t *env,
+ axiom_node_t* <xsl:value-of select="$name"/>_om_node, axiom_element_t *<xsl:value-of select="$name"/>_om_element, int tag_closed, axutil_hash_t *namespaces, int *next_ns_index);
+
+ /**
+ * Check whether the <xsl:value-of select="$axis2_name"/> is a particle class (E.g. group, inner sequence)
+ * @return whether this is a particle class.
+ */
+ axis2_bool_t AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_is_particle();
+
#ifdef __cplusplus
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org