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/28 18:10:45 UTC

svn commit: r389530 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c: AllParamWriter.java ArrayParamWriter.java HeaderFileWriter.java ParmHeaderFileWriter.java WrapHeaderWriter.java

Author: nadiramra
Date: Tue Mar 28 08:10:43 2006
New Revision: 389530

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

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/AllParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/WrapHeaderWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/AllParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/AllParamWriter.java?rev=389530&r1=389529&r2=389530&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/AllParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/AllParamWriter.java Tue Mar 28 08:10:43 2006
@@ -58,45 +58,33 @@
             try
             {
                 type = (Type) enu.next();
-                    if (type.isArray())
-                    {
-                        if (WSDL2Ws.verbose)
-                            System.out.println("Array writer called ......");
-                        ArrayParamWriter writer =
-                            (new ArrayParamWriter(wscontext, type));
-                        if (!writer.isSimpleTypeArray())
-                            writer.writeSource();
-                    }
-                    else
-                    {
-                        /* 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 */
-                            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();
-                        }
-                    }
+                if (type.isArray())
+                {
+                    if (WSDL2Ws.verbose)
+                        System.out.println("Array writer called ......");
+                    ArrayParamWriter writer = (new ArrayParamWriter(wscontext, type));
+                    if (!writer.isSimpleTypeArray())
+                        writer.writeSource();
+                }
+                /* TODO check whether this type is referenced or not. Synthesize only if  reference
+                 * But of cause 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 */
+                    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)
             {
-                System.out.println(
-                        "Error occurred generating code for "
-                            + type.getLanguageSpecificName()
+                System.out.println("Error occurred generating code for " + type.getLanguageSpecificName()
                             + ". Other classes will continue to be generated.");
                 e.printStackTrace();
             }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java?rev=389530&r1=389529&r2=389530&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java Tue Mar 28 08:10:43 2006
@@ -68,59 +68,33 @@
     {
         try
         {
-            this.writer =
-                new BufferedWriter(new FileWriter(getFilePath(), false));
+            this.writer = new BufferedWriter(new FileWriter(getFilePath(), false));
             writeClassComment();
             // if this headerfile not defined define it 
-            this.writer.write(
-                "#if !defined(__"
-                    + classname.toUpperCase()
-                    + "_"
-                    + getFileType().toUpperCase()
-                    + "_H__INCLUDED_)\n");
-            this.writer.write(
-                "#define __"
-                    + classname.toUpperCase()
-                    + "_"
-                    + getFileType().toUpperCase()
-                    + "_H__INCLUDED_\n\n");
+            this.writer.write("#if !defined(__"  + classname.toUpperCase() + "_"
+                    + getFileType().toUpperCase() + "_H__INCLUDED_)\n");
+            this.writer.write("#define __" + classname.toUpperCase() + "_"
+                    + getFileType().toUpperCase() + "_H__INCLUDED_\n\n");
             if (attribs.length != 1)
             {
-                System.out.println(
-                    "Array "
-                        + classname
-                        + " contains unexpected no of variables");
-                throw new WrapperFault(
-                    "Array type "
-                        + classname
-                        + " contain unexpected no of types");
+                System.out.println("Array " + classname + " contains unexpected no of variables");
+                throw new WrapperFault("Array type " + classname + " contain unexpected no of types");
             }
+            
             //include header file for the contained type
             QName qname = WrapperUtils.getArrayType(type).getName();
             if (!CUtils.isSimpleType(qname))
-            {
-                writer.write(
-                    "#include \""
-                        + attribs[0].getTypeName()
-                        + CUtils.C_HEADER_SUFFIX
-                        + "\"\n\n");
-            }
+                writer.write("#include \"" + attribs[0].getTypeName() + CUtils.C_HEADER_SUFFIX + "\"\n\n");
             else
-            {
                 writer.write("#include <axis/server/AxisUserAPI.h>\n\n");
-            }
+
             writeArrayStruct();
-            this.writer.write(
-                "#endif /* !defined(__"
-                    + classname.toUpperCase()
-                    + "_"
-                    + getFileType().toUpperCase()
-                    + "_H__INCLUDED_)*/\n");
+            this.writer.write("#endif /* !defined(__" + classname.toUpperCase() + "_"
+                    + getFileType().toUpperCase() + "_H__INCLUDED_)*/\n");
             writer.flush();
             writer.close();
             if (WSDL2Ws.verbose)
-                System.out.println(
-                    getFilePath().getAbsolutePath() + " created.....");
+                System.out.println(getFilePath().getAbsolutePath() + " created.....");
         }
         catch (IOException e)
         {
@@ -145,26 +119,16 @@
         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 + "/" + classname + CUtils.C_HEADER_SUFFIX;
+        String fileName = targetOutputLocation + "/" + classname + CUtils.C_HEADER_SUFFIX;
 
         if (useServiceName)
         {
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + this.wscontext.getSerInfo().getServicename()
-                    + "_"
-                    + classname
-                    + CUtils.C_HEADER_SUFFIX;
+            fileName = targetOutputLocation + "/" + this.wscontext.getSerInfo().getServicename()
+                    + "_" + classname + CUtils.C_HEADER_SUFFIX;
         }
 
         return new File(fileName);
@@ -181,12 +145,12 @@
             /*
              * Needed for self referenced  array else compilation failed.
              * <xsd:complexType name="Type1">
-             *	<xsd:sequence>
-             *		<xsd:element name="followings" maxOccurs="unbounded" minOccurs="0" type="tns:Type1" />
-             *		<xsd:element name="kind" type="xsd:string" />
-             *		<xsd:element name="index" type="xsd:int" />
-             *	</xsd:sequence>
-             *	<xsd:attribute name="att_kind" type="tns:Kind" />
+             *    <xsd:sequence>
+             *        <xsd:element name="followings" maxOccurs="unbounded" minOccurs="0" type="tns:Type1" />
+             *        <xsd:element name="kind" type="xsd:string" />
+             *        <xsd:element name="index" type="xsd:int" />
+             *    </xsd:sequence>
+             *    <xsd:attribute name="att_kind" type="tns:Kind" />
              * </xsd:complexType>
              */
             //writer.write("\t"+attribs[0].getTypeName()+"* m_Array;\n\tint m_Size;\n} "+classname+";\n\n");
@@ -196,12 +160,9 @@
             }
             else
             {
-                writer.write(
-                    "\tstruct "
-                        + attribs[0].getTypeName()
+                writer.write("\tstruct " + attribs[0].getTypeName()
                         + "Tag * m_Array;\n\tint m_Size;\n\tAXISC_XSD_TYPE m_Type;\n} "
-                        + classname
-                        + ";\n\n");
+                        + classname + ";\n\n");
             }
         }
         catch (IOException e)

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java?rev=389530&r1=389529&r2=389530&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/HeaderFileWriter.java Tue Mar 28 08:10:43 2006
@@ -54,20 +54,23 @@
         try
         {
             this.writer = new BufferedWriter(new FileWriter(getFilePath(), false));
+            
             writeClassComment();
+            
             // if this headerfile not defined define it 
-            this.writer.write(
-                "#if !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)\n");
-            this.writer.write(
-                "#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
+            this.writer.write("#if !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)\n");
+            this.writer.write("#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
+            
             //includes
             writePreprocessorStatements();
+            
             //class
             writeAttributes();
             writeMethods();
             this.writer.write("\n\n");
-            this.writer.write(
-                "#endif /* !defined(__" + classname.toUpperCase() + "_H__INCLUDED_) */\n");
+            
+            this.writer.write("#endif /* !defined(__" + classname.toUpperCase() + "_H__INCLUDED_) */\n");
+            
             //cleanup
             writer.flush();
             writer.close();
@@ -97,24 +100,14 @@
     {
         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 + "/" + classname + ".h";
 
         if (useServiceName)
-        {
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + this.getServiceName()
-                    + "_"
-                    + classname
-                    + ".h";
-        }
+            fileName = targetOutputLocation + "/" + this.getServiceName() + "_" + classname + ".h";
 
         return new File(fileName);
     }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java?rev=389530&r1=389529&r2=389530&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java Tue Mar 28 08:10:43 2006
@@ -58,29 +58,20 @@
     {
         try
         {
-            this.writer =
-                new BufferedWriter(new FileWriter(getFilePath(), false));
+            this.writer = new BufferedWriter(new FileWriter(getFilePath(), false));
             writeClassComment();
             // if this headerfile not defined define it 
-            this.writer.write(
-                "#if !defined(__"
-                    + classname.toUpperCase()
-                    + "_H__INCLUDED_)\n");
-            this.writer.write(
-                "#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
+            this.writer.write("#if !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)\n");
+            this.writer.write("#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
             writePreprocessorStatements();
             this.writer.write("typedef struct " + classname + "Tag {\n");
             writeAttributes();
             this.writer.write("} " + classname + ";\n\n");
-            this.writer.write(
-                "#endif /* !defined(__"
-                    + classname.toUpperCase()
-                    + "_H__INCLUDED_)*/\n");
+            this.writer.write("#endif /* !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)*/\n");
             writer.flush();
             writer.close();
             if (WSDL2Ws.verbose)
-                System.out.println(
-                    getFilePath().getAbsolutePath() + " created.....");
+                System.out.println(getFilePath().getAbsolutePath() + " created.....");
         }
         catch (IOException e)
         {
@@ -105,14 +96,8 @@
             }
             for (int i = 0; i < attribs.length; i++)
             {
-                //if((t = wscontext.getTypemap().getType(new QName(attribs[i][2],attribs[i][3])))!= null && t.isArray()) continue;
-                writer.write(
-                    "\t"
-                        + getCHeaderFileCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
-                        + " "
-                        + attribs[i].getParamName()
-                        + ";\n");
-
+                writer.write("\t" + getCHeaderFileCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+                        + " " + attribs[i].getParamName() + ";\n");
             }
         }
         catch (IOException e)
@@ -155,24 +140,16 @@
         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 + "/" + classname + CUtils.C_HEADER_SUFFIX;
+        String fileName = targetOutputLocation + "/" + classname + CUtils.C_HEADER_SUFFIX;
 
         if (useServiceName)
         {
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + this.wscontext.getSerInfo().getServicename()
-                    + "_"
-                    + classname
-                    + CUtils.C_HEADER_SUFFIX;
+            fileName = targetOutputLocation + "/"
+                    + this.wscontext.getSerInfo().getServicename() + "_"
+                    + classname + CUtils.C_HEADER_SUFFIX;
         }
 
         return new File(fileName);
@@ -190,42 +167,29 @@
             writer.write("#include <axis/server/AxisUserAPI.h>\n\n");
             HashSet typeSet = new HashSet();
             String typeName = null;
+            
             while (types.hasNext())
             {
                 atype = (Type) types.next();
                 if (!(atype.equals(this.type)))
-                {
                     if (this.type.isContainedType(atype))
                     {
                         typeName = WrapperUtils.getLanguageTypeName4Type(atype);
                         if (null != typeName)
                             typeSet.add(typeName);
                     }
-                }
             }
+            
             Iterator itr = typeSet.iterator();
             while (itr.hasNext())
             {
-                writer.write(
-                    "#include \""
-                        + itr.next().toString()
-                        + CUtils.C_HEADER_SUFFIX
-                        + "\"\n");
+                writer.write("#include \"" + itr.next().toString() + CUtils.C_HEADER_SUFFIX + "\"\n");
             }
             writer.write("/*Local name and the URI for the type*/\n");
-            writer.write(
-                "static const char* Axis_URI_"
-                    + classname
-                    + " = \""
-                    + type.getName().getNamespaceURI()
-                    + "\";\n");
-            writer.write(
-                "static const char* Axis_TypeName_"
-                    + classname
-                    + " = \""
-                    + type.getName().getLocalPart()
-                    + "\";\n\n");
-
+            writer.write("static const char* Axis_URI_" + classname
+                    + " = \"" + type.getName().getNamespaceURI() + "\";\n");
+            writer.write("static const char* Axis_TypeName_" + classname
+                    + " = \"" + type.getName().getLocalPart()+ "\";\n\n");
         }
         catch (IOException e)
         {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/WrapHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/WrapHeaderWriter.java?rev=389530&r1=389529&r2=389530&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/WrapHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/WrapHeaderWriter.java Tue Mar 28 08:10:43 2006
@@ -49,20 +49,20 @@
         try
         {
             writer.write("/*\n");
-			writer.write(" * Copyright 2003-2006 The Apache Software Foundation.\n\n");
-			writer.write(" *\n");
-			writer.write(" * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
-			writer.write(" * you may not use this file except in compliance with the License.\n");
-			writer.write(" * You may obtain a copy of the License at\n");
-			writer.write(" *\n");
-			writer.write(" *\t\thttp://www.apache.org/licenses/LICENSE-2.0\n");
-			writer.write(" *\n");
-			writer.write(" * Unless required by applicable law or agreed to in writing, software\n");
-			writer.write(" * distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-			writer.write(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-			writer.write(" * See the License for the specific language governing permissions and\n");
-			writer.write(" * limitations under the License.\n");
-			writer.write(" *\n");
+            writer.write(" * Copyright 2003-2006 The Apache Software Foundation.\n\n");
+            writer.write(" *\n");
+            writer.write(" * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
+            writer.write(" * you may not use this file except in compliance with the License.\n");
+            writer.write(" * You may obtain a copy of the License at\n");
+            writer.write(" *\n");
+            writer.write(" *\t\thttp://www.apache.org/licenses/LICENSE-2.0\n");
+            writer.write(" *\n");
+            writer.write(" * Unless required by applicable law or agreed to in writing, software\n");
+            writer.write(" * distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            writer.write(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            writer.write(" * See the License for the specific language governing permissions and\n");
+            writer.write(" * limitations under the License.\n");
+            writer.write(" *\n");
             writer.write(" * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)\n");
             writer.write(" * This file contains Web Service Wrapper declarations\n");
             writer.write(" */\n\n");
@@ -81,31 +81,19 @@
         try
         {
             writer.write("/*implementation of BasicHandler interface*/\n");
-            writer.write(
-                "int AXISCALL " + classname + "_Invoke(void*p, void* pMsg);\n");
-            writer.write(
-                "void AXISCALL "
-                    + classname
-                    + "_OnFault(void*p, void* pMsg);\n");
+            writer.write("int AXISCALL " + classname + "_Invoke(void*p, void* pMsg);\n");
+            writer.write("void AXISCALL " + classname + "_OnFault(void*p, void* pMsg);\n");
             writer.write("int AXISCALL " + classname + "_Init(void*p);\n");
             writer.write("int AXISCALL " + classname + "_Fini(void*p);\n");
             writer.write("int AXISCALL " + classname + "_GetType(void*p);\n");
-            writer.write(
-                "AXIS_BINDING_STYLE AXISCALL "
-                    + classname
-                    + "_GetBindingStyle(void*p);\n");
-            writer.write(
-                "/*Methods corresponding to the web service methods*/\n");
+            writer.write("AXIS_BINDING_STYLE AXISCALL " + classname + "_GetBindingStyle(void*p);\n");
+            writer.write("/*Methods corresponding to the web service methods*/\n");
             MethodInfo minfo;
             for (int i = 0; i < methods.size(); i++)
             {
                 minfo = (MethodInfo) methods.get(i);
-                writer.write(
-                    "int "
-                        + minfo.getMethodname()
-                        + CUtils.WRAPPER_METHOD_APPENDER
-                        + "(IWrapperSoapDeSerializer DZ, IWrapperSoapSerializer SZ);");
-                writer.write("\n");
+                writer.write("int " + minfo.getMethodname() + CUtils.WRAPPER_METHOD_APPENDER
+                        + "(IWrapperSoapDeSerializer DZ, IWrapperSoapSerializer SZ);\n");
             }
         }
         catch (IOException e)