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 sa...@apache.org on 2003/12/16 11:38:38 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info WrapperInfo.java TypeMap.java Type.java ServiceInfo.java ParameterInfo.java MethodInfo.java

sanjaya     2003/12/16 02:38:38

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info Tag:
                        CWrapperSupport WrapperInfo.java TypeMap.java
                        Type.java ServiceInfo.java ParameterInfo.java
                        MethodInfo.java
  Log:
  changes to incorporate additional information from wsdls. ie. Soapaction,
  falut information and use in the binding section.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.4.1   +4 -19     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java
  
  Index: WrapperInfo.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WrapperInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- WrapperInfo.java	1 Oct 2003 11:57:57 -0000	1.3
  +++ WrapperInfo.java	16 Dec 2003 10:38:37 -0000	1.3.4.1
  @@ -85,7 +85,7 @@
   	
       public WrapperInfo(String wrapperStyle,
       					String wrapperLanguage,
  -    					String encodingStyle, 
  +//    					String encodingStyle, 
       					String targetOutputLocation, 
       					String implStyle,
       					String targetEngine,
  @@ -94,7 +94,7 @@
   						String targetNameSpaceOfWSDL) {
           this.wrapperStyle = wrapperStyle;
           this.wrapperLanguage = wrapperLanguage;
  -        this.encodingStyle = encodingStyle;
  + //       this.encodingStyle = encodingStyle;
           this.targetOutputLocation = targetOutputLocation;
           this.implStyle = implStyle;
   
  @@ -108,8 +108,8 @@
           else
               this.wrapperStyle = this.wrapperStyle.toLowerCase();
   
  -        if (encodingStyle == null || encodingStyle.equals(WrapperConstants.ENCODING_STYLE_SOAP))
  -            encodingStyle = WrapperConstants.ENCODING_STYLE_SOAP;
  +//        if (encodingStyle == null || encodingStyle.equals(WrapperConstants.ENCODING_STYLE_SOAP))
  +//            encodingStyle = WrapperConstants.ENCODING_STYLE_SOAP;
           if (targetOutputLocation == null)
               targetOutputLocation = ".";
           
  @@ -164,21 +164,6 @@
        */
       public void setWrapperStyle(String wrapperStyle) {
           this.wrapperStyle = wrapperStyle;
  -    }
  -
  -    /**
  -     * @return int
  -     */
  -    public String getEncodingStyle() {
  -        return encodingStyle;
  -    }
  -
  -    /**
  -     * Sets the encodingStyle.
  -     * @param encodingStyle The encodingStyle to set
  -     */
  -    public void setEncodingStyle(String encodingStyle) {
  -        this.encodingStyle = encodingStyle;
       }
   
       /**
  
  
  
  1.2.4.1   +5 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/TypeMap.java
  
  Index: TypeMap.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/TypeMap.java,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- TypeMap.java	2 Oct 2003 08:45:23 -0000	1.2
  +++ TypeMap.java	16 Dec 2003 10:38:37 -0000	1.2.4.1
  @@ -78,6 +78,7 @@
   public class TypeMap {
       public static final int SIMPLE_PARAM_GEN = 0;
       public static final int BEAN_PARAM_GEN = 1;
  +    private static String language = WrapperConstants.LANGUAGE_JAVA; 
   
       /* this map maps the classname -> QName */
       private static Hashtable basicTypeClass2QNamemap = new Hashtable();
  @@ -164,7 +165,8 @@
   
   	
   	}
  -    public TypeMap() {
  +    public TypeMap(String language) {
  +		TypeMap.language = language;
           this.typeInfo = new Hashtable();
       }
   
  @@ -187,6 +189,8 @@
       }
   
       public Type getType(QName name) {
  +    	if(isSimpleType(name))
  +    		return new Type(name,null,false,TypeMap.language);
           return (Type) this.typeInfo.get(name);
       }
   
  
  
  
  1.4.4.2   +129 -23   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.4.4.1
  retrieving revision 1.4.4.2
  diff -u -r1.4.4.1 -r1.4.4.2
  --- Type.java	9 Dec 2003 06:17:44 -0000	1.4.4.1
  +++ Type.java	16 Dec 2003 10:38:37 -0000	1.4.4.2
  @@ -62,13 +62,16 @@
    */
   package org.apache.axis.wsdl.wsdl2ws.info;
   
  +import java.util.Collection;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +import java.util.Set;
   import java.util.Vector;
   import java.util.Iterator;
   
   import javax.xml.namespace.QName;
   
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
   import org.apache.axis.wsdl.wsdl2ws.WrapperConstants;
   import org.apache.axis.wsdl.wsdl2ws.WrapperUtils;
   import org.apache.axis.wsdl.wsdl2ws.c.CUtils;
  @@ -78,12 +81,22 @@
       /* max no of attribs expected in a type */
       private static final int MAXIMUM_NO_ATTRIBS = 101;
       private QName name;
  -    private boolean isAttribute;
  +
  +	/**
  +	  * If the specified node represents a supported JAX-RPC enumeration,
  +	  * a Vector is returned which contains the base type and the enumeration values.
  +	  * The first element in the vector is the base type (an TypeEntry).
  +	  * Subsequent elements are values (Strings).
  +	  * If this is not an enumeration, null is value.
  +	  */
  +    private Vector enumerationdata;
   
       /* This can be null */
       private String languageSpecificName;
  -    /* attribute names and the type of the attributes */
  -    private Hashtable types;
  +	/* element names and the type of the elements (QName,ElementInfo)*/
  +    private Hashtable elements;
  +	/* attribute names and the type of the attributes (QName,QName)*/
  +    private Hashtable attributes;
       /* has the attributes are specified with order <sequence> in the schema */
       private boolean hasOrder;
       /*if order presents the order is set in the vector */
  @@ -91,13 +104,19 @@
       /* 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 String language;
   
       public Type(QName name, String languageSpecificName, boolean hasOrder,String language) {
           this.languageSpecificName = languageSpecificName;
           this.hasOrder = hasOrder;
           this.name = name;
  -        types = new Hashtable();
  +		elements = new Hashtable();
  +		attributes = new Hashtable();
           if(language == null)
   			this.language = WrapperConstants.LANGUAGE_JAVA;
           else
  @@ -142,41 +161,54 @@
           this.name = name;
       }
   
  -    public Enumeration getAttribNames() {
  -    	if (hasOrder){
  -    		return attribOrder.elements();	
  -    	}
  -    	else{
  -        	return this.types.keys();
  -    	}
  +    public Enumeration getAttributeNames() {
  +       	return this.attributes.keys();
       }
   
  -/*    public void setTypeNameForAttribName(String attribName, String typeName) {
  -        if (hasOrder)
  -            this.attribOrder.add(typeName);
  -        this.types.put(attribName, typeName);
  -    }*/
   
   /**
    * The Type take the attributes name to lowercase when add, If there is two names like "Name" and "name"
    * they will convert to "name"  Is that acceptable ....  
    */
  -    public void setTypeNameForAttribName(String attribName, QName typeName) {
  +    public void setTypeForAttributeName(String attribName, Type type) {
   		attribName = TypeMap.resoleveWSDL2LanguageNameClashes(attribName,this.language);
           if (hasOrder)
               this.attribOrder.add(attribName);
  -        this.types.put(attribName, typeName);
  +        this.attributes.put(attribName, type);
       }
   
  +	public Type getTypForAttribName(String attribName) {
  +		return (Type) this.attributes.get(attribName);
  +	}
  +
  +	public Enumeration getElementnames() {
  +		return this.elements.keys();
  +	}
  +
  +
  +/**
  + * The Type take the attributes name to lowercase when add, If there is two names like "Name" and "name"
  + * they will convert to "name"  Is that acceptable ....  
  + */
  +	public void setTypeNameForElementName(ElementInfo element) {
  +		String attribName = TypeMap.resoleveWSDL2LanguageNameClashes(element.getName().getLocalPart(),this.language);
  +		if (hasOrder)
  +			this.attribOrder.add(attribName);
  +		this.elements.put(attribName, element);
  +	}
  +
  +	public ElementInfo getElementForElementName(String attribName) {
  +		return (ElementInfo) this.elements.get(attribName);
  +	}
  +
  +
       public void setAttribOrder(Vector order) {
           this.attribOrder = order;
       }
   
   
   
  -    public QName getTypNameForAttribName(String attribName) {
  -        return (QName) this.types.get(attribName);
  -    }
  +
   
       public boolean hasOrder() {
           return this.hasOrder;
  @@ -220,14 +252,88 @@
   	}
   
   	public boolean isContainedType(Type containedType){
  -		Iterator ntype = this.types.values().iterator();
  +		Iterator ntype = this.attributes.values().iterator();
   		QName typeName;
   		while(ntype.hasNext()){
  -			typeName = (QName)ntype.next();
  +			typeName = ((Type)ntype.next()).getName();
  +			if(typeName.equals(containedType.name)){
  +				return true;
  +			}
  +		}	
  +		Iterator nelements = this.elements.values().iterator();
  +		while(nelements.hasNext()){
  +			typeName = ((ElementInfo)nelements.next()).getType().getName();
   			if(typeName.equals(containedType.name)){
   				return true;
   			}
   		}		
   		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.
  +	  * The first element in the vector is the base type (an TypeEntry).
  +	  * Subsequent elements are values (Strings).
  +	  * If this is not an enumeration, null is value.
  +      * @return
  +      */
  +    public Vector getEnumerationdata() {
  +        return enumerationdata;
  +    }
  +
  +    /**
  +     * @param vector
  +     */
  +    public void setEnumerationdata(Vector vector) {
  +        enumerationdata = vector;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see java.lang.Object#toString()
  +     */
  +    public String toString() {
  +       String str = "---------"+this.name+"------------\n" +
       	"languageSpecificName = " + this.languageSpecificName +"\n";
  +       	if(enumerationdata != null){
  +			str = str + "enumerationType = "+((TypeEntry)enumerationdata.get(0)).getQName()+"\n(";
  +			for(int i = 1;i<enumerationdata.size();i++)	
  +				str = str +","+ enumerationdata.get(i);
  +			str = str + ")\n";
  +       	}else{
  +	       	str =str +"isArray ="+isArray+"\n";
  +	       	str = str + "Elements[\n";
  +	       	Iterator c = elements.values().iterator();
  +			while(c.hasNext())	
  +					str = str +","+ c.next()+"\n";
  +	       	str = str + "]\n";
  +	       	
  +			c = attributes.keySet().iterator();
  +			str = str + "Attributes[\n";
  +
  +			while(c.hasNext()){	
  +				String name = (String)c.next();
  +					str = str +",("+ name+","+attributes.get(name)+")";
  +			}		
  +			str = str + "]\n";
  +	       	
  +        }
  +		str = str + "------------------------------------------------------\n";
  +       
  +        return str;
  +    }
  +
   }
  
  
  
  1.1.4.1   +0 -12     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ServiceInfo.java
  
  Index: ServiceInfo.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ServiceInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.1.4.1
  diff -u -r1.1 -r1.1.4.1
  --- ServiceInfo.java	19 Sep 2003 14:25:51 -0000	1.1
  +++ ServiceInfo.java	16 Dec 2003 10:38:37 -0000	1.1.4.1
  @@ -104,16 +104,4 @@
       public String getServicename() {
           return servicename;
       }
  -
  -    /**
  -     * return true if qualifiedname is a direct return type in the
  -     * service
  -     * @param qualifiedname
  -     * @return weather gvien qu. name is a direct return type ...
  -     */
  -    public boolean isDirectReturn(String qualifiedname) {
  -        for (int i = 0; i < this.methods.size(); i++)
  -            if (((MethodInfo) this.methods.get(i)).getReturnType().getLangName().equals(qualifiedname)) return true;
  -        return false;
  -    }
   }
  
  
  
  1.1.4.2   +35 -27    ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
  
  Index: ParameterInfo.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java,v
  retrieving revision 1.1.4.1
  retrieving revision 1.1.4.2
  diff -u -r1.1.4.1 -r1.1.4.2
  --- ParameterInfo.java	9 Dec 2003 06:17:44 -0000	1.1.4.1
  +++ ParameterInfo.java	16 Dec 2003 10:38:37 -0000	1.1.4.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -20,7 +20,7 @@
    * 3. The end-user documentation included with the redistribution,
    *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  + *    Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  @@ -52,35 +52,20 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -/**
  - * this class represents Parameter(message in the wsdl) 
  - * @author Srinath Perera(hemapani@opensource.lk)
  - */
  +
   package org.apache.axis.wsdl.wsdl2ws.info;
   
   import javax.xml.namespace.QName;
   
  +/**
  + * this class represents Parameter(message in the wsdl) 
  + * @author Srinath Perera(hemapani@opensource.lk)
  + */
   public class ParameterInfo {
       private Type type;
       private String attribName;
  -	private String namespace;
  +	private QName elementName;
   	
  -    public String getLangName() {
  -        return type.getLanguageSpecificName();
  -    }
  -
  -    public void setLangName(String langName) {
  -        this.type.setLanguageSpecificName(langName);
  -    }
  -
  -    public QName getSchemaName() {
  -        return this.type.getName();
  -    }
  -
  -    public void setSchemaName(QName schemaName) {
  -        this.type.setName(schemaName);
  -    }
  -
       public String getParamName() {
           return attribName;
       }
  @@ -89,11 +74,34 @@
           this.attribName = paramName;
       }
   
  -    public ParameterInfo(String langName, QName schemaName, String attribName,String language) {
  -        this.type = new Type(schemaName,langName,false,language);
  +    public ParameterInfo(Type type,String attribName) {
  +        this.type = type;
           this.attribName = attribName;
       }
  -    public Type getType(){
  -    	return type;
  +    public Type getType() {
  +        return type;
       }
  +    
  +    /**
  +     * @return
  +     */
  +    public QName getElementName() {
  +        return elementName;
  +    }
  +
  +    /**
  +     * @param name
  +     */
  +    public void setElementName(QName name) {
  +        elementName = name;
  +    }
  +    
  +	public QName getSchemaName(){
  +		return this.type.getName();
  +	}
  +	
  +	public String getLangName(){
  +		return this.type.getLanguageSpecificName();
  +	}
  +
   }
  
  
  
  1.2.4.3   +75 -8     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/MethodInfo.java
  
  Index: MethodInfo.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/MethodInfo.java,v
  retrieving revision 1.2.4.2
  retrieving revision 1.2.4.3
  diff -u -r1.2.4.2 -r1.2.4.3
  --- MethodInfo.java	9 Dec 2003 06:17:44 -0000	1.2.4.2
  +++ MethodInfo.java	16 Dec 2003 10:38:37 -0000	1.2.4.3
  @@ -62,20 +62,18 @@
   
   import java.util.ArrayList;
   import java.util.Collection;
  +import java.util.List;
   
   public class MethodInfo {
       private String methodname;
       private ArrayList parameters;
       private ParameterInfo returnType;
  -	private ArrayList inputParameters;
  -	private ArrayList returnParameters;
  -	private ArrayList faults;
  -	private boolean isRequestBodyLiteral;
  -	private boolean isResponseBodyLiteral;
  -	private boolean isFaultBodyLiteral;
  -    
       private String soapAction;
  -	
  +    private List inputEncoding;
  +    private List outputEncoding;
  +    private String inputUse;
  +    private String outputUse;
  +
       public MethodInfo() {
           this.returnType = null;
           this.methodname = null;
  @@ -123,4 +121,73 @@
           return null;
       }
   */
  +    /**
  +     * @return
  +     */
  +    public List getInputEncoding() {
  +        return inputEncoding;
  +    }
  +
  +    /**
  +     * @return
  +     */
  +    public List getOutputEncoding() {
  +        return outputEncoding;
  +    }
  +
  +    /**
  +     * @return
  +     */
  +    public String getSoapAction() {
  +        return soapAction;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setInputEncoding(List string) {
  +        inputEncoding = string;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setOutputEncoding(List string) {
  +        outputEncoding = string;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setSoapAction(String string) {
  +        soapAction = string;
  +    }
  +
  +    /**
  +     * @return
  +     */
  +    public String getInputUse() {
  +        return inputUse;
  +}
  +    /**
  +     * @return
  +     */
  +    public String getOutputUse() {
  +        return outputUse;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setInputUse(String string) {
  +        inputUse = string;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setOutputUse(String string) {
  +        outputUse = string;
  +    }
  +
   }