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 du...@apache.org on 2005/09/15 05:32:55 UTC
svn commit: r289139 - in
/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp:
BeanParamWriter.java ParmHeaderFileWriter.java literal/BeanParamWriter.java
literal/ParmHeaderFileWriter.java
Author: dushshantha
Date: Wed Sep 14 20:32:38 2005
New Revision: 289139
URL: http://svn.apache.org/viewcvs?rev=289139&view=rev
Log:
Changed the code generation for any types to handle multiple any elements.
Modified:
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java?rev=289139&r1=289138&r2=289139&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java Wed Sep 14 20:32:38 2005
@@ -126,6 +126,8 @@
* Dushshantha: writing getter
*/
+ int anyCounter = 0;
+
if (type.isArray()) {
return;
}
@@ -137,6 +139,11 @@
.getParamNameWithoutSymbols();
String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
+ if (attribs[i].isAnyType()){
+ anyCounter += 1;
+ parameterName = parameterName + Integer.toString(anyCounter);
+ }
+
writer.write("\n" + properParamName + " * " + classname
+ "::get" + parameterName + "()\n{\n");
@@ -166,33 +173,39 @@
* Dushshantha: Write getter
*/
- writer
- .write("\n"
- + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
- + " " + classname + "::get"
- + attribs[i].getParamNameWithoutSymbols()
- + "()\n{\n");
-
- writer.write("\t" + "return "
- + attribs[i].getParamNameWithoutSymbols()
- + " ; \n}\n");
+ String parameterName = attribs[i].getParamNameWithoutSymbols();
+ String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
+
+ if (attribs[i].isAnyType()){
+ anyCounter += 1;
+ parameterName = parameterName + Integer.toString(anyCounter);
+ }
+
+ writer.write("\n"
+ + properParamName
+ + " " + classname + "::get"
+ + parameterName
+ + "()\n{\n");
+
+ writer.write("\t" + "return "
+ + parameterName
+ + " ; \n}\n");
/**
* Dushshantha: Write setter
*/
- writer
- .write("\n"
- + "void "
- + classname
- + "::set"
- + attribs[i].getParamNameWithoutSymbols()
- + "("
- + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
- + " InValue)\n{\n");
+ writer.write("\n"
+ + "void "
+ + classname
+ + "::set"
+ + parameterName
+ + "("
+ + properParamName
+ + " InValue)\n{\n");
- writer.write("\t" + attribs[i].getParamNameWithoutSymbols()
- + " = InValue ; \n");
+ writer.write("\t" + parameterName
+ + " = InValue ; \n");
if (attribs[i].getChoiceElement()) {
for (int j = 0; j < attribs.length; j++) {
@@ -271,6 +284,8 @@
String arrayType;
boolean firstIfWritten = false;
+ int anyCounter = 0;
+
for (int i = 0; i < attribs.length; i++) {
//Dushshantha:
@@ -302,7 +317,8 @@
//17/05/2005........................................................................
if (attribs[i].isAnyType()) {
- writer.write("\tpSZ->serializeAnyObject(param->any);\n");
+ anyCounter += 1;
+ writer.write("\tpSZ->serializeAnyObject(param->any" + Integer.toString(anyCounter) +");\n");
} else if (attribs[i].isArray()) {
//if Array
if (attribs[i].isSimpleType()) {
@@ -456,7 +472,8 @@
boolean peekCalled = false;
boolean firstIfWritten = false;
boolean foundAll = false;
-
+ int anyCounter = 0; //counter for any types.
+
for (int i = 0; i < attribs.length; i++) {
//Dushshantha:
//if the attribute is a choice
@@ -507,7 +524,8 @@
//17/05/2005...........................................................
if (attribs[i].isAnyType()) {
- writer.write("\tparam->any = pIWSDZ->getAnyObject();\n");
+ anyCounter +=1;
+ writer.write("\tparam->any" + Integer.toString(anyCounter)+ " = pIWSDZ->getAnyObject();\n");
} else if (attribs[i].isArray()) {
//if Array
if (attribs[i].isSimpleType()) {
@@ -681,6 +699,9 @@
writer.write("\n" + classname + "::" + classname + "()\n{\n");
writer
.write("\t/*do not allocate memory to any pointer members here\n\t because deserializer will allocate memory anyway. */\n");
+
+ int anyCounter = 0;
+
for (int i = 0; i < attribs.length; i++) {
if (attribs[i].isArray()) {
writer.write("\t" + attribs[i].getParamNameAsMember()
@@ -688,8 +709,16 @@
writer.write("\t" + attribs[i].getParamNameAsMember()
+ ".m_Size = 0;\n");
} else if (!attribs[i].isSimpleType()) {
- writer.write("\t" + attribs[i].getParamNameAsMember()
+ if (attribs[i].isAnyType())
+ {
+ anyCounter += 1;
+ writer.write("\t" + attribs[i].getParamNameAsMember() + Integer.toString(anyCounter)
+ + "= 0;\n");
+ }
+ else{
+ writer.write("\t" + attribs[i].getParamNameAsMember()
+ " = 0;\n");
+ }
}
// FJP Nillable vv
else if (isElementNillable(i)) {
@@ -725,6 +754,9 @@
writer.write("\n" + classname + "::~" + classname + "()\n{\n");
}
writer.write("\t/*delete any pointer and array members here*/\n");
+
+ int anyCounter = 0;
+
for (int i = 0; i < attribs.length; i++) {
if (attribs[i].isArray()) {
if (attribs[i].getChoiceElement())
@@ -735,7 +767,13 @@
writer.write("\tdelete [] ((" + attribs[i].getTypeName()
+ "*)" + attribs[i].getParamNameAsMember()
+ ".m_Array);\n");
- } else if (!attribs[i].isSimpleType()) {
+ }
+
+ else if (attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer.write("\tdelete "
+ + attribs[i].getParamNameAsMember() + Integer.toString(anyCounter) + ";\n");
+ }else if (!attribs[i].isSimpleType()) {
writer.write("\tdelete "
+ attribs[i].getParamNameAsMember() + ";\n");
}
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java?rev=289139&r1=289138&r2=289139&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java Wed Sep 14 20:32:38 2005
@@ -82,6 +82,7 @@
}
protected void writeAttributes() throws WrapperFault {
+ int anyCounter = 0;
if (type.isArray())
return;
try {
@@ -93,17 +94,47 @@
}
// FJP Nillable vv
if (isElementNillable(i)) {
+
+ if(attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " *\t" + attribs[i].getParamName()
+ + Integer.toString(anyCounter)
+ + ";\n");
+
+ }
+
+ else{
writer
.write("\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " *\t" + attribs[i].getParamName()
+ ";\n");
+ }
+
} else {
// FJP Nillable ^^
+
+ if(attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " \t" + attribs[i].getParamName()
+ + Integer.toString(anyCounter)
+ + ";\n");
+
+ }
+
+ else{
+
writer
.write("\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ "\t" + attribs[i].getParamName() + ";\n");
+ }
}
}
} catch (IOException e) {
@@ -115,6 +146,7 @@
* Dushshantha: This method writes getters and setters of the attributes.
*/
protected void writeGetSetMethods() throws WrapperFault {
+ int anyCounter = 0;
if (type.isArray()) {
return;
}
@@ -125,27 +157,74 @@
writer.write("\n");
}
if (isElementNillable(i)) {
- writer
+ if ( attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
.write("\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " * get"
+ attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ "();\n");
- writer
+ writer
.write("\t"
+ "void set"
+ attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ "("
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " * pInValue);\n\n");
+ }
+ else {
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " * get"
+ + attribs[i].getParamNameWithoutSymbols()
+ + "();\n");
+
+ writer
+ .write("\t"
+ + "void set"
+ + attribs[i].getParamNameWithoutSymbols()
+ + "("
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " * pInValue);\n\n");
+
+ }
+
} else {
// FJP Nillable ^^
+
+ if ( attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " get"
+ + attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ + "();\n");
+
+ writer
+ .write("\t"
+ + "void set"
+ + attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ + "("
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " InValue);\n\n");
+ }
+ else {
+
+
+
/**
* Dushshantha: Write setter
*/
- writer
+ writer
.write("\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " get"
@@ -156,13 +235,14 @@
* Dushshantha: Write getter
*/
- writer
+ writer
.write("\t"
+ "void set"
+ attribs[i].getParamNameWithoutSymbols()
+ "("
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " InValue);\n\n");
+ }
}
}
} catch (IOException e) {
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java?rev=289139&r1=289138&r2=289139&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java Wed Sep 14 20:32:38 2005
@@ -135,7 +135,7 @@
/**
* Dushshantha: writing getter
*/
-
+ int anyCounter = 0;
if (type.isArray())
{
return;
@@ -149,7 +149,12 @@
{
String parameterName = attribs[i].getParamNameWithoutSymbols();
String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
-
+
+ if (attribs[i].isAnyType()){
+ anyCounter += 1;
+ parameterName = parameterName + Integer.toString(anyCounter);
+ }
+
writer.write("\n" + properParamName + " * " + classname
+ "::get" + parameterName + "()\n{\n");
@@ -182,15 +187,22 @@
/**
* Dushshantha: Write getter
*/
+ String parameterName = attribs[i].getParamNameWithoutSymbols();
+ String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
+
+ if (attribs[i].isAnyType()){
+ anyCounter += 1;
+ parameterName = parameterName + Integer.toString(anyCounter);
+ }
writer.write("\n"
- + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + properParamName
+ " " + classname + "::get"
- + attribs[i].getParamNameWithoutSymbols()
+ + parameterName
+ "()\n{\n");
writer.write("\t" + "return "
- + attribs[i].getParamNameWithoutSymbols()
+ + parameterName
+ " ; \n}\n");
/**
@@ -201,12 +213,12 @@
+ "void "
+ classname
+ "::set"
- + attribs[i].getParamNameWithoutSymbols()
+ + parameterName
+ "("
- + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + properParamName
+ " InValue)\n{\n");
- writer.write("\t" + attribs[i].getParamNameWithoutSymbols()
+ writer.write("\t" + parameterName
+ " = InValue ; \n");
if (attribs[i].getChoiceElement())
@@ -363,7 +375,9 @@
writer.write("\n\t/* then serialize elements if any*/\n");
boolean firstIfWritten = false;
-
+ int anyCounter = 0; //counter for any types.
+
+
for (int i = attributeParamCount; i < attribs.length; i++)
{
@@ -399,10 +413,13 @@
}
}
//17/05/2005........................................................................
-
+
+
+
if (attribs[i].isAnyType())
{
- writer.write("\tpSZ->serializeAnyObject(param->any);\n");
+ anyCounter += 1;
+ writer.write("\tpSZ->serializeAnyObject(param->any" + Integer.toString(anyCounter) +");\n");
}
else if (attribs[i].isArray())
{
@@ -687,7 +704,8 @@
boolean peekCalled = false;
boolean firstIfWritten = false;
boolean foundAll = false;
-
+ int anyCounter = 0; //counter for any types.
+
for (int i = 0; i < attribs.length; i++)
{
//Dushshantha:
@@ -744,9 +762,11 @@
}
//12/05/2005...........................................................
+
if (attribs[i].isAnyType())
{
- writer.write("\tparam->any = pIWSDZ->getAnyObject();\n");
+ anyCounter +=1;
+ writer.write("\tparam->any" + Integer.toString(anyCounter)+ " = pIWSDZ->getAnyObject();\n");
}
else if (attribs[i].isArray())
{
@@ -1088,6 +1108,8 @@
writer.write("\n" + classname + "::" + classname + "()\n{\n");
writer.write("\t/*do not allocate memory to any pointer members here\n\t because deserializer will allocate memory anyway. */\n");
+ int anyCounter = 0;
+
for (int i = 0; i < attribs.length; i++)
{
if (attribs[i].isArray())
@@ -1123,9 +1145,20 @@
}
else if (!attribs[i].isSimpleType())
{
- writer.write("\t" + attribs[i].getParamNameAsMember()
- + "=0;\n");
+ if (attribs[i].isAnyType())
+ {
+ anyCounter += 1;
+ writer.write("\t" + attribs[i].getParamNameAsMember() + Integer.toString(anyCounter)
+ + "= 0;\n");
+ }
+ else{
+ writer.write("\t" + attribs[i].getParamNameAsMember()
+ + "= 0;\n");
+ }
}
+
+
+
else if (isElementNillable(i))
{
writer.write("\t" + attribs[i].getParamNameAsMember()
@@ -1153,7 +1186,8 @@
*/
protected void writeDestructors() throws WrapperFault
{
- try
+
+ try
{
if (type.isFault())
{
@@ -1168,6 +1202,8 @@
// Adrian - seeing problems of losing data when clearing up,
// so temporarily remove this section, until such time as a better
// solution is found
+ int anyCounter = 0;
+
for(int i = 0; i< attribs.length;i++){
String name = attribs[i].getParamNameAsMember();
String typename = attribs[i].getTypeName();
@@ -1200,6 +1236,8 @@
}
}
else if (attribs[i].isAnyType()){
+ anyCounter += 1;
+ name = name + Integer.toString(anyCounter);
writer.write("\tif ("+name+") \n\t{\n");
writer.write("\t\tfor (int i=0; i<"+name+"->_size; i++)\n\t\t{\n");
writer.write("\t\t\tif ("+name+"->_array[i]) delete [] "+name+"->_array[i];\n");
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java?rev=289139&r1=289138&r2=289139&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java Wed Sep 14 20:32:38 2005
@@ -244,7 +244,9 @@
protected void writeAttributes() throws WrapperFault
{
- if (type.isArray())
+ int anyCounter = 0;
+
+ if (type.isArray())
{
return;
}
@@ -255,16 +257,42 @@
{
// FJP Nillable vv
if (isElementNillable(i)) {
+ if(attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " *\t" + attribs[i].getParamName()
+ + Integer.toString(anyCounter)
+ + ";\n");
+
+ }
+
+ else{
writer.write("\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " *\t" + attribs[i].getParamName()
+ ";\n");
+ }
} else {
// FJP Nillable ^^
+ if(attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + "\t" + attribs[i].getParamName()
+ + Integer.toString(anyCounter)
+ + ";\n");
+
+ }
+
+ else{
writer.write("\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ "\t" + attribs[i].getParamNameWithoutSymbols()
+ ";\n");
+ }
}
}
@@ -287,7 +315,9 @@
*/
protected void writeGetSetMethods() throws WrapperFault
{
- if (type.isArray())
+ int anyCounter = 0;
+
+ if (type.isArray())
{
return;
}
@@ -298,27 +328,73 @@
// FJP Nillable vv
if (isElementNillable(i))
{
- writer.write( "\n\t"
+ if ( attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " * get"
+ + attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ + "();\n");
+
+ writer
+ .write("\t"
+ + "void set"
+ + attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ + "("
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " * pInValue);\n\n");
+ }
+ else {
+
+
+ writer.write( "\n\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " * get"
+ attribs[i].getParamNameWithoutSymbols()
+ "();\n");
- writer.write( "\t"
+ writer.write( "\t"
+ "void set"
+ attribs[i].getParamNameWithoutSymbols()
+ "("
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " * pInValue);\n");
+ }
}
else
{
// FJP Nillable ^^
- /**
+ if ( attribs[i].isAnyType()){
+ anyCounter += 1;
+ writer
+ .write("\t"
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " get"
+ + attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ + "();\n");
+
+ writer
+ .write("\t"
+ + "void set"
+ + attribs[i].getParamNameWithoutSymbols()
+ + Integer.toString(anyCounter)
+ + "("
+ + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ + " InValue);\n\n");
+ }
+ else {
+
+
+
+ /**
* Dushshantha: Write setter
*/
- writer.write("\n\t"
+ writer.write("\n\t"
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " get"
+ attribs[i].getParamNameWithoutSymbols()
@@ -328,12 +404,13 @@
* Dushshantha: Write getter
*/
- writer.write("\t"
+ writer.write("\t"
+ "void set"
+ attribs[i].getParamNameWithoutSymbols()
+ "("
+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+ " InValue);\n");
+ }
}
}
} catch (IOException e)