axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal ClientStubWriter.java
Date Fri, 08 Oct 2004 11:28:22 GMT
samisa      2004/10/08 04:28:22

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws CUtils.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp
                        ClientStubWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        ClientStubWriter.java
  Log:
  Resolved AXISCPP-64 by including init logic for simple types
  
  Revision  Changes    Path
  1.23      +37 -0     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
  
  Index: CUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CUtils.java	1 Oct 2004 07:04:08 -0000	1.22
  +++ CUtils.java	8 Oct 2004 11:28:22 -0000	1.23
  @@ -44,6 +44,7 @@
   	/* This type mapping only maps simple types the mapping for
   	   complex types are done with in the type class */
   	private static Hashtable class2QNamemap = new Hashtable();
  +	private static Hashtable initValues = new Hashtable();
   	private static Hashtable qname2classmap = new Hashtable();
   	private static Hashtable schemaDefinedSimpleTypesMap = new Hashtable();
   	private static Hashtable type2getValueMethodName = new Hashtable();
  @@ -75,6 +76,7 @@
   		class2QNamemap.put("xsd__unsignedShort", new QName(WrapperConstants.SCHEMA_NAMESPACE,
"unsignedShort"));
   		class2QNamemap.put("xsd__QName", new QName(WrapperConstants.SCHEMA_NAMESPACE, "QName"));
   		class2QNamemap.put("xsd__NMTOKEN", new QName(WrapperConstants.SCHEMA_NAMESPACE,"NMTOKEN"));
  +
   		qname2classmap.put(new QName(WrapperConstants.SCHEMA_NAMESPACE, "int"), "int");
   		qname2classmap.put(new QName(WrapperConstants.SCHEMA_NAMESPACE, "byte"), "unsigned char");
   		qname2classmap.put(new QName(WrapperConstants.SCHEMA_NAMESPACE, "float"), "float");
  @@ -196,6 +198,32 @@
   		basicType2EnumMap.put("xsd__anyURI","XSD_ANYURI");
   		basicType2EnumMap.put("xsd__QName","XSD_QNAME");
   		basicType2EnumMap.put("xsd__NMTOKEN","XSD_NMTOKEN");
  +
  +
  +		initValues.put("int", "0"); 
  +		initValues.put("unsigned char", "0"); 
  +		initValues.put("float", "0.0"); 
  +		initValues.put("long", "0"); 
  +		initValues.put("long", "0"); 
  +		initValues.put("double", "0.0"); 
  +		initValues.put("char", "0"); 
  +		initValues.put("short", "0"); 
  +		initValues.put("xsd__string", "NULL"); 
  +		//initValues.put("xsd__dateTime", "0"); 
  +		//initValues.put("xsd__date", "0"); 
  +		//initValues.put("xsd__time", "0"); 
  +		//initValues.put("xsd__base64Binary", "0"); 
  +		//initValues.put("xsd__hexBinary", "0"); 
  +		initValues.put("xsd__decimal", "0.0"); 
  +		initValues.put("xsd__boolean", "false_"); 
  +		initValues.put("xsd__byte", "0"); 
  +		initValues.put("xsd__anyURI", "NULL"); 
  +		initValues.put("xsd__unsignedByte", "0"); 
  +		initValues.put("xsd__unsignedInt", "0"); 
  +		initValues.put("xsd__unsignedLong", "0"); 
  +		initValues.put("xsd__unsignedShort", "0"); 
  +		initValues.put("xsd__QName", "NULL"); 
  +		initValues.put("xsd__NMTOKEN", "NULL"); 
   	}
   	
   	public static void addSchemaDefinedSimpleType(QName qname, String type){
  @@ -256,6 +284,15 @@
   			return (String) val;
   		return null;
   	}
  +
  +	 public static String getInitValue(String typeName) {
  +		Object val = initValues.get(typeName);
  +		if (val != null)
  +			return (String) val;
  +                
  +		return null;
  +	}
  +        
   	public static String getWebServiceNameFromWrapperName(String wname){
   		return wname.substring(0, wname.length()- CUtils.WRAPPER_NAME_APPENDER.length());
   	}
  
  
  
  1.54      +13 -1     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- ClientStubWriter.java	8 Sep 2004 06:41:14 -0000	1.53
  +++ ClientStubWriter.java	8 Oct 2004 11:28:22 -0000	1.54
  @@ -238,7 +238,19 @@
   				//for complex types
   			}else{
   				//for simple types
  -				writer.write(outparamTypeName+" Ret;\n");
  +                                String initValue = CUtils.getInitValue(outparamTypeName);
  +                                if (initValue != null)
  +				    writer.write(outparamTypeName+" Ret = " + initValue + ";\n");
  +				else if (outparamTypeName.equals("xsd__base64Binary") || outparamTypeName.equals("xsd__hexBinary"))
  +                                {
  +                                    writer.write(outparamTypeName+" Ret;\n");
  +                                    writer.write("\tRet.__ptr = NULL;\n");
  +                                    writer.write("\tRet.__size = 0;\n");
  +                                }
  +
  +				else
  +				    writer.write(outparamTypeName+" Ret;\n");
  +				    
   				//TODO initialize return parameter appropriately.
   			}
   		}
  
  
  
  1.44      +12 -1     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- ClientStubWriter.java	29 Sep 2004 10:38:50 -0000	1.43
  +++ ClientStubWriter.java	8 Oct 2004 11:28:22 -0000	1.44
  @@ -284,7 +284,18 @@
   				//for complex types
   			}else{
   				//for simple types
  -				writer.write(outparamType+" Ret;\n");
  +				String initValue = CUtils.getInitValue(outparamType);
  +                                if (initValue != null)
  +                                    writer.write(outparamType+" Ret = " + initValue + ";\n");
  +                                else if (outparamType.equals("xsd__base64Binary") || outparamType.equals("xsd__hexBinary"))
  +                                {
  +       				    writer.write(outparamType+" Ret;\n");
  +				    writer.write("\tRet.__ptr = NULL;\n");	
  +				    writer.write("\tRet.__size = 0;\n");	
  +				}
  +				else
  +                                    writer.write(outparamType+" Ret;\n");
  +
   				//TODO initialize return parameter appropriately.
   			}
   		}
  
  
  

Mime
View raw message