axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r671928 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl: symbolTable/ wsdl2ws/ wsdl2ws/info/
Date Thu, 26 Jun 2008 15:49:45 GMT
Author: nadiramra
Date: Thu Jun 26 08:49:44 2008
New Revision: 671928

URL: http://svn.apache.org/viewvc?rev=671928&view=rev
Log:
AXISCPP-458 First batch of fixes in support of unwrapped. Took the liberty of refactoring
some of the code so that ElementInfo class is no longer needed since CElemetnDecl does just
as well. 

Removed:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ElementInfo.java
Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java?rev=671928&r1=671927&r2=671928&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java Thu
Jun 26 08:49:44 2008
@@ -19,6 +19,8 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.axis.wsdl.wsdl2ws.info.Type;
+
 /**
  * Simple utility struct for holding element declarations.
  * 
@@ -29,61 +31,67 @@
  */
 public class CElementDecl //extends ElementDecl
 {
+    public static int UNBOUNDED = 999999999;
+    
     private QName name;
-    private TypeEntry type;
+    private TypeEntry typeEntry = null;
+    private Type type = null;
 
+    // An item that is not set and has minOccurs=0 should not be passed over the wire.  This
+    // is slightly different than nillable=true which causes nil=true to be passed over the
wire.
     private int minOccurs = 1;
     private int maxOccurs = 1;
     private boolean nillable = false;
     private boolean optional = false;
 
-    // The following property is set if minOccurs=0.
-    // An item that is not set and has minOccurs=0 
-    // should not be passed over the wire.  This
-    // is slightly different than nillable=true which
-    // causes nil=true to be passed over the wire.
-    private boolean minOccursIs0 = false;
-
-    // Indicate if the CElementDecl represents
-    // an xsd:any element
+    // Indicate if the CElementDecl represents an xsd:any element
     private boolean anyElement = false;
     
-    // indicate if the CElementDecl represents 
-    // an xsd:choice element 
+    // indicate if the CElementDecl represents an xsd:choice element 
     private boolean choiceElement = false;
     
-    // Chinthana:
-    // indicate if the CElementDecl represents 
-    // an xsd:all element 
+    // indicate if the CElementDecl represents an xsd:all element 
     private boolean allElement = false;
     
     //This field is set to true if the element is elementFormDefault qualified.
     //This specifies whether the element must be namespace qualified or not in the SOAP message.
     private boolean nsQualified = false;
     
-    
     /** Field documentation */
     private String documentation;
 
-    public CElementDecl()
-    {}
-
     public CElementDecl(TypeEntry type, QName name)
     {
+        this.typeEntry = type;
+        this.name = name;
+    }
+
+    public CElementDecl(Type type, QName name)
+    {
         this.type = type;
         this.name = name;
+    }    
+    
+    public TypeEntry getTypeEntry()
+    {
+        return this.typeEntry;
     }
 
-    public TypeEntry getType()
+    public void setTypeEntry(TypeEntry type)
+    {
+        this.typeEntry = type;
+    }
+    
+    public Type getType()
     {
         return this.type;
     }
 
-    public void setType(TypeEntry type)
+    public void setType(Type type)
     {
         this.type = type;
     }
-
+    
     public QName getName()
     {
         return this.name;
@@ -94,16 +102,21 @@
         this.name = name;
     }
 
-    public boolean getMinOccursIs0()
+    public boolean isMinOccurs0()
     {
-        return this.minOccursIs0;
+        return minOccurs == 0;
     }
 
-    public void setMinOccursIs0(boolean minOccursIs0)
+    public boolean isMaxOccursUnbounded() 
     {
-        this.minOccursIs0 = minOccursIs0;
+        return maxOccurs == UNBOUNDED;
     }
-
+    
+    public boolean isMaxOccursExactlyOne() 
+    {
+        return maxOccurs == 1;
+    }
+    
     public boolean getAnyElement()
     {
         return this.anyElement;
@@ -133,100 +146,64 @@
     {
         this.allElement = allElement;
     }
-    
-    public boolean getNsQualified(){
-    	return nsQualified;
+
+    public boolean getNsQualified()
+    {
+        return nsQualified;
     }
-    
-    public void setNsQualified(boolean nsQual){
-    	nsQualified = nsQual;
+
+    public void setNsQualified(boolean nsQual)
+    {
+        nsQualified = nsQual;
     }
-    
-    
-    /**
-     * @return
-     */
+
     public int getMaxOccurs()
     {
         return this.maxOccurs;
     }
 
-    /**
-     * @return
-     */
     public int getMinOccurs()
     {
         return this.minOccurs;
     }
 
-    /**
-     * @return
-     */
     public boolean isNillable()
     {
         return this.nillable;
     }
 
-    /**
-     * @param i
-     */
     public void setMaxOccurs(int i)
     {
         maxOccurs = i;
     }
 
-    /**
-     * @param i
-     */
     public void setMinOccurs(int i)
     {
         minOccurs = i;
     }
 
-    /**
-     * @param b
-     */
     public void setNillable(boolean b)
     {
-		this.nillable = b;
+        this.nillable = b;
     }
 
-    /**
-     * Method setOptional
-     * 
-     * @param optional 
-     */
-    public void setOptional(boolean optional) {
+    public void setOptional(boolean optional)
+    {
         this.optional = optional;
     }
 
-    /**
-     * Method getOptional
-     * 
-     * @return 
-     */
-    public boolean getOptional() {
+    public boolean getOptional()
+    {
         return optional;
     }
 
-    /**
-     *       Method getDocumentation
-     *       @return string       
-     */    
-    
     public String getDocumentation()
     {
         return this.documentation;
     }
 
-    /**
-     *       Method setDocumentation
-     *       @param documentation
-     */
-
     public void setDocumentation(String documentation)
     {
         this.documentation = documentation;
     }
-
-}
+}
\ No newline at end of file

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java?rev=671928&r1=671927&r2=671928&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java Thu
Jun 26 08:49:44 2008
@@ -18,7 +18,6 @@
 
 import org.apache.axis.Constants;
 import org.apache.axis.utils.JavaUtils;
-import org.apache.axis.wsdl.wsdl2ws.info.ElementInfo;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -825,28 +824,21 @@
         {
             CElementDecl elem = new CElementDecl(type, nodeName);
             elem.setDocumentation(comments);
+            
             String minOccurs = Utils.getAttribute(elementNode, "minOccurs");
-
-            if ((minOccurs != null) && minOccurs.equals("0"))
-                elem.setMinOccursIs0(true);
-
-            if (minOccurs != null)
-            {
-            	if ("unbounded".equals(minOccurs))
-                	elem.setMinOccurs(ElementInfo.UNBOUNDED);
-            	else
-                	elem.setMinOccurs(Integer.parseInt(minOccurs));
+            if (minOccurs != null) {
+                elem.setMinOccurs(Integer.parseInt(minOccurs));
 			}
 			
             String maxOccurs = Utils.getAttribute(elementNode, "maxOccurs");
-            if (maxOccurs != null)
-            {
-            	if (maxOccurs.equals("unbounded"))
-                	elem.setMaxOccurs(ElementInfo.UNBOUNDED);
-            	else
-                	elem.setMaxOccurs(Integer.parseInt(maxOccurs));
+            if (maxOccurs != null) {
+                if (maxOccurs.equals("unbounded")) {
+                    elem.setMaxOccurs(CElementDecl.UNBOUNDED);
+                }
+                else
+                    elem.setMaxOccurs(Integer.parseInt(maxOccurs));
             }
-            
+
             elem.setNillable(JavaUtils.isTrueExplicitly(Utils.getAttribute(elementNode, "nillable")));
 
             String useValue = Utils.getAttribute(elementNode, "use");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java?rev=671928&r1=671927&r2=671928&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java Thu Jun
26 08:49:44 2008
@@ -30,10 +30,10 @@
 import java.util.Iterator;
 
 import org.apache.axis.wsdl.wsdl2ws.info.AttributeInfo;
-import org.apache.axis.wsdl.wsdl2ws.info.ElementInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 import org.apache.axis.wsdl.symbolTable.CContainedAttribute;
+import org.apache.axis.wsdl.symbolTable.CElementDecl;
 
 public abstract class ParamWriter extends BasicFileWriter
 {
@@ -95,7 +95,7 @@
     /* genarate the attribs array */
     private void populateAttribList() throws WrapperFault
     {
-        ElementInfo elemi = type.getExtensionBaseType();
+        CElementDecl elemi = type.getExtensionBaseType();
         if (elemi != null)
         {
             extensionBaseAttrib = new AttributeInfo(this.classname);
@@ -156,7 +156,7 @@
         {
             this.attribs[i] = new AttributeInfo(this.classname);
             this.attribs[i].setParamName((String) elementfields.get(i - attributeParamCount),
wscontext.getTypemap());
-            ElementInfo elem = type.getElementForElementName(this.attribs[i].getParamName());
+            CElementDecl elem = type.getElementForElementName(this.attribs[i].getParamName());
             Type elementType = elem.getType();
             if (CUtils.isAnyType(elementType.getName()))
                 this.attribs[i].setAnyType(true);
@@ -204,7 +204,7 @@
             if (elem.getMinOccurs() == 0)
                 this.attribs[i].setOptional(true);
             
-            this.attribs[i].setNillable(elem.getNillable());
+            this.attribs[i].setNillable(elem.isNillable());
         }
     }
 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java?rev=671928&r1=671927&r2=671928&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java Thu Jun 26
08:49:44 2008
@@ -54,7 +54,6 @@
 import org.apache.axis.wsdl.symbolTable.SymTabEntry;
 import org.apache.axis.wsdl.symbolTable.SymbolTable;
 import org.apache.axis.wsdl.symbolTable.TypeEntry;
-import org.apache.axis.wsdl.wsdl2ws.info.ElementInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.FaultInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.MethodInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo;
@@ -258,7 +257,7 @@
         {
             Operation op     = (Operation) oplist.next();
             MethodInfo minfo = new MethodInfo(op.getName());
-
+            
             //setting the faults
             addFaultInfo(op.getFaults(), minfo);
             
@@ -405,10 +404,10 @@
         // TODO - need to look into this more.
         // For wrapped style, inner attributes and elements are added as parameters.
         // For unwrapped style, objects are used for the parameters (i.e. classes or structures).
+        
+        Iterator names = type.getElementnames();
         if (c_wsdlWrappingStyle)
         {
-            Iterator names = type.getElementnames();
-            
             if (!names.hasNext())
             {
                 if (type.isSimpleType())
@@ -429,7 +428,7 @@
                 while (names.hasNext())
                 {
                     String elementname  = (String) names.next();
-                    ElementInfo eleinfo = type.getElementForElementName(elementname);
+                    CElementDecl eleinfo = type.getElementForElementName(elementname);
                     Type innerType      = eleinfo.getType();
                     
                     ParameterInfo pinfo = new ParameterInfo();
@@ -439,7 +438,7 @@
                     if (eleinfo.getMaxOccurs() > 1)
                         pinfo.setArray(true);
                     
-                    pinfo.setNillable(eleinfo.getNillable());
+                    pinfo.setNillable(eleinfo.isNillable());
                     
                     if (eleinfo.getMinOccurs() == 0)
                         pinfo.setOptional(true);
@@ -461,7 +460,15 @@
             ParameterInfo pinfo = new ParameterInfo();
             pinfo.setType(type);
             pinfo.setParamName(elementName, c_typeMap);
-            pinfo.setElementName(type.getName());
+            
+            if (!names.hasNext() && type.isSimpleType())
+            {
+                pinfo.setElementName(element.getQName());
+                pinfo.setGetElementAsCharData(true);                
+            }
+            else
+                pinfo.setElementName(type.getName());
+            
             if (type.getName().equals(CUtils.anyTypeQname))
                 pinfo.setAnyType(true);
             minfo.addOutputParameter(pinfo);
@@ -560,7 +567,7 @@
             while (elementNames.hasNext())
             {
                 String elementname = (String) elementNames.next();
-                ElementInfo eleinfo = type.getElementForElementName(elementname);
+                CElementDecl eleinfo = type.getElementForElementName(elementname);
                 Type innerType = eleinfo.getType();
                 
                 ParameterInfo pinfo = new ParameterInfo();
@@ -575,7 +582,7 @@
                 if (innerType.getName().equals(CUtils.anyTypeQname))
                     pinfo.setAnyType(true);
                 
-                pinfo.setNillable(eleinfo.getNillable());
+                pinfo.setNillable(eleinfo.isNillable());
                 
                 if (eleinfo.getMinOccurs() == 0)
                     pinfo.setOptional(true);
@@ -673,6 +680,7 @@
         if (wsg == null)
             throw new WrapperFault("WSDL2Ws does not support the option combination");
         
+        // There must be a better way to do this
         exposeReferenceTypes(wsContext);
         exposeMessagePartsThatAreAnonymousTypes(wsContext);
         // This call must be last one called of the exposexxx methods!
@@ -814,8 +822,7 @@
                 QName typeName =  new QName(type.getQName().getNamespaceURI(), localpart);
                 newSecondaryType = createTypeInfo(base.getQName());
                 typedata.addRelatedType(newSecondaryType);
-                ElementInfo eleinfo = new ElementInfo(typeName, newSecondaryType);
-                typedata.setExtensionBaseType(eleinfo);
+                typedata.setExtensionBaseType(new CElementDecl(newSecondaryType, typeName));
                 if (c_verbose)
                     System.out.print(
                         "=====complexType with simpleContent is found : "
@@ -842,7 +849,7 @@
         {
             newSecondaryType = createTypeInfo(type.getRefType().getQName());
             typedata.addRelatedType(newSecondaryType);
-            typedata.setTypeNameForElementName(new ElementInfo(type.getQName(),newSecondaryType));
+            typedata.setTypeNameForElementName(new CElementDecl(newSecondaryType, type.getQName()));
             typedata.setArray(true);
         }
         else
@@ -853,14 +860,14 @@
             {
                 newSecondaryType = createTypeInfo(arrayType);
                 typedata.addRelatedType(newSecondaryType);
-                typedata.setTypeNameForElementName(new ElementInfo(new QName("item"), newSecondaryType));
+                typedata.setTypeNameForElementName(new CElementDecl(newSecondaryType, new
QName("item")));
                 typedata.setArray(true);
             }
             else if ((arrayType = CSchemaUtils.getCollectionComponentQName(node)) != null)
             {
                 newSecondaryType = createTypeInfo(arrayType);
                 typedata.addRelatedType(newSecondaryType);
-                typedata.setTypeNameForElementName(new ElementInfo(new QName("item"), newSecondaryType));
+                typedata.setTypeNameForElementName(new CElementDecl(newSecondaryType, new
QName("item")));
                 typedata.setArray(true);
             }
             //Note in a array the parameter type is stored as under the name item all the
time  
@@ -920,7 +927,7 @@
                             }
                             else
                             {
-                                QName typeName = elem.getType().getQName();
+                                QName typeName = elem.getTypeEntry().getQName();
                                 if (typeName.getLocalPart().indexOf('[') > 0)
                                 {
                                     String localpart =
@@ -931,29 +938,16 @@
                                     if (CUtils.isBasicType(typeName))
                                         newSecondaryType = createTypeInfo(typeName);
                                     else
-                                        newSecondaryType = createTypeInfo(elem.getType());
+                                        newSecondaryType = createTypeInfo(elem.getTypeEntry());
                                 }
                                 else
                                     newSecondaryType = createTypeInfo(typeName);
                             }
                             
                             typedata.addRelatedType(newSecondaryType);
-                            ElementInfo eleinfo = new ElementInfo(elem.getName(), newSecondaryType);
-                            
-                            eleinfo.setMinOccurs(elem.getMinOccurs());
-                            eleinfo.setMaxOccurs(elem.getMaxOccurs());
-                            eleinfo.setNillable( elem.isNillable());
-                            
-                            // states whether this element is a xsd:choice
-                            eleinfo.setChoiceElement(elem.getChoiceElement());
-                            
-                            // states whether this element is a xsd:all
-                            eleinfo.setAllElement(elem.getAllElement());
-                            
-                            //states whether the element must be namespace qualified.
-                            eleinfo.setNsQualified(elem.getNsQualified());
+                            elem.setType(newSecondaryType);
                                                        
-                            typedata.setTypeNameForElementName(eleinfo);
+                            typedata.setTypeNameForElementName(elem);
                         }
                 }
             }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java?rev=671928&r1=671927&r2=671928&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
Thu Jun 26 08:49:44 2008
@@ -104,7 +104,7 @@
     public void setParamName(String paramName, TypeMap typeMap)
     {
         // Get the last identifier after anonymous token
-        if (paramName.lastIndexOf(SymbolTable.ANON_TOKEN) > 1)
+        if (paramName.lastIndexOf(SymbolTable.ANON_TOKEN) != -1)
         {
             paramName =
                 paramName.substring(paramName.lastIndexOf(SymbolTable.ANON_TOKEN) + 1,
@@ -178,7 +178,7 @@
         if (elementName != null)
         {
             String paramName = elementName.getLocalPart();
-            if (paramName.lastIndexOf(SymbolTable.ANON_TOKEN) > 1)
+            if (paramName.lastIndexOf(SymbolTable.ANON_TOKEN) != -1)
             {
                 paramName =
                     paramName.substring(paramName.lastIndexOf(SymbolTable.ANON_TOKEN) + 1,

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java?rev=671928&r1=671927&r2=671928&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java Thu Jun
26 08:49:44 2008
@@ -30,6 +30,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.axis.wsdl.symbolTable.CElementDecl;
 import org.apache.axis.wsdl.symbolTable.SymbolTable;
 import org.apache.axis.wsdl.symbolTable.TypeEntry;
 import org.apache.axis.wsdl.symbolTable.CContainedAttribute;
@@ -43,7 +44,7 @@
      * variable that represents extension base value in case of a complexType 
      * with simpleContent
      */
-    private ElementInfo extensionBaseType = null;
+    private CElementDecl extensionBaseType = null;
     
     /**
      * Indicate whether this is a schema defined simpleType
@@ -93,7 +94,7 @@
     /* Should this type be generated or not - by default, set to true except for anonymous
types */
     private boolean externalize = true;
 
-    private boolean	  restriction = false;
+    private boolean   restriction = false;
     private String    restrictionBaseType = null;
     private Vector    restrictionPattern = null;      // future - not currently used 
     private Vector    restrictionEnumeration = null;  // future - not currently used
@@ -194,7 +195,7 @@
 
     /**
      */
-    public void setTypeNameForElementName(ElementInfo element)
+    public void setTypeNameForElementName(CElementDecl element)
     {
         String attribName = element.getName().getLocalPart();
 
@@ -209,9 +210,9 @@
         this.vElements.add(attribName);
     }
 
-    public ElementInfo getElementForElementName(String attribName)
+    public CElementDecl getElementForElementName(String attribName)
     {
-        return (ElementInfo) this.elements.get(attribName);
+        return (CElementDecl) this.elements.get(attribName);
     }
 
     public String getLanguageSpecificName()
@@ -358,7 +359,7 @@
     /**
      * @return ElementInfo
      */
-    public ElementInfo getExtensionBaseType()
+    public CElementDecl getExtensionBaseType()
     {
         return extensionBaseType;
     }
@@ -367,7 +368,7 @@
      * Sets the extensionBaseType.
      * @param extensionBaseType The extensionBaseType to set
      */
-    public void setExtensionBaseType(ElementInfo extensionBaseType)
+    public void setExtensionBaseType(CElementDecl extensionBaseType)
     {
         this.extensionBaseType = extensionBaseType;
     }



Mime
View raw message