You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/11/05 12:03:49 UTC
cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal ClientStubWriter.java WrapWriter.java
dicka 2004/11/05 03:03:49
Modified: c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp
CPPClassWriter.java ClientStubWriter.java
ServiceWriter.java WrapWriter.java
c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
ClientStubWriter.java WrapWriter.java
Log:
Re-aligning inheritance tree and pulling up duplicate methods, to reduce code duplication in WSDL2Ws tool.
Submitted by: Adrian Dick
Revision Changes Path
1.7 +43 -0 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java
Index: CPPClassWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/CPPClassWriter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CPPClassWriter.java 4 Nov 2004 14:06:23 -0000 1.6
+++ CPPClassWriter.java 5 Nov 2004 11:03:49 -0000 1.7
@@ -23,12 +23,14 @@
package org.apache.axis.wsdl.wsdl2ws.cpp;
import java.io.BufferedWriter;
+import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.axis.wsdl.wsdl2ws.BasicFileWriter;
import org.apache.axis.wsdl.wsdl2ws.WSDL2Ws;
import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
+import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
public abstract class CPPClassWriter extends BasicFileWriter
{
@@ -69,4 +71,45 @@
protected void writeGlobalCodes() throws WrapperFault
{}
+
+ protected WebServiceContext wscontext;
+
+ protected File getFilePath() throws WrapperFault
+ {
+ return this.getFilePath(false);
+ }
+
+ protected File getFilePath(boolean useServiceName) throws WrapperFault
+ {
+ String targetOutputLocation =
+ this.wscontext.getWrapInfo().getTargetOutputLocation();
+ if (targetOutputLocation.endsWith("/"))
+ targetOutputLocation =
+ targetOutputLocation.substring(
+ 0,
+ targetOutputLocation.length() - 1);
+ new File(targetOutputLocation).mkdirs();
+
+ String fileName = targetOutputLocation + "/" + classname + ".cpp";
+
+ if (useServiceName)
+ {
+ String serviceName = this.wscontext.getSerInfo().getServicename();
+ fileName =
+ targetOutputLocation
+ + "/"
+ + serviceName
+ + "_"
+ + classname
+ + ".cpp";
+ this.wscontext.addGeneratedFile(
+ serviceName + "_" + classname + ".cpp");
+ }
+ else
+ {
+ this.wscontext.addGeneratedFile(classname + ".cpp");
+ }
+
+ return new File(fileName);
+ }
}
1.62 +19 -59 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
Index: ClientStubWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- ClientStubWriter.java 5 Nov 2004 09:44:20 -0000 1.61
+++ ClientStubWriter.java 5 Nov 2004 11:03:49 -0000 1.62
@@ -21,7 +21,6 @@
package org.apache.axis.wsdl.wsdl2ws.cpp;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,8 +42,7 @@
public class ClientStubWriter extends CPPClassWriter
{
- private WebServiceContext wscontext;
- private ArrayList methods;
+ protected ArrayList methods;
public ClientStubWriter(WebServiceContext wscontext) throws WrapperFault
{
super(
@@ -53,44 +51,6 @@
this.wscontext = wscontext;
this.methods = wscontext.getSerInfo().getMethods();
}
- protected File getFilePath() throws WrapperFault
- {
- return this.getFilePath(false);
- }
-
- protected File getFilePath(boolean useServiceName) throws WrapperFault
- {
- String targetOutputLocation =
- this.wscontext.getWrapInfo().getTargetOutputLocation();
- if (targetOutputLocation.endsWith("/"))
- targetOutputLocation =
- targetOutputLocation.substring(
- 0,
- targetOutputLocation.length() - 1);
- new File(targetOutputLocation).mkdirs();
-
- String fileName = targetOutputLocation + "/" + classname + ".cpp";
-
- if (useServiceName)
- {
- String serviceName = this.wscontext.getSerInfo().getServicename();
- fileName =
- targetOutputLocation
- + "/"
- + serviceName
- + "_"
- + classname
- + ".cpp";
- this.wscontext.addGeneratedFile(
- serviceName + "_" + classname + ".cpp");
- }
- else
- {
- this.wscontext.addGeneratedFile(classname + ".cpp");
- }
-
- return new File(fileName);
- }
protected String getServiceName() throws WrapperFault
{
return wscontext.getSerInfo().getServicename();
@@ -628,10 +588,10 @@
if (returntype == null)
{
writer.write("\t\t\t/*not successful*/\n\t\t}\n");
- writer.write("\t\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
+ writer.write("\t\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
}
else
if (returntypeisarray)
@@ -672,10 +632,10 @@
+ containedType
+ ");\n\t\t\t}\n");
}
- writer.write("\t\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
+ writer.write("\t\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
writer.write("\t\treturn RetArray;\n");
}
else
@@ -689,10 +649,10 @@
+ "(\""
+ returntype.getParamName()
+ "\", 0);\n\t\t\t}\n");
- writer.write("\t\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
+ writer.write("\t\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
writer.write("\t\treturn Ret;\n");
}
else
@@ -711,10 +671,10 @@
+ ",\""
+ returntype.getParamName()
+ "\", 0);\n\t\t}\n");
- writer.write("\t\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
+ writer.write("\t\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t\t}\n\t\tm_pCall->unInitialize();\n");
writer.write("\t\treturn pReturn;\n");
}
@@ -725,8 +685,8 @@
writer.write(
"\t\tif(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)\n");
writer.write("\t\t{\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
//writer.write("\t\t\tm_pCall->unInitialize();\n");
writer.write(
"\t\t\tthrow "
1.20 +0 -43 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
Index: ServiceWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ServiceWriter.java 4 Nov 2004 14:06:23 -0000 1.19
+++ ServiceWriter.java 5 Nov 2004 11:03:49 -0000 1.20
@@ -21,7 +21,6 @@
package org.apache.axis.wsdl.wsdl2ws.cpp;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
@@ -34,7 +33,6 @@
public class ServiceWriter extends CPPClassWriter
{
- private WebServiceContext wscontext;
private ArrayList methods;
public ServiceWriter(WebServiceContext wscontext) throws WrapperFault
{
@@ -43,47 +41,6 @@
wscontext.getSerInfo().getQualifiedServiceName()));
this.wscontext = wscontext;
this.methods = wscontext.getSerInfo().getMethods();
- }
-
- protected File getFilePath() throws WrapperFault
- {
- return this.getFilePath(false);
- }
-
- protected File getFilePath(boolean useServiceName) throws WrapperFault
- {
- String targetOutputLocation =
- this.wscontext.getWrapInfo().getTargetOutputLocation();
- if (targetOutputLocation.endsWith("/"))
- {
- targetOutputLocation =
- targetOutputLocation.substring(
- 0,
- targetOutputLocation.length() - 1);
- }
- new File(targetOutputLocation).mkdirs();
-
- String fileName = targetOutputLocation + "/" + classname + ".cpp";
-
- if (useServiceName)
- {
- String serviceName = this.wscontext.getSerInfo().getServicename();
- fileName =
- targetOutputLocation
- + "/"
- + serviceName
- + "_"
- + classname
- + ".cpp";
- this.wscontext.addGeneratedFile(
- serviceName + "_" + classname + ".cpp");
- }
- else
- {
- this.wscontext.addGeneratedFile(classname + ".cpp");
- }
-
- return new File(fileName);
}
protected void writeClassComment() throws WrapperFault
1.35 +2 -43 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
Index: WrapWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- WrapWriter.java 4 Nov 2004 14:06:23 -0000 1.34
+++ WrapWriter.java 5 Nov 2004 11:03:49 -0000 1.35
@@ -21,7 +21,6 @@
package org.apache.axis.wsdl.wsdl2ws.cpp;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -30,18 +29,17 @@
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.WrapperUtils;
+import org.apache.axis.wsdl.wsdl2ws.info.FaultInfo;
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.WebServiceContext;
-import org.apache.axis.wsdl.wsdl2ws.info.FaultInfo;
-import org.apache.axis.wsdl.wsdl2ws.CUtils;
public class WrapWriter extends CPPClassWriter
{
- private WebServiceContext wscontext;
private ArrayList methods;
public WrapWriter(WebServiceContext wscontext) throws WrapperFault
{
@@ -52,45 +50,6 @@
this.wscontext = wscontext;
this.methods = wscontext.getSerInfo().getMethods();
}
- protected File getFilePath() throws WrapperFault
- {
- return this.getFilePath(false);
- }
-
- protected File getFilePath(boolean useServiceName) throws WrapperFault
- {
- String targetOutputLocation =
- this.wscontext.getWrapInfo().getTargetOutputLocation();
- if (targetOutputLocation.endsWith("/"))
- targetOutputLocation =
- targetOutputLocation.substring(
- 0,
- targetOutputLocation.length() - 1);
- new File(targetOutputLocation).mkdirs();
-
- String fileName = targetOutputLocation + "/" + classname + ".cpp";
-
- if (useServiceName)
- {
- String serviceName = this.wscontext.getSerInfo().getServicename();
- fileName =
- targetOutputLocation
- + "/"
- + serviceName
- + "_"
- + classname
- + ".cpp";
- this.wscontext.addGeneratedFile(
- serviceName + "_" + classname + ".cpp");
- }
- else
- {
- this.wscontext.addGeneratedFile(classname + ".cpp");
- }
-
- return new File(fileName);
- }
-
protected void writeClassComment() throws WrapperFault
{
try
1.54 +49 -128 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
Index: ClientStubWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- ClientStubWriter.java 5 Nov 2004 09:44:21 -0000 1.53
+++ ClientStubWriter.java 5 Nov 2004 11:03:49 -0000 1.54
@@ -26,7 +26,6 @@
package org.apache.axis.wsdl.wsdl2ws.cpp.literal;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -39,90 +38,17 @@
import org.apache.axis.wsdl.wsdl2ws.WrapperConstants;
import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
import org.apache.axis.wsdl.wsdl2ws.WrapperUtils;
-import org.apache.axis.wsdl.wsdl2ws.cpp.CPPClassWriter;
import org.apache.axis.wsdl.wsdl2ws.info.FaultInfo;
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.WebServiceContext;
-public class ClientStubWriter extends CPPClassWriter
+public class ClientStubWriter extends org.apache.axis.wsdl.wsdl2ws.cpp.ClientStubWriter
{
- private WebServiceContext wscontext;
-
- private ArrayList methods;
-
public ClientStubWriter(WebServiceContext wscontext) throws WrapperFault
{
- super(
- WrapperUtils.getClassNameFromFullyQualifiedName(
- wscontext.getSerInfo().getQualifiedServiceName()));
- this.wscontext = wscontext;
- this.methods = wscontext.getSerInfo().getMethods();
- }
-
- protected File getFilePath() throws WrapperFault
- {
- return this.getFilePath(false);
- }
-
- protected File getFilePath(boolean useServiceName) throws WrapperFault
- {
- String targetOutputLocation =
- this.wscontext.getWrapInfo().getTargetOutputLocation();
- if (targetOutputLocation.endsWith("/"))
- {
- targetOutputLocation =
- targetOutputLocation.substring(
- 0,
- targetOutputLocation.length() - 1);
- }
- new File(targetOutputLocation).mkdirs();
-
- String fileName = targetOutputLocation + "/" + classname + ".cpp";
-
- if (useServiceName)
- {
- String serviceName = this.wscontext.getSerInfo().getServicename();
- fileName =
- targetOutputLocation
- + "/"
- + serviceName
- + "_"
- + classname
- + ".cpp";
- this.wscontext.addGeneratedFile(
- serviceName + "_" + classname + ".cpp");
- }
- else
- {
- this.wscontext.addGeneratedFile(classname + ".cpp");
- }
-
- return new File(fileName);
- }
-
- protected String getServiceName() throws WrapperFault
- {
- return wscontext.getSerInfo().getServicename();
- }
-
- protected void writeClassComment() throws WrapperFault
- {
- try
- {
- writer.write("/*\n");
- writer.write(
- " * This file was auto-generated by the Axis C++ Web Service "
- + "Generator (WSDL2Ws)\n");
- writer.write(
- " * This file contains Client Stub implementation for remote web service.\n");
- writer.write(" */\n\n");
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
+ super(wscontext);
}
/* (non-Javadoc)
@@ -157,22 +83,6 @@
}
/* (non-Javadoc)
- * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeDistructors()
- */
- protected void writeDestructors() throws WrapperFault
- {
- try
- {
- writer.write(classname + "::~" + classname + "()\n{\n}\n\n");
- //\tdelete m_pCall;\n}\n\n");
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
- }
-
- /* (non-Javadoc)
* @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeMethods()
*/
protected void writeMethods() throws WrapperFault
@@ -189,22 +99,33 @@
writer.write("\n");
}
- writer.write("/*Methods for supporting SecureChannel*/\n\n"); // FJP - SecureChannel
- writer.write("void " + classname + "::SetSecure( char * pszArguments, ...)\n"); // FJP - SecureChannel
- writer.write("{\n"); // FJP - SecureChannel
- writer.write("\tchar **\tppszArgPtr = &pszArguments;\n"); // FJP - SecureChannel
- writer.write("\tint\t\tiArgIndex = 0;\n\n"); // FJP - SecureChannel
- writer.write("\twhile( *ppszArgPtr != NULL)\n"); // FJP - SecureChannel
- writer.write("\t{\n"); // FJP - SecureChannel
- writer.write("\t\tsArguments[iArgIndex] = *ppszArgPtr;\n\n"); // FJP - SecureChannel
- writer.write("\t\tiArgIndex++;\n"); // FJP - SecureChannel
- writer.write("\t\tppszArgPtr++;\n"); // FJP - SecureChannel
- writer.write("\t}\n"); // FJP - SecureChannel
- writer.write("}\n\n"); // FJP - SecureChannel
- writer.write("void " + classname + "::includeSecure()\n"); // FJP - SecureChannel
- writer.write("{\n"); // FJP - SecureChannel
- writer.write("\tm_pCall->setTransportProperty( SECURE_PROPERTIES, (const char *) &sArguments);\n"); // FJP - SecureChannel
- writer.write("}\n"); // FJP - SecureChannel
+ writer.write("/*Methods for supporting SecureChannel*/\n\n");
+ // FJP - SecureChannel
+ writer.write(
+ "void "
+ + classname
+ + "::SetSecure( char * pszArguments, ...)\n");
+ // FJP - SecureChannel
+ writer.write("{\n"); // FJP - SecureChannel
+ writer.write("\tchar **\tppszArgPtr = &pszArguments;\n");
+ // FJP - SecureChannel
+ writer.write("\tint\t\tiArgIndex = 0;\n\n"); // FJP - SecureChannel
+ writer.write("\twhile( *ppszArgPtr != NULL)\n");
+ // FJP - SecureChannel
+ writer.write("\t{\n"); // FJP - SecureChannel
+ writer.write("\t\tsArguments[iArgIndex] = *ppszArgPtr;\n\n");
+ // FJP - SecureChannel
+ writer.write("\t\tiArgIndex++;\n"); // FJP - SecureChannel
+ writer.write("\t\tppszArgPtr++;\n"); // FJP - SecureChannel
+ writer.write("\t}\n"); // FJP - SecureChannel
+ writer.write("}\n\n"); // FJP - SecureChannel
+ writer.write("void " + classname + "::includeSecure()\n");
+ // FJP - SecureChannel
+ writer.write("{\n"); // FJP - SecureChannel
+ writer.write(
+ "\tm_pCall->setTransportProperty( SECURE_PROPERTIES, (const char *) &sArguments);\n");
+ // FJP - SecureChannel
+ writer.write("}\n"); // FJP - SecureChannel
}
catch (IOException e)
{
@@ -543,7 +464,7 @@
}
//new calls from stub base
- writer.write("\tincludeSecure();\n"); // FJP - SecureChannel
+ writer.write("\tincludeSecure();\n"); // FJP - SecureChannel
writer.write("\tapplyUserPreferences();\n");
for (int i = 0; i < paramsB.size(); i++)
@@ -883,9 +804,9 @@
{
writer.write("\t\t\t/*not successful*/\n\t\t}\n");
}
- writer.write("\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
+ writer.write("\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
//writer.write("\t}\n\tm_pCall->unInitialize();\n");
}
else
@@ -929,10 +850,10 @@
+ containedType
+ ");\n\t\t}\n");
}
- writer.write("\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t}\n\tm_pCall->unInitialize();\n");
+ writer.write("\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t}\n\tm_pCall->unInitialize();\n");
writer.write("\treturn RetArray;\n");
}
else
@@ -948,10 +869,10 @@
+ "(\""
+ returntype.getParamName()
+ "\", 0);\n\t\t}\n");
- writer.write("\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t}\n\tm_pCall->unInitialize();\n");
+ writer.write("\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t}\n\tm_pCall->unInitialize();\n");
writer.write("\treturn Ret;\n");
}
else
@@ -964,10 +885,10 @@
"\t\t\tpReturn = ("
+ outparamType
+ "*)m_pCall->getAnyObject();\n\t\t}\n");
- writer.write("\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t}\n\tm_pCall->unInitialize();\n");
+ writer.write("\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t}\n\tm_pCall->unInitialize();\n");
writer.write("\treturn pReturn;\n");
}
else
@@ -987,10 +908,10 @@
+ returntype.getElementNameAsString()
+ "\", 0);\n\t\t}\n");
//Samisa
- writer.write("\t}\n");
- writer.write("\tupdateStateAfterResponse();\n");
- writer.write("\tm_pCall->unInitialize();\n");
- // writer.write("\t}\n\tm_pCall->unInitialize();\n");
+ writer.write("\t}\n");
+ writer.write("\tupdateStateAfterResponse();\n");
+ writer.write("\tm_pCall->unInitialize();\n");
+ // writer.write("\t}\n\tm_pCall->unInitialize();\n");
writer.write("\treturn pReturn;\n");
}
}
1.30 +2 -208 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
Index: WrapWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- WrapWriter.java 4 Nov 2004 14:06:24 -0000 1.29
+++ WrapWriter.java 5 Nov 2004 11:03:49 -0000 1.30
@@ -21,7 +21,6 @@
package org.apache.axis.wsdl.wsdl2ws.cpp.literal;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -33,222 +32,17 @@
import org.apache.axis.wsdl.wsdl2ws.CUtils;
import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
import org.apache.axis.wsdl.wsdl2ws.WrapperUtils;
-import org.apache.axis.wsdl.wsdl2ws.cpp.CPPClassWriter;
import org.apache.axis.wsdl.wsdl2ws.info.FaultInfo;
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.WebServiceContext;
-public class WrapWriter extends CPPClassWriter
+public class WrapWriter extends org.apache.axis.wsdl.wsdl2ws.cpp.WrapWriter
{
- private WebServiceContext wscontext;
-
- private ArrayList methods;
-
public WrapWriter(WebServiceContext wscontext) throws WrapperFault
{
- super(
- WrapperUtils.getClassNameFromFullyQualifiedName(
- wscontext.getSerInfo().getQualifiedServiceName()
- + CUtils.WRAPPER_NAME_APPENDER));
- this.wscontext = wscontext;
- this.methods = wscontext.getSerInfo().getMethods();
- }
-
- protected File getFilePath() throws WrapperFault
- {
- return this.getFilePath(false);
- }
-
- protected File getFilePath(boolean useServiceName) throws WrapperFault
- {
- String targetOutputLocation =
- this.wscontext.getWrapInfo().getTargetOutputLocation();
- if (targetOutputLocation.endsWith("/"))
- {
- targetOutputLocation =
- targetOutputLocation.substring(
- 0,
- targetOutputLocation.length() - 1);
- }
- new File(targetOutputLocation).mkdirs();
-
- String fileName = targetOutputLocation + "/" + classname + ".cpp";
-
- if (useServiceName)
- {
- String serviceName = this.wscontext.getSerInfo().getServicename();
- fileName =
- targetOutputLocation
- + "/"
- + serviceName
- + "_"
- + classname
- + ".cpp";
- this.wscontext.addGeneratedFile(
- serviceName + "_" + classname + ".cpp");
- }
- else
- {
- this.wscontext.addGeneratedFile(classname + ".cpp");
- }
-
- return new File(fileName);
- }
-
- protected void writeClassComment() throws WrapperFault
- {
- try
- {
- 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 implementations\n");
- writer.write(" */\n\n");
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeConstructors()
- */
- protected void writeConstructors() throws WrapperFault
- {
- try
- {
- writer.write(classname + "::" + classname + "()\n{\n");
- writer.write(
- "\tpWs = new "
- + CUtils.getWebServiceNameFromWrapperName(classname)
- + "();\n");
- writer.write("}\n\n");
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeDistructors()
- */
- protected void writeDestructors() throws WrapperFault
- {
- try
- {
- writer.write(
- classname + "::~" + classname + "()\n{\n\tdelete pWs;\n}\n\n");
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeMethods()
- */
- protected void writeMethods() throws WrapperFault
- {
- try
- {
- writer.write(
- "/*implementation of WrapperClassHandler interface*/\n");
-
- writer.write(
- "void "
- + classname
- + "::onFault(void *pMsg)\n{"
- + "\n\tpWs->onFault();\n}\n\n");
- writer.write(
- "int "
- + classname
- + "::init()\n{\n"
- + "\tpWs->init();\n\treturn AXIS_SUCCESS;\n}\n\n");
- writer.write(
- "int "
- + classname
- + "::fini()\n{\n"
- + "\tpWs->fini();\n\treturn AXIS_SUCCESS;\n}\n\n");
- writeInvoke();
- writer.write(
- "\n/*Methods corresponding to the web service methods*/\n");
- MethodInfo minfo;
- for (int i = 0; i < methods.size(); i++)
- {
- minfo = (MethodInfo) methods.get(i);
- this.writeMethodInWrapper(minfo);
- writer.write("\n");
- }
-
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
- */
- protected void writePreprocessorStatements() throws WrapperFault
- {
- try
- {
- writer.write("#include \"" + classname + ".h\"\n\n");
- }
- catch (IOException e)
- {
- throw new WrapperFault(e);
- }
- }
-
- /**
- * write the invoke method
- * @throws IOException
- */
- private void writeInvoke() throws IOException
- {
- writer.write("\n/*\n");
- writer.write(" * This method invokes the right service method \n");
- writer.write(" */\n");
- writer.write("int " + classname + "::invoke(void *pMsg)\n{\n");
- writer.write("\tIMessageData* mc = (IMessageData*)pMsg;\n");
- //msgdata.setSoapFault(new SOAPFault(new AxisFault()))
- writer.write("\tconst AxisChar *method = mc->getOperationName();\n");
- //if no methods in the service simply return
- if (methods.size() == 0)
- {
- writer.write("}\n");
- return;
- }
- MethodInfo minfo = (MethodInfo) methods.get(0);
- //if conditions (if parts)
- writer.write(
- "\tif (0 == strcmp(method, \"" + minfo.getMethodname() + "\"))\n");
- writer.write("\t\treturn " + minfo.getMethodname() + "(mc);\n");
- //(else if parts)
- if (methods.size() > 1)
- {
- for (int i = 1; i < methods.size(); i++)
- {
- minfo = (MethodInfo) methods.get(i);
- writer.write(
- "\telse if (0 == strcmp(method, \""
- + minfo.getMethodname()
- + "\"))\n");
- writer.write("\t\treturn " + minfo.getMethodname() + "(mc);\n");
- }
- }
- //(else part)
- writer.write("\telse return AXIS_FAIL;\n");
- //end of method
- writer.write("}\n\n");
+ super(wscontext);
}
/**