axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r1352716 - in /axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws: WebServiceGeneratorImpl.java c/literal/ClientStubHeaderWriter.java cpp/literal/ClientStubHeaderWriter.java
Date Thu, 21 Jun 2012 22:22:14 GMT
Author: nadiramra
Date: Thu Jun 21 22:22:13 2012
New Revision: 1352716

URL: http://svn.apache.org/viewvc?rev=1352716&view=rev
Log:
Minor, ensure we include types that we generate files for in client stub...

Modified:
    axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorImpl.java
    axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
    axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java

Modified: axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorImpl.java
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorImpl.java?rev=1352716&r1=1352715&r2=1352716&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorImpl.java
(original)
+++ axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorImpl.java
Thu Jun 21 22:22:13 2012
@@ -15,10 +15,6 @@
  *   limitations under the License.
  */
 
-/**
- * @author Srinath Perera(hemapani
- */
-
 package org.apache.axis.wsdl.wsdl2ws;
 
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
@@ -42,6 +38,9 @@ public class WebServiceGeneratorImpl imp
 
         if (WrapperConstants.LANGUAGE_CPP.equalsIgnoreCase(language))
         {
+            // Generate objects common to Client and Server - MUST BE FIRST THING DONE!
+            (new Generator(WrapperConstants.GENERATOR_PARAM_CPP_ALL,wscontext)).generate();
+            
             if (WrapperConstants.SERVER.equals(wscontext.getWrapperInfo().getTargetEngine()))
             {
                 // Generate Server objects
@@ -60,12 +59,12 @@ public class WebServiceGeneratorImpl imp
                 (new Generator(WrapperConstants.GENERATOR_CLIENT_STUB_CPP,wscontext)).generate();
                 (new Generator(WrapperConstants.GENERATOR_CLIENT_STUB_HPP,wscontext)).generate();
             }
-            
-            // Generate objects common to Client and Server
-            (new Generator(WrapperConstants.GENERATOR_PARAM_CPP_ALL,wscontext)).generate();
         }
         else if (WrapperConstants.LANGUAGE_C.equalsIgnoreCase(language))
         {
+            // Generate objects common to Client and Server - MUST BE FIRST THING DONE!
+            (new Generator(WrapperConstants.GENERATOR_PARAM_C_ALL,wscontext)).generate();
+            
             if (WrapperConstants.SERVER.equals(wscontext.getWrapperInfo().getTargetEngine()))
             {
                 // Generate Server objects
@@ -83,8 +82,6 @@ public class WebServiceGeneratorImpl imp
                 (new Generator(WrapperConstants.GENERATOR_CLIENT_STUB_H,wscontext)).generate();
 
             }
-            // Generate objects common to Client and Server
-            (new Generator(WrapperConstants.GENERATOR_PARAM_C_ALL,wscontext)).generate();
         }
         else
         {

Modified: axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java?rev=1352716&r1=1352715&r2=1352716&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
(original)
+++ axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
Thu Jun 21 22:22:13 2012
@@ -17,15 +17,19 @@
 
 package org.apache.axis.wsdl.wsdl2ws.c.literal;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Iterator;
 
+import javax.xml.namespace.QName;
+
 import org.apache.axis.wsdl.wsdl2ws.CUtils;
 import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
 import org.apache.axis.wsdl.wsdl2ws.info.MethodInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
+import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 
 public class ClientStubHeaderWriter
@@ -207,9 +211,29 @@ public class ClientStubHeaderWriter
                     continue;
 
                 if (atype.isArray())
+                {
+                    // TODO not sure about "string" check, whether it is needed....
                     if (atype.getElementType().equals("string"))
                         removeSet.add(atype.getLanguageSpecificName());
+
+                    // NOTE: There is similar check in AllParamWriter.java.
+                        
+                    String elementType = atype.getElementType();
+                    if (elementType != null)
+                    {
+                        if (TypeMap.isAnonymousType(elementType))
+                            elementType = CUtils.sanitizeString(elementType);
+                        
+                        QName elementQname = new QName(atype.getName().getNamespaceURI(),
elementType);                       
+                        Type currentType = wscontext.getTypemap().getType(elementQname);
+                        
+                        if (currentType != null)
+                            if ( currentType.isSimpleType())
+                                continue;
+                    }
+                }
                 
+                // TODO not sure about "string" check, whether it is needed....
                 if (atype.getBaseType() != null)
                     if (atype.getBaseType().getLocalPart().equals("string"))
                         removeSet.add(CUtils.getArrayNameForType(atype.getLanguageSpecificName()));
@@ -225,9 +249,17 @@ public class ClientStubHeaderWriter
                 typeSet.remove(ritr.next());
             
             Iterator itr = typeSet.iterator();
+            String targetLocation = wscontext.getWrapperInfo().getTargetOutputLocation();
+            if (!targetLocation.endsWith(File.separator))
+                targetLocation += File.separator;
+          
             while (itr.hasNext())
             {
-                c_writer.write("#include \"" + itr.next().toString() + CUtils.getHeaderFileExtension()
+ "\"\n");
+                String fn = itr.next().toString() + CUtils.getHeaderFileExtension();
+                
+                // Not pretty but it works...this ensures we include generated types.
+                if (new File(targetLocation  + fn).exists())
+                    c_writer.write("#include \"" + fn + "\"\n");
             }
             c_writer.write("\n");
         }

Modified: axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java?rev=1352716&r1=1352715&r2=1352716&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
(original)
+++ axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
Thu Jun 21 22:22:13 2012
@@ -17,15 +17,20 @@
 
 package org.apache.axis.wsdl.wsdl2ws.cpp.literal;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Iterator;
 
+import javax.xml.namespace.QName;
+
 import org.apache.axis.wsdl.wsdl2ws.CUtils;
+import org.apache.axis.wsdl.wsdl2ws.WSDL2Ws;
 import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
 import org.apache.axis.wsdl.wsdl2ws.info.MethodInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
+import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 
 public class ClientStubHeaderWriter
@@ -173,6 +178,7 @@ public class ClientStubHeaderWriter
             c_writer.write("AXIS_CPP_NAMESPACE_USE\n");
             c_writer.write("\n");
             
+            // TODO - There should be a better way to determine what types are being generated!
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
             HashSet typeSet = new HashSet();
@@ -185,13 +191,33 @@ public class ClientStubHeaderWriter
                     continue;
 
                 if (atype.isArray())
+                {
+                    // TODO not sure about "string" check, whether it is needed....
                     if (atype.getElementType().equals("string"))
                         removeSet.add(atype.getLanguageSpecificName());
+
+                    // NOTE: There is similar check in AllParamWriter.java.  
+                    String elementType = atype.getElementType();
+                    if (elementType != null)
+                    {
+                        if (TypeMap.isAnonymousType(elementType))
+                            elementType = CUtils.sanitizeString(elementType);
+                        
+                        QName elementQname = new QName(atype.getName().getNamespaceURI(),
elementType);                       
+                        Type currentType = wscontext.getTypemap().getType(elementQname);
+                        
+                        if (currentType != null)
+                            if ( currentType.isSimpleType())
+                                continue;
+                    }
+                }
                 
+                // TODO not sure about "string" check, whther it is needed...
                 if (atype.getBaseType() != null)
                     if (atype.getBaseType().getLocalPart().equals("string"))
                         removeSet.add(CUtils.getArrayNameForType(atype.getLanguageSpecificName()));
                 
+                   
                 if (atype.isRestriction())
                     removeSet.add(CUtils.getArrayNameForType(atype.getLanguageSpecificName()));
 
@@ -203,9 +229,17 @@ public class ClientStubHeaderWriter
                 typeSet.remove(ritr.next());
 
             Iterator itr = typeSet.iterator();
+            String targetLocation = wscontext.getWrapperInfo().getTargetOutputLocation();
+            if (!targetLocation.endsWith(File.separator))
+                targetLocation += File.separator;
+          
             while (itr.hasNext())
             {
-                c_writer.write("#include \"" + itr.next().toString() + CUtils.getHeaderFileExtension()
+ "\"\n");
+                String fn = itr.next().toString() + CUtils.getHeaderFileExtension();
+                        
+                // Not pretty but it works...this ensures we include generated types.
+                if (new File(targetLocation  + fn).exists())
+                    c_writer.write("#include \"" + fn + "\"\n");
             }
             
             //    Method to print the Fault Exception headers



Mime
View raw message