axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susan...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info Type.java
Date Wed, 17 Mar 2004 07:29:54 GMT
susantha    2004/03/16 23:29:54

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws CUtils.java
                        WSDL2Ws.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        ClientStubWriter.java ParmHeaderFileWriter.java
                        WrapWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info Type.java
  Log:
  Handling schema defined simpleTypes with enumerations
  
  Revision  Changes    Path
  1.8       +20 -3     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CUtils.java	16 Mar 2004 14:04:11 -0000	1.7
  +++ CUtils.java	17 Mar 2004 07:29:53 -0000	1.8
  @@ -83,6 +83,7 @@
   	   complex types are done with in the type class */
   	private static Hashtable class2QNamemap = new Hashtable();
   	private static Hashtable qname2classmap = new Hashtable();
  +	private static Hashtable schemaDefinedSimpleTypesMap = new Hashtable();
   	private static Hashtable type2getValueMethodName = new Hashtable();
   	private static Hashtable type2BasicArrayName = new Hashtable();
   	private static Hashtable basicType2EnumMap = new Hashtable();
  @@ -192,6 +193,16 @@
   		basicType2EnumMap.put("xsd__QName","XSD_QNAME");
   	}
   	
  +	public static void addSchemaDefinedSimpleType(QName qname, String type){
  +		schemaDefinedSimpleTypesMap.put(qname, type);
  +	}
  +	
  +	public static boolean isBasicType(QName qname){
  +		if(qname2classmap.containsKey(qname)){
  +			return true;
  +		}
  +		return false;
  +	}
   	public static boolean isSimpleType(String name){
   		if(class2QNamemap.containsKey(name))
   			return true;
  @@ -199,8 +210,12 @@
   	} 
   
   	public static boolean isSimpleType(QName name){
  -		if(qname2classmap.containsKey(name))
  +		if(qname2classmap.containsKey(name)){
  +			return true;
  +		}
  +		else if (schemaDefinedSimpleTypesMap.containsKey(name)){
   			return true;
  +		}
   		return false;	
   	} 
   
  @@ -226,8 +241,10 @@
   		Object val = qname2classmap.get(qname);
   		if (val != null)
   			return (String) val;
  -		else
  -			return null;
  +		val = schemaDefinedSimpleTypesMap.get(qname);
  +		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.20      +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
  
  Index: WSDL2Ws.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- WSDL2Ws.java	16 Mar 2004 14:04:11 -0000	1.19
  +++ WSDL2Ws.java	17 Mar 2004 07:29:53 -0000	1.20
  @@ -471,7 +471,7 @@
   			if (null == type.getRefType())throw new WrapperFault("Array type found without a Ref
type");
   			QName qn = type.getRefType().getQName();
   			if (null == qn)throw new WrapperFault("Array type found without a Ref type");
  -			if (CUtils.isSimpleType(qn)) return null;
  +			if (CUtils.isBasicType(qn)) return null;
   			QName newqn = new QName(type.getQName().getNamespaceURI(), qn.getLocalPart()+"_Array");
   			typedata = new Type(newqn, newqn.getLocalPart(), true, targetLanguage);
   			typeMap.addType(newqn, typedata);
  
  
  
  1.11      +30 -5     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ClientStubWriter.java	16 Mar 2004 14:04:12 -0000	1.10
  +++ ClientStubWriter.java	17 Mar 2004 07:29:53 -0000	1.11
  @@ -191,7 +191,12 @@
   		if (returntype != null)
   			retType = wscontext.getTypemap().getType(returntype.getSchemaName());
   		if (retType != null){
  -			outparamType = retType.getLanguageSpecificName();
  +			if (retType.isSimpleType()){
  +				outparamType = CUtils.getclass4qname(retType.getBaseType());	
  +			}
  +			else{
  +				outparamType = retType.getLanguageSpecificName();
  +			}
   			returntypeisarray = retType.isArray();
   		}
   		else if (returntype != null){
  @@ -220,7 +225,12 @@
   		if (0 < paramsB.size()){
   			type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(0)).getSchemaName());
   			if (type != null){
  -				paraTypeName = type.getLanguageSpecificName();
  +				if (type.isSimpleType()){ //schema defined simpleType
  +					paraTypeName = 	CUtils.getclass4qname(type.getBaseType());
  +				}
  +				else{
  +					paraTypeName = type.getLanguageSpecificName();
  +				}
   				typeisarray = type.isArray();
   			}
   			else {
  @@ -236,7 +246,12 @@
   			for (int i = 1; i < paramsB.size(); i++) {
   				type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
   				if (type != null){
  -					paraTypeName = type.getLanguageSpecificName();
  +					if (type.isSimpleType()){ //schema defined simpleType
  +						paraTypeName = 	CUtils.getclass4qname(type.getBaseType());
  +					}
  +					else{
  +						paraTypeName = type.getLanguageSpecificName();
  +					}
   					typeisarray = type.isArray();
   				}
   				else {
  @@ -290,7 +305,12 @@
   		for (int i = 0; i < paramsB.size(); i++) {
   			type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
   			if (type != null){
  -				paraTypeName = type.getLanguageSpecificName();
  +				if (type.isSimpleType()){//schema defined simpleType possibly with restrictions
  +					paraTypeName = CUtils.getclass4qname(type.getBaseType());
  +				}
  +				else{
  +					paraTypeName = type.getLanguageSpecificName();
  +				}
   				typeisarray = type.isArray();
   			}
   			else {
  @@ -339,7 +359,12 @@
   				ParameterInfo currentType = (ParameterInfo)paramsC.get(i);
   				type = wscontext.getTypemap().getType(currentType.getSchemaName());
   				if (type != null){
  -					currentParaType = type.getLanguageSpecificName();
  +					if (type.isSimpleType()){
  +						currentParaType = CUtils.getclass4qname(type.getBaseType());
  +					}
  +					else{
  +						currentParaType = type.getLanguageSpecificName();
  +					}
   					typeisarray = type.isArray();
   				}
   				else {
  
  
  
  1.6       +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
  
  Index: ParmHeaderFileWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ParmHeaderFileWriter.java	16 Mar 2004 14:17:02 -0000	1.5
  +++ ParmHeaderFileWriter.java	17 Mar 2004 07:29:53 -0000	1.6
  @@ -138,7 +138,7 @@
   						QName value = (QName)restrictionData.elementAt(i);
   						if ("enumeration".equals(value.getLocalPart())){
   							if (i>1) writer.write(", ");
  -							writer.write(value.getNamespaceURI());		
  +							writer.write("ENUM"+classname.toUpperCase()+"="+value.getNamespaceURI());		
   						}
   					}
   					writer.write("} "+classname+";\n");
  
  
  
  1.12      +32 -9     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
  
  Index: WrapWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WrapWriter.java	16 Mar 2004 14:04:12 -0000	1.11
  +++ WrapWriter.java	17 Mar 2004 07:29:53 -0000	1.12
  @@ -230,13 +230,20 @@
   		if (returntype != null){
   			retType = wscontext.getTypemap().getType(returntype.getSchemaName());
   			if (retType != null){
  -				outparamType = retType.getLanguageSpecificName();
  -				returntypeisarray = retType.isArray();
  +				if (retType.isSimpleType()){ //schema defined simpleType possibly with restrictions
  +					returntypeissimple = true;
  +					outparamType = CUtils.getclass4qname(retType.getBaseType()); 
  +				}
  +				else{
  +					outparamType = retType.getLanguageSpecificName();
  +					returntypeisarray = retType.isArray();
  +					returntypeissimple = CUtils.isSimpleType(outparamType);
  +				}
   			}
   			else{
   				outparamType = returntype.getLangName();
  +				returntypeissimple = CUtils.isSimpleType(outparamType);
   			}
  -			returntypeissimple = CUtils.isSimpleType(outparamType);
   		}
   		writer.write("\n/*\n");
   		writer.write(" * This method wrap the service method \n");
  @@ -261,13 +268,22 @@
   		String returnParamName;
   		ArrayList paramsB = new ArrayList(params);
   		for (int i = 0; i < paramsB.size(); i++) {
  -			paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
  +			type = this.wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
  +			if (type.isSimpleType()){ //schema defined simpleType possibly with restrictions
  +				paraTypeName = CUtils.getclass4qname(type.getBaseType());;
  +			}
  +			else{
  +				paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
  +			}
   			parameterName = ((ParameterInfo)paramsB.get(i)).getParamName();
   			elementName = ((ParameterInfo)paramsB.get(i)).getElementName().getLocalPart();
  -			if((CUtils.isSimpleType(((ParameterInfo)paramsB.get(i)).getLangName()))){
  +			if (type.isSimpleType()){ //schema defined simpleType possibly with restrictions
  +				writer.write("\t"+paraTypeName+" v"+i+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(paraTypeName,
false)+"(\""+elementName+"\",0);\n");
  +			}
  +			else if((CUtils.isSimpleType(((ParameterInfo)paramsB.get(i)).getLangName()))){
   				//for simple types	
   				writer.write("\t"+paraTypeName+" v"+i+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(paraTypeName,
false)+"(\""+elementName+"\",0);\n");
  -			}else if((type = this.wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName()))
!= null && type.isArray()){
  +			}else if((type != null) && type.isArray()){
   				Type arrayType = WrapperUtils.getArrayType(type);
   				QName qname = arrayType.getName();
   				String containedType = null;
  @@ -353,13 +369,20 @@
   			for (int i = 0; i < paramsC.size(); i++) {
   				retType = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
   				if (retType != null){
  -					outparamType = retType.getLanguageSpecificName();
  -					returntypeisarray = retType.isArray();
  +					if (retType.isSimpleType()){
  +						returntypeissimple = true;
  +						outparamType = CUtils.getclass4qname(retType.getBaseType()); 
  +					}
  +					else{
  +						outparamType = retType.getLanguageSpecificName();
  +						returntypeisarray = retType.isArray();
  +						returntypeissimple = CUtils.isSimpleType(outparamType);
  +					}
   				}
   				else{
   					outparamType = returntype.getLangName();
  +					returntypeissimple = CUtils.isSimpleType(outparamType);
   				}
  -				returntypeissimple = CUtils.isSimpleType(outparamType);
   				returnParamName = ((ParameterInfo)paramsC.get(i)).getElementName().getLocalPart();
   				if (returntypeissimple){
   					writer.write("\tpIWSSZ->AddOutputParam(\""+returnParamName+"\", (void*)&out"+i+",
"+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
  
  
  
  1.12      +3 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Type.java	16 Mar 2004 14:04:12 -0000	1.11
  +++ Type.java	17 Mar 2004 07:29:54 -0000	1.12
  @@ -308,8 +308,10 @@
   		if (vector != null){
   			isSimpleType = true;
   			BaseType basetype = (BaseType)vector.firstElement();
  -			if (basetype != null)
  +			if (basetype != null){
   				setBaseType(basetype.getQName());
  +				CUtils.addSchemaDefinedSimpleType(name, CUtils.getclass4qname(baseType));
  +			}
   	        enumerationdata = vector;
   		}
       }
  
  
  

Mime
View raw message