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 2006/10/20 04:24:04 UTC

svn commit: r465950 - /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java

Author: nadiramra
Date: Thu Oct 19 19:24:01 2006
New Revision: 465950

URL: http://svn.apache.org/viewvc?view=rev&rev=465950
Log:
Remove braces around single line if-statements. makes code bloated and 
unreadable.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java

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?view=diff&rev=465950&r1=465949&r2=465950
==============================================================================
--- 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 Oct 19 19:24:01 2006
@@ -152,22 +152,16 @@
 
         Binding binding = null;
         if (ports.hasNext())
-        {
             binding = ((Port) ports.next()).getBinding();
-        }
         
         if (binding == null)
-        {
             throw new WrapperFault("No binding specified");
-        }
         
         this.bindingEntry = symbolTable.getBindingEntry(binding.getQName());
 
         this.portTypeEntry = symbolTable.getPortTypeEntry(binding.getPortType().getQName());
         if (portTypeEntry == null)
-        {
             throw new WrapperFault("Service not found");
-        }
         
         ports = this.serviceentry.getService().getPorts().values().iterator();
         this.targetEndpointURI = SymbolTableParsingUtils.getTargetEndPointURI(ports);
@@ -198,7 +192,6 @@
         
         List operations = bindingEntry.getBinding().getBindingOperations();
         if (operations != null)
-        {
             for (int i = 0; i < operations.size(); i++)
             {
                 //for the each binding operation found
@@ -212,7 +205,6 @@
                     SymbolTableParsingUtils.getOutputInfo(bindinop.getBindingOutput(), method);
                 }
             }
-        }
     }
 
     /**
@@ -249,28 +241,19 @@
         
         //add each parameter to parameter list
         if ("document".equals(bindingEntry.getBindingStyle().getName()))
-        {
             this.addDocumentStyleInputMessageToMethodInfo(op, minfo);
-        }
         else
-        {
             this.addRPCStyleInputMessageToMethodInfo(op, minfo);
-        }
+
         //get the return type
         if (op.getOutput() != null)
         {
             Iterator returnlist = op.getOutput().getMessage().getParts().values().iterator();
             if (returnlist.hasNext()
                     && "document".equals(bindingEntry.getBindingStyle().getName()))
-            {
-                this.addDocumentStyleOutputMessageToMethodInfo(
-                    minfo,
-                    (Part) returnlist.next());
-            }
+                this.addDocumentStyleOutputMessageToMethodInfo(minfo, (Part) returnlist.next());
             else
-            {
                 this.addRPCStyleOutputMessageToMethodInfo(op, minfo);
-            }
         }
         
         return minfo;
@@ -298,54 +281,36 @@
                                    .getMessage()
                                    .getParts()
                                    .get((String) op.getParameterOrdering().get(ix)));
-                
                 if (p == null)
-                {
                     continue;
-                }
-                
                 pinfo = createParameterInfo(p);
-                
                 if (null != pinfo)
-                {
                     minfo.addOutputParameter(pinfo);
-                }
             }
             
             /* there can be more output parameters than in parameterOrder list (partial parameter ordering) */
             returnlist = op.getOutput().getMessage().getParts().values().iterator();
             while (returnlist.hasNext())
-            { //RPC style messages can have multiple parts
+            { 
+                //RPC style messages can have multiple parts
                 Part p = (Part) returnlist.next();
-                
                 if (op.getParameterOrdering().contains(p.getName()))
-                {
                     continue;
-                }
-                
                 pinfo = createParameterInfo(p);
-                
                 if (null != pinfo)
-                {
                     minfo.addOutputParameter(pinfo);
-                }
             }
         }
         else
         {
             returnlist = op.getOutput().getMessage().getParts().values().iterator();
-            
             while (returnlist.hasNext())
             { 
                 //RPC style messages can have multiple parts
                 Part p = ((Part) returnlist.next());
-                
                 pinfo = createParameterInfo(p);
-                
                 if (null != pinfo)
-                {
                     minfo.addOutputParameter(pinfo);
-                }
             }
         }
     }
@@ -363,6 +328,7 @@
         ParameterInfo pinfo;
         Type type;
         QName minfoqname;
+        
         element = symbolTable.getElement(part.getElementName());
         if (element == null)
         {
@@ -384,29 +350,19 @@
             boolean wrapped = wsdlWrappingStyle;
 
             if (type == null)
-            {
                 throw new WrapperFault("Unregistered type " + qname + " referred");
-            }
+
             //get inner attributes and elements and add them as parameters 
             if (wrapped)
-            {
-                //get inner attributes and elements and add them as parameters 
                 addOutputElementsToMethodInfo(minfo, type);
-            }
             else
             { 
                 // for non-wrapped style wsdl's
                 String elementName = (String) element.getQName().getLocalPart();
-                
                 pinfo = new ParameterInfo(type, elementName);
-                
                 pinfo.setElementName(type.getName());
-                
                 if (type.getName().equals(CUtils.anyTypeQname))
-                {
                     pinfo.setAnyType(true);
-                }
-                
                 minfo.addOutputParameter(pinfo);
             }
         }
@@ -422,45 +378,35 @@
         ElementInfo eleinfo;
         ArrayList elementlist = new ArrayList();
         Iterator names = type.getElementnames();
-        
         while (names.hasNext())
         {
             elementlist.add(names.next());
         }
         
         Type innerType;
-        
         for (int i = 0; i < elementlist.size(); i++)
         {
             String elementname = (String) elementlist.get(i);
-            
             eleinfo = type.getElementForElementName(elementname);
             innerType = eleinfo.getType();
+            
             pinfo = new ParameterInfo(innerType, elementname);
             
             if (eleinfo.getMaxOccurs() > 1)
-            {
                 pinfo.setArray(true);
-            }
             
             pinfo.setNillable(eleinfo.getNillable());
             
             if (eleinfo.getMinOccurs() == 0)
-            {
                 pinfo.setOptional(true);
-            }
             else
-            {
                 pinfo.setOptional(false);
-            }
-            
+
             pinfo.setElementName(type.getElementForElementName(elementname).getName());
             
             if (innerType.getName().equals(CUtils.anyTypeQname))
-            {
                 pinfo.setAnyType(true);
-            }
-            
+
             minfo.addOutputParameter(pinfo);
         }
     }
@@ -477,7 +423,6 @@
         Iterator paramlist;
 
         minfo.setInputMessage(op.getInput().getMessage().getQName());
-        
         if (op.getParameterOrdering() != null)
         {
             for (int ix = 0; ix < op.getParameterOrdering().size(); ix++)
@@ -486,35 +431,24 @@
                                    .getMessage()
                                    .getParts()
                                    .get((String) op.getParameterOrdering().get(ix)));
-                
                 if (p == null)
-                {
                     continue;
-                }
-                
+
                 pinfo = createParameterInfo(p);
-                
                 if (null != pinfo)
-                {
                     minfo.addInputParameter(pinfo);
-                }
             }
         }
         else
         {
             paramlist = op.getInput().getMessage().getParts().values().iterator();
-            
             while (paramlist.hasNext())
             { 
                 //RPC style messages can have multiple parts
                 Part p = (Part) paramlist.next();
-                
                 pinfo = createParameterInfo(p);
-                
                 if (null != pinfo)
-                {
                     minfo.addInputParameter(pinfo);
-                }
             }
         }
     }
@@ -562,13 +496,10 @@
             if (qname != null)
             {
                 type = this.typeMap.getType(qname);
-            
                 boolean wrapped = wsdlWrappingStyle;
     
                 if (type == null)
-            {
                     throw new WrapperFault("unregistered type " + qname + " referred");
-            }
     
                 if (wrapped)
                 {
@@ -581,14 +512,10 @@
                     // for non-wrapped style wsdl's
                     String elementName = (String) element.getQName().getLocalPart();
                     pinfo = new ParameterInfo(type, elementName);
-                
                     pinfo.setElementName(type.getName());
-                
                     if (type.getName().equals(CUtils.anyTypeQname))
-                {
                         pinfo.setAnyType(true);
-                }
-                
+
                     minfo.addInputParameter(pinfo);
                 }
             }
@@ -604,7 +531,6 @@
         ParameterInfo pinfo;
         ArrayList attributeList = new ArrayList();
         Iterator attributeNames = type.getAttributeNames();
-
         while (attributeNames.hasNext())
         {
             attributeList.add(attributeNames.next());
@@ -614,11 +540,10 @@
         {
             String attributeName = (String) attributeList.get(i);
             Type innerType = type.getTypForAttribName(attributeName);
-            
             pinfo = new ParameterInfo(innerType, attributeName);
-            
             pinfo.setElementName(type.getTypForAttribName(attributeName).getName());
             pinfo.setAttribute(true);
+            
             minfo.addInputParameter(pinfo);
         }
     }
@@ -647,27 +572,20 @@
             pinfo = new ParameterInfo(innerType, elementname);
             
             if (eleinfo.getMaxOccurs() > 1)
-            {
                 pinfo.setArray(true);
-            }
-            
+
             pinfo.setElementName(type.getElementForElementName(elementname).getName());
             
             if (innerType.getName().equals(CUtils.anyTypeQname))
-            {
                 pinfo.setAnyType(true);
-            }
             
             pinfo.setNillable(eleinfo.getNillable());
             
             if (eleinfo.getMinOccurs() == 0)
-            {
                 pinfo.setOptional(true);
-            }
             else
-            {
                 pinfo.setOptional(false);
-            }
+
             minfo.addInputParameter(pinfo);
         }
     }
@@ -684,9 +602,7 @@
         while (it.hasNext())
         {
             type = (TypeEntry) it.next();
-            
             Node node = type.getNode();
-            
             if (node != null)
             {
                 if (WSDL2Ws.verbose)
@@ -710,46 +626,28 @@
     {
 
         if (targetLanguage == null)
-        {
             targetLanguage = "c++";
-        }
-        
         if (targetEngine == null)
-        {
             targetEngine = "server";
-        }
-        
         if (targetoutputLocation == null)
-        {
             targetoutputLocation = "./";
-        }
-        
         if (wsdlWrapStyle == null)
-        {
             wsdlWrapStyle = "wrapped";
-        }
-        
+
         this.language = targetLanguage;
 
         if (wsdlWrapStyle.equalsIgnoreCase("wrapped"))
-        {
             this.wsdlWrappingStyle = true;
-        }
         else
-        {
             this.wsdlWrappingStyle = false;
-        }
 
         preprocess();
 
         CUtils.setLanguage(language);
-        
         QName serviceqname = serviceentry.getService().getQName();
-        
         servicename = serviceqname.getLocalPart();
         typeMap = this.getTypeInfo(targetLanguage);
         methods = this.getServiceInfo(this.portTypeEntry.getPortType());
-        
         this.getWebServiceInfo();
 
         //TODO    check whether the name at the WrapperConstant Doclit is right "doc"
@@ -767,9 +665,7 @@
         WebServiceGenerator wsg = WebServiceGeneratorFactory.createWebServiceGenerator(wsContext);
         
         if (wsg == null)
-        {
             throw new WrapperFault("WSDL2Ws does not support the option combination");
-        }
         
         exposeReferenceTypes(wsContext);
         exposeMessagePartsThatAreAnonymousTypes(wsContext);
@@ -780,7 +676,6 @@
             System.out.println( "Dumping typeMap....");
             
             Iterator it = typeMap.getTypes().iterator();
-            
             while (it.hasNext())
             {
                 System.out.println(it.next());
@@ -809,9 +704,7 @@
                 SymTabEntry entry = (SymTabEntry) v.elementAt(i);
 
                 if (entry instanceof ServiceEntry)
-                {
                     return (ServiceEntry) entry;
-                }
             }
         }
         throw new WrapperFault("the service does not exists");
@@ -849,9 +742,8 @@
         
         // Do not add types which are not used in the wsdl
         if (!type.isReferenced())
-        {
             return null;
-        }
+        
         if (WSDL2Ws.verbose && !typeMap.isSimpleType(type.getQName()))
             System.out.println("Attempting to create type: " + type.getQName());
         
@@ -876,15 +768,11 @@
         { 
             /* it seems that this is an array */
             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.isBasicType(qn))
                 return null;
@@ -957,9 +845,7 @@
                 //types declared as simpleType
                 restrictdata = CUtils.getRestrictionBaseAndValues(node, symbolTable);
                 if (restrictdata != null)
-                {
                     typedata.setRestrictiondata(restrictdata);
-                }
             }
             
             // There can be attributes in this extended basic type
@@ -1185,9 +1071,7 @@
 
         Type type = this.typeMap.getType(qname);
         if (type == null)
-        {
             throw new WrapperFault("unregistered type " + qname + " referred");
-        }
         ParameterInfo parainfo = new ParameterInfo(type, part.getName());
         parainfo.setElementName(part.getElementName());
         return parainfo;
@@ -1196,12 +1080,8 @@
     private MethodInfo getMethodInfoByName(String name) throws WrapperFault
     {
         for (int i = 0; i < methods.size(); i++)
-        {
             if (((MethodInfo) methods.get(i)).getMethodname().equals(name))
-            {
                 return (MethodInfo) methods.get(i);
-            }
-        }
         
         throw new WrapperFault("binding and the port type do not match");
     }
@@ -1225,11 +1105,9 @@
         // get the main types
         Collection types = symbolTable.getTypeIndex().values();
         Iterator typeIterator = types.iterator();   
-        
         while(typeIterator.hasNext())
         {
             Object highLevelType = typeIterator.next();
-            
             if(!(highLevelType instanceof BaseType))
             {
                 DefinedType type = (DefinedType)highLevelType;



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org