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/03/16 05:27:31 UTC

svn commit: r386256 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal: AllParamWriter.java ParamCPPFileWriter.java ServiceHeaderWriter.java

Author: nadiramra
Date: Wed Mar 15 20:27:29 2006
New Revision: 386256

URL: http://svn.apache.org/viewcvs?rev=386256&view=rev
Log:
Format code so more readable - align braces, etc.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParamCPPFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ServiceHeaderWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java?rev=386256&r1=386255&r2=386256&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java Wed Mar 15 20:27:29 2006
@@ -51,18 +51,11 @@
 
     private File getFilePath(String filename) throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapInfo().getTargetOutputLocation();
+        String targetOutputLocation = this.wscontext.getWrapInfo().getTargetOutputLocation();
         if (targetOutputLocation.endsWith("/"))
-        {
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
-        }
+            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
         new File(targetOutputLocation).mkdirs();
-        String fileName =
-            targetOutputLocation + "/" + filename + CUtils.CPP_HEADER_SUFFIX;
+        String fileName = targetOutputLocation + "/" + filename + CUtils.CPP_HEADER_SUFFIX;
         return new File(fileName);
     }
 
@@ -79,73 +72,56 @@
             try
             {
                 type = (Type) enu.next();
-                    if (type.isArray())
-                    {
-                        if (WSDL2Ws.verbose)
-                        {
-                            System.out.println("Array writer called ......");
-                        }
-                        QName qname = type.getName();
+                if (type.isArray())
+                {
+                    if (WSDL2Ws.verbose)
+                        System.out.println("Array writer called ......");
 
-                        
-                        String elementType = type.getElementType();
-                        elementType = elementType.replace('>', '_');
-                        QName elementQname = new QName(qname.getNamespaceURI(), elementType);
-                        Type currentType = wscontext.getTypemap().getType(elementQname);
-                        if (currentType != null)
-                        {
-                            if ( currentType.isSimpleType())
-                            {
-                                continue;
-                            }
-                        }
-                        
-                        if (CUtils.isSimpleType(qname)
-                            && !CUtils.isDefinedSimpleType(qname))
-                        {
-                            throw new WrapperFault(
-                                "No need to create an Array for simple type "
-                                    + qname
-                                    + "\n"
-                                    + "It seems that some thing wrong with symbolTable population - Susantha");
-                        }
-                        ArrayParamHeaderWriter writer =
-                            (new ArrayParamHeaderWriter(wscontext, type));
-                        if (!writer.isSimpleTypeArray())
-                        {
-                            writer.writeSource();
-                            (new ArrayParamWriter(wscontext, type)).writeSource();
-                        }
+                    QName qname = type.getName();
+                    
+                    String elementType = type.getElementType();
+                    elementType = elementType.replace('>', '_');
+                    QName elementQname = new QName(qname.getNamespaceURI(), elementType);
+                    
+                    Type currentType = wscontext.getTypemap().getType(elementQname);
+                    if (currentType != null)
+                        if ( currentType.isSimpleType())
+                            continue;
+                    
+                    if (CUtils.isSimpleType(qname)
+                        && !CUtils.isDefinedSimpleType(qname))
+                    {
+                        throw new WrapperFault(
+                            "No need to create an Array for simple type "
+                                + qname
+                                + ". It seems that some thing wrong with symbolTable population");
                     }
-                    else
+                    
+                    ArrayParamHeaderWriter writer = (new ArrayParamHeaderWriter(wscontext, type));
+                    if (!writer.isSimpleTypeArray())
                     {
-                        /* TODO check whether this type is referenced or not. Synthesize only if  reference
-                         * But of cause that depends on the commandline option too  */
-                        if (type.getLanguageSpecificName().startsWith(">"))
-                        {
-                            /* TODO do some processing to this type before synthesizing to remove ">" charactors.
-                             * And then it should also be synthesized if commandline option says to */
-                            if(WSDL2Ws.verbose)
-                            {
-                                System.out.println(
-                                "ignoring anonymous type "
-                                    + type.getLanguageSpecificName()
-                                    + "\n");
-                            }
-                        }
-                        else
-                        {
-                            if (WSDL2Ws.verbose)
-                            {
-                                System.out.println(
-                                    "struct writer called ......");
-                            }
-                            (new BeanParamWriter(wscontext, type))
-                                .writeSource();
-                            (new ParmHeaderFileWriter(wscontext, type))
-                                .writeSource();
-                        }
+                        writer.writeSource();
+                        (new ArrayParamWriter(wscontext, type)).writeSource();
                     }
+                }
+                /* TODO check whether this type is referenced or not. Synthesize only if  reference
+                 * But of course that depends on the commandline option too  */
+                else if (type.getLanguageSpecificName().startsWith(">"))
+                {
+                    /* TODO do some processing to this type before synthesizing to remove ">" charactors.
+                     * And then it should also be synthesized if commandline option says to */
+                    if(WSDL2Ws.verbose)
+                        System.out.println(
+                                "ignoring anonymous type " + type.getLanguageSpecificName() + "\n");
+                }
+                else
+                {
+                    if (WSDL2Ws.verbose)
+                        System.out.println("struct writer called ......");
+
+                    (new BeanParamWriter(wscontext, type)).writeSource();
+                    (new ParmHeaderFileWriter(wscontext, type)).writeSource();
+                }
             }
             catch (Exception e)
             {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParamCPPFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParamCPPFileWriter.java?rev=386256&r1=386255&r2=386256&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParamCPPFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParamCPPFileWriter.java Wed Mar 15 20:27:29 2006
@@ -54,14 +54,12 @@
     {
         try
         {
-            this.writer =
-                new BufferedWriter(new FileWriter(getFilePath(), false));
+            this.writer = new BufferedWriter(new FileWriter(getFilePath(), false));
             writeClassComment();
             writePreprocessorStatements();
+            
             if (type.isSimpleType())
-            {
                 writeRestrictionCheckerFunction();
-            }
             else
             {
                 writeGlobalCodes();
@@ -70,11 +68,11 @@
                 writeDestructors();
                 writeMethods();
             }
+            
             writer.flush();
             writer.close();
             if (WSDL2Ws.verbose)
-                System.out.println(
-                    getFilePath().getAbsolutePath() + " created.....");
+                System.out.println(getFilePath().getAbsolutePath() + " created.....");
         }
         catch (IOException e)
         {
@@ -90,19 +88,11 @@
     {
         classname = CUtils.sanitiseClassName( classname);
 
-        String targetOutputLocation =
-            this.wscontext.getWrapInfo().getTargetOutputLocation();
+        String targetOutputLocation = this.wscontext.getWrapInfo().getTargetOutputLocation();
         if (targetOutputLocation.endsWith("/"))
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
+            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
         new File(targetOutputLocation).mkdirs();
-        String fileName =
-            targetOutputLocation
-                + "/"
-                + this.classname
-                + CUtils.CPP_CLASS_SUFFIX;
+        String fileName = targetOutputLocation + "/" + this.classname + CUtils.CPP_CLASS_SUFFIX;
         this.wscontext.addGeneratedFile(classname + CUtils.CPP_CLASS_SUFFIX);
         return new File(fileName);
     }
@@ -113,11 +103,7 @@
         {
             writer.write("#include <axis/AxisWrapperAPI.hpp>\n");
             writer.write("#include <axis/Axis.hpp>\n\n");
-            writer.write(
-                "#include \""
-                    + this.classname
-                    + CUtils.CPP_HEADER_SUFFIX
-                    + "\"\n");
+            writer.write("#include \"" + this.classname + CUtils.CPP_HEADER_SUFFIX + "\"\n");
         }
         catch (IOException e)
         {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ServiceHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ServiceHeaderWriter.java?rev=386256&r1=386255&r2=386256&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ServiceHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ServiceHeaderWriter.java Wed Mar 15 20:27:29 2006
@@ -95,19 +95,16 @@
             {
                 atype = (Type) types.next();
                 if (atype.getLanguageSpecificName().startsWith(">"))
-                {
                     continue;
-                }
+
                 typeSet.add(atype.getLanguageSpecificName());
             }
+            
             Iterator itr = typeSet.iterator();
             while (itr.hasNext())
             {
                 writer.write(
-                    "#include \""
-                        + itr.next().toString()
-                        + CUtils.CPP_HEADER_SUFFIX
-                        + "\"\n");
+                    "#include \"" + itr.next().toString() + CUtils.CPP_HEADER_SUFFIX + "\"\n");
             }
 
             //writeFaultHeaders();