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 na...@apache.org on 2008/08/16 16:31:13 UTC

svn commit: r686506 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws: ParamWriter.java info/AttributeInfo.java info/ParameterInfo.java

Author: nadiramra
Date: Sat Aug 16 07:31:13 2008
New Revision: 686506

URL: http://svn.apache.org/viewvc?rev=686506&view=rev
Log:
Simplify, remove redundant/unused code.  Get rid of attributeInfo class by moving info to ParameterInfo.  No reason to have different classes.

Removed:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/AttributeInfo.java
Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java

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=686506&r1=686505&r2=686506&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 Sat Aug 16 07:31:13 2008
@@ -29,7 +29,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import org.apache.axis.wsdl.wsdl2ws.info.AttributeInfo;
+import org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 import org.apache.axis.wsdl.symbolTable.CContainedAttribute;
@@ -37,13 +37,13 @@
 
 public abstract class ParamWriter extends BasicFileWriter
 {
-    protected AttributeInfo extensionBaseAttrib = null;
+    protected ParameterInfo extensionBaseAttrib = null;
 
     // first attributeParamCount of attribs will be treated as attributes
     protected int attributeParamCount = 0;
    
     // array of parameter types and attributes 
-    protected AttributeInfo[] attribs;
+    protected ParameterInfo[] attribs;
 
     protected WebServiceContext wscontext;
 
@@ -94,7 +94,7 @@
         CElementDecl elemi = type.getExtensionBaseType();
         if (elemi != null)
         {
-            extensionBaseAttrib = new AttributeInfo(this.classname);
+            extensionBaseAttrib = new ParameterInfo();
             extensionBaseAttrib.setParamName(elemi.getName().getLocalPart(), wscontext.getTypemap());
             
             Type elementType = elemi.getType();
@@ -128,12 +128,12 @@
         int intAttrFieldSz = attribfields.size();
         attributeParamCount = intAttrFieldSz;
         int intEleFieldSz = elementfields.size();
-        this.attribs = new AttributeInfo[intAttrFieldSz + intEleFieldSz];
+        this.attribs = new ParameterInfo[intAttrFieldSz + intEleFieldSz];
         for (int i = 0; i < intAttrFieldSz; i++)
         {
             CContainedAttribute attr = (CContainedAttribute)attribfields.get(i);
             
-            this.attribs[i] = new AttributeInfo(this.classname);
+            this.attribs[i] = new ParameterInfo();
             this.attribs[i].setParamName(attr.getName(), wscontext.getTypemap());
             if (CUtils.isSimpleType(attr.getType().getName()))
                 this.attribs[i].setTypeName(CUtils.getclass4qname(attr.getType().getName()));
@@ -150,7 +150,7 @@
 
         for (int i = intAttrFieldSz; i < intAttrFieldSz + intEleFieldSz; i++)
         {
-            this.attribs[i] = new AttributeInfo(this.classname);
+            this.attribs[i] = new ParameterInfo();
             this.attribs[i].setParamName((String) elementfields.get(i - attributeParamCount), wscontext.getTypemap());
             CElementDecl elem = type.getElementForElementName(this.attribs[i].getParamName());
             Type elementType = elem.getType();
@@ -171,6 +171,9 @@
             this.attribs[i].setAllElement(elem.getAllElement());
             this.attribs[i].setNsQualified(elem.getNsQualified());            
             this.attribs[i].setMinOccurs(elem.getMinOccurs());
+            this.attribs[i].setMaxOccurs(elem.getMaxOccurs());
+            this.attribs[i].setNillable(elem.isNillable());
+
             
             if (elementType.isArray())
             { 
@@ -199,12 +202,10 @@
             
             if (elem.getMinOccurs() == 0)
                 this.attribs[i].setOptional(true);
-            
-            this.attribs[i].setNillable(elem.isNillable());
         }
     }
 
-    protected String getCorrectParmNameConsideringArraysAndComplexTypes(AttributeInfo attrib)
+    protected String getCorrectParmNameConsideringArraysAndComplexTypes(ParameterInfo attrib)
         throws WrapperFault
     {
         if (attrib.isArray())

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=686506&r1=686505&r2=686506&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 Sat Aug 16 07:31:13 2008
@@ -22,24 +22,43 @@
 import org.apache.axis.wsdl.wsdl2ws.CUtils;
 
 /**
- * this class represents Parameter(message in the wsdl) 
+ * This class stores information about parameters and attributes.
+ * 
  * @author Srinath Perera(hemapani@opensource.lk)
  */
 
 public class ParameterInfo
 {
-    protected Type type;
-    protected String attribName = null;
-    protected QName elementName = null;
+    private Type type;
+    private String attribName = null;
+    private QName elementName = null;
     private String elementNameAsSOAPString = null;
     private String attribNameAsSOAPString = null;
     private String attribNameAsMember = null;
     private String methodName=null;
     private boolean isAnyType = false;
-    protected boolean isArray = false;
+    private boolean isArray = false;
     private boolean isAttribute = false;
     private boolean isNillable = false;
     private boolean isOptional = false;
+    
+    private boolean isSimpleType = true;
+
+    private int maxOccurs = 1;
+    private int minOccurs = 1;
+
+    private String typeName;
+    
+    //this variable states whether the attribute is an xsd:choice
+    private boolean isChoiceElement = false;
+    
+    //this variable states whether the attribute is an xsd:all
+    private boolean isAllElement = 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 isNamespaceQualified = false;
+
 
     public ParameterInfo()
     {}
@@ -58,6 +77,14 @@
         str = str + "isAttribute ="             + isAttribute + "\n";
         str = str + "isNillable = "             + isNillable + "\n";
         str = str + "isOptional = "             + isOptional + "\n";
+        
+        str = str + "isSimpleType ="          + isSimpleType + "\n";
+        str = str + "maxOccurs ="             + maxOccurs + "\n";
+        str = str + "minOccurs ="             + minOccurs + "\n";
+        str = str + "typeName = "             + typeName + "\n";
+        str = str + "choiceElement = "        + isChoiceElement + "\n";
+        str = str + "allElement ="            + isAllElement + "\n";
+        str = str + "nsQualified ="           + isNamespaceQualified + "\n";
         str = str + "------------END ParameterInfo-------------\n";
 
         return str;
@@ -237,4 +264,106 @@
     {
         this.methodName = methodName;
     }
+    
+    /**
+     * @return String
+     */
+    public String getTypeName()
+    {
+        return typeName;
+    }
+
+    /**
+     * Sets the typeName.
+     * @param typeName The typeName to set
+     */
+    public void setTypeName(String typeName)
+    {
+        this.typeName = typeName;
+    }
+
+    /**
+     * @return boolean
+     */
+    public boolean isSimpleType()
+    {
+        return isSimpleType;
+    }
+
+    /**
+     * Sets the isSimpleType.
+     * @param isSimpleType The isSimpleType to set
+     */
+    public void setSimpleType(boolean isSimpleType)
+    {
+        this.isSimpleType = isSimpleType;
+    }
+
+    //getter and setter for choiceElement
+    public boolean getChoiceElement()
+    {
+        return this.isChoiceElement;
+    }
+    
+    public void setChoiceElement(boolean newChoiceElement)
+    {
+        this.isChoiceElement=newChoiceElement;
+    }
+    
+    //getter and setter for allElement
+    public boolean getAllElement()
+    {
+        return this.isAllElement;
+    }
+    
+    public void setAllElement(boolean newAllElement)
+    {
+        this.isAllElement=newAllElement;
+    }
+    
+    /**
+     * Getter and setter for the field nsQualified 
+     */
+    public boolean getNsQualified()
+    {
+        return isNamespaceQualified;
+    }
+    
+    public void setNsQualified(boolean nsQual)
+    {
+        isNamespaceQualified = nsQual;
+    }
+
+    /**
+     * @return int
+     */
+    public int getMaxOccurs()
+    {
+        return this.maxOccurs;
+    }
+
+    /**
+     * @return int
+     */
+    public int getMinOccurs()
+    {
+        return this.minOccurs;
+    }
+    /**
+     * Sets the maxOccurs.
+     * @param maxOccurs The maxOccurs to set
+     */
+    public void setMaxOccurs(int maxOccurs)
+    {
+        this.maxOccurs = maxOccurs;
+    }
+
+    /**
+     * Sets the minOccurs.
+     * @param minOccurs The minOccurs to set
+     */
+    public void setMinOccurs(int minOccurs)
+    {
+        this.minOccurs = minOccurs;
+    }
 }