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 Tue, 16 Mar 2004 14:04:12 GMT
susantha    2004/03/16 06:04:12

  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 WrapWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info Type.java
  Log:
  WSDL2Ws tool improvements to handle SimpleType and enumerations - few more fixes
  
  Revision  Changes    Path
  1.7       +2 -1      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CUtils.java	16 Mar 2004 08:26:28 -0000	1.6
  +++ CUtils.java	16 Mar 2004 14:04:11 -0000	1.7
  @@ -63,7 +63,6 @@
   
   import java.util.Hashtable;
   import javax.xml.namespace.QName;
  -import org.apache.axis.wsdl.wsdl2ws.WrapperConstants;
   import java.util.Vector;
   import org.w3c.dom.Node;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
  @@ -73,6 +72,7 @@
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
   import javax.xml.rpc.holders.BooleanHolder;
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  +import org.apache.axis.wsdl.wsdl2ws.info.Type;
   import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
   
   public class CUtils {
  @@ -246,6 +246,7 @@
   		}
   		return arrayName;		
   	}
  +	
   	public static String getBasicArrayNameforType(String stype){
   		if (type2BasicArrayName.containsKey(stype))
   			return (String)type2BasicArrayName.get(stype);
  
  
  
  1.19      +0 -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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- WSDL2Ws.java	16 Mar 2004 08:26:28 -0000	1.18
  +++ WSDL2Ws.java	16 Mar 2004 14:04:11 -0000	1.19
  @@ -491,7 +491,6 @@
   			typedata.setTypeNameForElementName(new ElementInfo(type.getQName(),
   					createTypeInfo(type.getRefType().getQName(),targetLanguage)));
   			typedata.setArray(true);
  -			typedata.setCanThisOccuredmoreThanOnceAllTheTime(true);		
   		}else{
   			//is this a SOAPEnc array type	
   			QName arrayType =
  
  
  
  1.10      +14 -2     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ClientStubWriter.java	16 Mar 2004 08:26:28 -0000	1.9
  +++ ClientStubWriter.java	16 Mar 2004 14:04:12 -0000	1.10
  @@ -300,13 +300,19 @@
   			typeissimple = CUtils.isSimpleType(paraTypeName);
   			if(typeisarray){
   				//arrays
  -				QName qname = WrapperUtils.getArrayType(type).getName();
  +				Type arrayType = WrapperUtils.getArrayType(type);
  +				QName qname = arrayType.getName();
   				String containedType = null;
   				if (CUtils.isSimpleType(qname)){
   					containedType = CUtils.getclass4qname(qname);
   					writer.write("\tm_pCall->AddBasicArrayParameter(");			
   					writer.write("(Axis_Array*)(&Value"+i+"), "+CUtils.getXSDTypeForBasicType(containedType)+",
\""+((ParameterInfo)paramsB.get(i)).getParamName()+"\"");					
   				}
  +				else if (arrayType.isSimpleType()){//SimpleType in the schema 
  +					containedType = CUtils.getclass4qname(arrayType.getBaseType());
  +					writer.write("\tm_pCall->AddBasicArrayParameter(");			
  +					writer.write("(Axis_Array*)(&Value"+i+"), "+CUtils.getXSDTypeForBasicType(containedType)+",
\""+((ParameterInfo)paramsB.get(i)).getParamName()+"\"");					
  +				}
   				else{
   					containedType = qname.getLocalPart();
   					writer.write("\tm_pCall->AddCmplxArrayParameter(");			
  @@ -345,12 +351,17 @@
   				currentParamName = "*OutValue"+i;
   				// Some code need to be merged as we have some duplicated in coding here.
   				if (typeisarray){
  -					QName qname = WrapperUtils.getArrayType(type).getName();
  +					Type arrayType = WrapperUtils.getArrayType(type);
  +					QName qname = arrayType.getName();
   					String containedType = null;
   					if (CUtils.isSimpleType(qname)){
   						containedType = CUtils.getclass4qname(qname);
   						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+",
\""+currentType.getElementName().getLocalPart()+"\", 0);\n");
   					}
  +					else if (arrayType.isSimpleType()){//SimpleType in the schema 
  +						containedType = CUtils.getclass4qname(arrayType.getBaseType());
  +						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+",
\""+currentType.getElementName().getLocalPart()+"\", 0);\n");
  +					}
   					else{
   						containedType = qname.getLocalPart();
   						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetCmplxArray((void*)
Axis_DeSerialize_"+containedType);
  @@ -412,6 +423,7 @@
   		try {
   			while(types.hasNext()){
   				type = (Type)types.next();
  +				if (type.isSimpleType()) continue;
   				if (type.isArray()) continue;
   				typeName = type.getLanguageSpecificName();
   				if (typeName.startsWith(">")) continue;
  
  
  
  1.11      +19 -3     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WrapWriter.java	16 Mar 2004 08:26:28 -0000	1.10
  +++ WrapWriter.java	16 Mar 2004 14:04:12 -0000	1.11
  @@ -268,12 +268,17 @@
   				//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()){
  -				QName qname = WrapperUtils.getArrayType(type).getName();
  +				Type arrayType = WrapperUtils.getArrayType(type);
  +				QName qname = arrayType.getName();
   				String containedType = null;
   				if (CUtils.isSimpleType(qname)){
   					containedType = CUtils.getclass4qname(qname);
   					writer.write("\t"+paraTypeName+" v"+i+" = ("+CUtils.getBasicArrayNameforType(containedType)+"&)pIWSDZ->GetBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+
", \""+elementName+"\",0);\n");
   				}
  +				else if (arrayType.isSimpleType()){//SimpleType in the schema 
  +					containedType = CUtils.getclass4qname(arrayType.getBaseType());
  +					writer.write("\t"+paraTypeName+" v"+i+" = ("+CUtils.getBasicArrayNameforType(containedType)+"&)pIWSDZ->GetBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+
", \""+elementName+"\",0);\n");
  +				}
   				else{
   					containedType = qname.getLocalPart();
   					writer.write("\t"+paraTypeName+" v"+i+" = ("+paraTypeName+"&)pIWSDZ->GetCmplxArray((void*)Axis_DeSerialize_"+containedType+

  @@ -310,12 +315,17 @@
   			if (returntypeissimple){
   				writer.write("\treturn pIWSSZ->AddOutputParam(\""+returnParamName+"\", (void*)&ret,
"+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
   			}else if(returntypeisarray){
  -				QName qname = WrapperUtils.getArrayType(retType).getName();
  +				Type arrayType = WrapperUtils.getArrayType(retType);
  +				QName qname = arrayType.getName();
   				String containedType = null;
   				if (CUtils.isSimpleType(qname)){
   					containedType = CUtils.getclass4qname(qname);
   					writer.write("\treturn pIWSSZ->AddOutputBasicArrayParam((Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+",
\""+returnParamName+"\");\n");
   				}
  +				else if (arrayType.isSimpleType()){//SimpleType in the schema 
  +					containedType = CUtils.getclass4qname(arrayType.getBaseType());
  +					writer.write("\treturn pIWSSZ->AddOutputBasicArrayParam((Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+",
\""+returnParamName+"\");\n");
  +				}
   				else{
   					containedType = qname.getLocalPart();
   					writer.write("\treturn pIWSSZ->AddOutputCmplxArrayParam((Axis_Array*)(&ret),"+

  @@ -354,12 +364,17 @@
   				if (returntypeissimple){
   					writer.write("\tpIWSSZ->AddOutputParam(\""+returnParamName+"\", (void*)&out"+i+",
"+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
   				}else if(returntypeisarray){
  -					QName qname = WrapperUtils.getArrayType(retType).getName();
  +					Type arrayType = WrapperUtils.getArrayType(retType);
  +					QName qname = arrayType.getName();
   					String containedType = null;
   					if (CUtils.isSimpleType(qname)){
   						containedType = CUtils.getclass4qname(qname);
   						writer.write("\tpIWSSZ->AddOutputBasicArrayParam((Axis_Array*)(&out"+i+"),"+CUtils.getXSDTypeForBasicType(containedType)+",
\""+returnParamName+"\");\n");
   					}
  +					else if (arrayType.isSimpleType()){//SimpleType in the schema 
  +						containedType = CUtils.getclass4qname(arrayType.getBaseType());
  +						writer.write("\tpIWSSZ->AddOutputBasicArrayParam((Axis_Array*)(&out"+i+"),"+CUtils.getXSDTypeForBasicType(containedType)+",
\""+returnParamName+"\");\n");
  +					}
   					else{
   						containedType = qname.getLocalPart();
   						writer.write("\tpIWSSZ->AddOutputCmplxArrayParam((Axis_Array*)(&out"+i+"),"+

  @@ -398,6 +413,7 @@
   		try {
   			while(types.hasNext()){
   				type = (Type)types.next();
  +				if (type.isSimpleType()) continue;
   				if (type.isArray()) continue;
   				typeName = type.getLanguageSpecificName();
   				if (typeName.startsWith(">")) continue;
  
  
  
  1.11      +31 -20    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Type.java	16 Mar 2004 08:26:28 -0000	1.10
  +++ Type.java	16 Mar 2004 14:04:12 -0000	1.11
  @@ -68,6 +68,7 @@
   
   import javax.xml.namespace.QName;
   
  +import org.apache.axis.wsdl.symbolTable.BaseType;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
   import org.apache.axis.wsdl.wsdl2ws.WrapperConstants;
   import org.apache.axis.wsdl.wsdl2ws.WrapperUtils;
  @@ -77,8 +78,15 @@
       /* max no of attribs expected in a type */
       private static final int MAXIMUM_NO_ATTRIBS = 101;
       private QName name;
  +    /**
  +     * Indicate whether this is a schema defined simpleType
  +     */
   	private boolean isSimpleType=false;
   	/**
  +	 * In case this is schema defined simpleType, this is the base type.
  +	 */
  +	private QName baseType;
  +	/**
   	  * If the specified node represents a supported JAX-RPC restriction,
   	  * a Vector is returned which contains the base type and the values.
   	  * The first element in the vector is the base type (an TypeEntry).
  @@ -107,9 +115,6 @@
       /* weather the type is Array */
       private boolean isArray;
       
  -    private boolean canThisOccuredmoreThanOnceAllTheTime = false;
  -    //to handle <xsd:element name="three" type="typens:enum" maxOccurs="unbounded" />
  -    //types at the top level. But this is not allowed in the Schema spec. 
       private boolean isreferenced = false;
       
       private String language;
  @@ -283,21 +288,7 @@
   		}		
   		return false;
   	}
  -    /**
  -     * @return
  -     */
  -    public boolean isCanThisOccuredmoreThanOnceAllTheTime() {
  -        return canThisOccuredmoreThanOnceAllTheTime;
  -    }
  -
  -    /**
  -     * @param b
  -     */
  -    public void setCanThisOccuredmoreThanOnceAllTheTime(boolean b) {
  -        canThisOccuredmoreThanOnceAllTheTime = b;
  -    }
  -    
  -
  +  
       /**
   	  * If the specified node represents a supported JAX-RPC enumeration,
   	  * a Vector is returned which contains the base type and the enumeration values.
  @@ -314,8 +305,13 @@
        * @param vector
        */
       public void setRestrictiondata(Vector vector) {
  -		isSimpleType = true;
  -        enumerationdata = vector;
  +		if (vector != null){
  +			isSimpleType = true;
  +			BaseType basetype = (BaseType)vector.firstElement();
  +			if (basetype != null)
  +				setBaseType(basetype.getQName());
  +	        enumerationdata = vector;
  +		}
       }
   
       /* (non-Javadoc)
  @@ -380,6 +376,21 @@
   	 */
   	public void setSimpleType(boolean isSimpleType) {
   		this.isSimpleType = isSimpleType;
  +	}
  +
  +	/**
  +	 * @return QName
  +	 */
  +	public QName getBaseType() {
  +		return baseType;
  +	}
  +
  +	/**
  +	 * Sets the baseType.
  +	 * @param baseType The baseType to set
  +	 */
  +	public void setBaseType(QName baseType) {
  +		this.baseType = baseType;
   	}
   
   }
  
  
  

Mime
View raw message