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 wh...@apache.org on 2004/11/11 11:51:35 UTC
cvs commit: ws-axis/c/tools/trace/org/apache/axis/tracetool AddEntryAndExitTrace.java Exclusions.java Signature.java Tracer.java
whitlock 2004/11/11 02:51:35
Modified: c/include/axis/server AxisUserAPI.hpp IParam.hpp
c/src/common AxisTime.cpp AxisTime.h AxisTrace.cpp
AxisTrace.h Param.cpp Param.h
c/src/soap SoapSerializer.cpp
c/tools/trace/org/apache/axis/tracetool
AddEntryAndExitTrace.java Exclusions.java
Signature.java Tracer.java
Log:
Various fixes including...
- move uParamValue to Param.h because it doesn't need to be external
- change uParamValue from a union to a class so xsd__hexBinary and others can have a constructor
- rename uParamValue to ParamValue since it's a class not a union
- don't assume all the fields in ParamValue have the same address since it's not a union any more
- trace which return/catch in a method was executed
Revision Changes Path
1.7 +8 -3 ws-axis/c/include/axis/server/AxisUserAPI.hpp
Index: AxisUserAPI.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/AxisUserAPI.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AxisUserAPI.hpp 10 Nov 2004 17:06:10 -0000 1.6
+++ AxisUserAPI.hpp 11 Nov 2004 10:51:35 -0000 1.7
@@ -138,8 +138,9 @@
* @class xsd__base64Binary
* Axis C++ defined type for xml basic type base64Binary
*/
-class xsd__base64Binary {
+class STORAGE_CLASS_INFO xsd__base64Binary {
public:
+ //AXISCALL xsd__base64Binary();
xsd__unsignedByte * __ptr;
xsd__int __size;
};
@@ -148,8 +149,9 @@
* @class xsd__hexBinary
* Axis C++ defined type for xml basic type hexBinary
*/
-class xsd__hexBinary {
+class STORAGE_CLASS_INFO xsd__hexBinary {
public:
+ //AXISCALL xsd__hexBinary();
xsd__unsignedByte * __ptr;
xsd__int __size;
};
@@ -223,13 +225,16 @@
* @class AnyType
* Axis C++ defined type for handling xsd:any.
*/
-class AnyType
+class STORAGE_CLASS_INFO AnyType
{
public:
+ //AXISCALL AnyType();
+
/**
* @var _array Contains an array of xml encoded strings.
*/
XML_String* _array;
+
/**
* @var _size Contains how many xml strings are there in _array
*/
1.5 +0 -30 ws-axis/c/include/axis/server/IParam.hpp
Index: IParam.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/IParam.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IParam.hpp 10 Nov 2004 17:06:10 -0000 1.4
+++ IParam.hpp 11 Nov 2004 10:51:35 -0000 1.5
@@ -49,36 +49,6 @@
void init();
};
-typedef union uParamValue
-{
- int nValue;
- unsigned int unValue;
- short sValue;
- unsigned short usValue;
-//FJP v Added
-#ifdef WIN32
- __int64 llValue;
-#else
- long long llValue;
-#endif
-//FJP ^ Added
- long lValue;
- unsigned ulValue;
- char cValue;
- unsigned char ucValue;
- float fValue;
- double dValue;
- struct tm tValue;/* this will hold the c type tm struct*/
- xsd__hexBinary hbValue;
- xsd__base64Binary b64bValue;
- long lDuration;/* duration in seconds*/
- class ArrayBean* pArray; /* this is used to hold arrays */
- class IArrayBean* pIArray; /* used by wrapper classes */
- ComplexObjectHandler* pCplxObj;
- const AxisChar* pStrValue;
- AnyType* pAnyObject; /* used to hold AnyType struct for xsd:any */
-} uParamValue;
-
class IParam
{
public:
1.29 +1 -1 ws-axis/c/src/common/AxisTime.cpp
Index: AxisTime.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTime.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- AxisTime.cpp 9 Sep 2004 06:07:07 -0000 1.28
+++ AxisTime.cpp 11 Nov 2004 10:51:35 -0000 1.29
@@ -54,7 +54,7 @@
mkCTime ();
}
-void AxisTime::setValue (XSDTYPE type, uParamValue Value)
+void AxisTime::setValue (XSDTYPE type, ParamValue Value)
{
m_Type = type;
if (type == XSD_DURATION)
1.11 +2 -1 ws-axis/c/src/common/AxisTime.h
Index: AxisTime.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTime.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AxisTime.h 26 Oct 2004 09:37:57 -0000 1.10
+++ AxisTime.h 11 Nov 2004 10:51:35 -0000 1.11
@@ -26,6 +26,7 @@
#include <axis/server/TypeMapping.hpp>
#include <axis/server/IParam.hpp>
+#include "Param.h"
using namespace std;
@@ -58,7 +59,7 @@
AxisTime(struct tm ntime);
virtual ~AxisTime();
void setValue(const AxisChar* strValue);
- void setValue(XSDTYPE type, uParamValue Value);
+ void setValue(XSDTYPE type, ParamValue Value);
void setType(XSDTYPE m_Type);
AxisString getValue();
AxisString& serialize(struct tm tValue,
1.40 +16 -2 ws-axis/c/src/common/AxisTrace.cpp
Index: AxisTrace.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- AxisTrace.cpp 9 Nov 2004 15:55:25 -0000 1.39
+++ AxisTrace.cpp 11 Nov 2004 10:51:35 -0000 1.40
@@ -305,7 +305,7 @@
m_stack.push(name);
}
-void AxisTrace::traceExit(const char *className, const char *methodName,
+void AxisTrace::traceExit(const char *className, const char *methodName, int returnIndex,
AxisTraceType type, unsigned len, void *value)
{
if (!isTraceOn()) return;
@@ -330,6 +330,12 @@
}
if (NULL!=methodName)
line += methodName;
+ if (0!=returnIndex) { // Zero means only one return
+ line += "@";
+ char prim[32];
+ sprintf(prim,"%d",returnIndex);
+ line += prim;
+ }
line += "(";
if (TRACETYPE_UNKNOWN != type)
addParameter(line,type,len,value);
@@ -340,7 +346,7 @@
}
}
-void AxisTrace::traceCatch(const char *className, const char *methodName,
+void AxisTrace::traceCatch(const char *className, const char *methodName, int catchIndex,
AxisTraceType type, unsigned len, void *value)
{
if (!isTraceOn()) return;
@@ -362,8 +368,16 @@
if (NULL!=methodName)
line += methodName;
line += " caught ";
+ if (0!=catchIndex) { // Zero means only one catch
+ line += "@";
+ char prim[32];
+ sprintf(prim,"%d",catchIndex);
+ line += prim;
+ line += " ";
+ }
if (TRACETYPE_UNKNOWN != type)
addParameter(line,type,len,value);
+ else line += "\"...\"";
traceLine(line.c_str());
} catch (...) {
traceLine("Unknown exception caught during trace catch");
1.14 +2 -2 ws-axis/c/src/common/AxisTrace.h
Index: AxisTrace.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AxisTrace.h 1 Nov 2004 14:12:07 -0000 1.13
+++ AxisTrace.h 11 Nov 2004 10:51:35 -0000 1.14
@@ -207,13 +207,13 @@
/**
* Traces the exit to a method.
*/
- void traceExit(const char *className, const char *methodName,
+ void traceExit(const char *className, const char *methodName, int returnIndex,
AxisTraceType type=TRACETYPE_UNKNOWN, unsigned len=0, void *value=0);
/**
* Traces something that has been caught
*/
- void traceCatch(const char *className, const char *methodName,
+ void traceCatch(const char *className, const char *methodName, int catchIndex,
AxisTraceType type=TRACETYPE_UNKNOWN, unsigned len=0, void *value=0);
private:
1.45 +64 -4 ws-axis/c/src/common/Param.cpp
Index: Param.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/Param.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- Param.cpp 10 Nov 2004 17:04:44 -0000 1.44
+++ Param.cpp 11 Nov 2004 10:51:35 -0000 1.45
@@ -57,6 +57,11 @@
}
break;
case XSD_BASE64BINARY:
+ if (AxisEngine::m_bServer)
+ {
+ delete [] m_Value.b64bValue.__ptr;
+ }
+ break;
case XSD_HEXBINARY:
if (AxisEngine::m_bServer)
{
@@ -171,16 +176,71 @@
pSZ.serialize ("</", m_sName.c_str (), ">\n", NULL);
}
break;
- case XSD_ANY:
+ case XSD_ANY:
pSZ.serializeAnyObject(m_Value.pAnyObject);
- default:
- /* all basic types */
+ break;
+ case XSD_INT:
+ case XSD_BOOLEAN:
pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.nValue), m_Type);
+ break;
+ case XSD_UNSIGNEDINT:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.unValue), m_Type);
+ break;
+ case XSD_SHORT:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.sValue), m_Type);
+ break;
+ case XSD_UNSIGNEDSHORT:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.usValue), m_Type);
+ break;
+ case XSD_BYTE:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.cValue), m_Type);
+ break;
+ case XSD_UNSIGNEDBYTE:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.ucValue), m_Type);
+ break;
+ case XSD_LONG:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.llValue), m_Type);
+ break;
+ case XSD_INTEGER:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.lValue), m_Type);
+ break;
+ case XSD_UNSIGNEDLONG:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.ulValue), m_Type);
+ break;
+ case XSD_FLOAT:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.fValue), m_Type);
+ break;
+ case XSD_DOUBLE:
+ case XSD_DECIMAL:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.dValue), m_Type);
+ break;
+ case XSD_STRING:
+ case XSD_ANYURI:
+ case XSD_QNAME:
+ case XSD_NOTATION:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.pStrValue), m_Type);
+ break;
+ case XSD_HEXBINARY:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.hbValue), m_Type);
+ break;
+ case XSD_BASE64BINARY:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.b64bValue), m_Type);
+ break;
+ case XSD_DURATION:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.lDuration), m_Type);
+ break;
+ case XSD_DATETIME:
+ case XSD_DATE:
+ case XSD_TIME:
+ pSZ.serializeAsElement(m_sName.c_str (), &(m_Value.tValue), m_Type);
+ break;
+ default:
+ return AXIS_FAIL; //this is an unexpected situation
}
return AXIS_SUCCESS;
}
-int Param::setValue (XSDTYPE nType, uParamValue Value)
+int Param::setValue (XSDTYPE nType, ParamValue Value)
{
m_Type = nType;
switch (m_Type)
1.24 +36 -4 ws-axis/c/src/common/Param.h
Index: Param.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/Param.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Param.h 26 Oct 2004 09:37:57 -0000 1.23
+++ Param.h 11 Nov 2004 10:51:35 -0000 1.24
@@ -26,6 +26,40 @@
AXIS_CPP_NAMESPACE_START
class ArrayBean;
+
+class ParamValue
+{
+public:
+ int nValue;
+ unsigned int unValue;
+ short sValue;
+ unsigned short usValue;
+ long lValue;
+ unsigned ulValue;
+//FJP v Added
+#ifdef WIN32
+ __int64 llValue;
+#else
+ long long llValue;
+#endif
+//FJP ^ Added
+ char cValue;
+ unsigned char ucValue;
+ float fValue;
+ double dValue;
+ struct tm tValue;/* this will hold the c type tm struct*/
+ xsd__hexBinary hbValue;
+ xsd__base64Binary b64bValue;
+ long lDuration;/* duration in seconds*/
+ union {
+ class ArrayBean* pArray; /* this is used to hold arrays */
+ class IArrayBean* pIArray; /* used by wrapper classes */
+ };
+ ComplexObjectHandler* pCplxObj;
+ const AxisChar* pStrValue;
+ AnyType* pAnyObject; /* used to hold AnyType struct for xsd:any */
+};
+
/*
* @class Param
* @brief interface for the Param class.
@@ -43,16 +77,14 @@
virtual ~Param();
private:
- uParamValue m_Value;
+ ParamValue m_Value;
AxisString m_sName; /* Name of the parameter */
XSDTYPE m_Type; /* Type of the parameter */
-
-private:
AxisString m_strPrefix; /* needed in serialization only */
AxisString m_strUri; /* needed in serialization only */
public:
- int setValue(XSDTYPE nType, uParamValue Value);
+ int setValue(XSDTYPE nType, ParamValue Value);
int serialize(SoapSerializer& pSZ);
void setPrefix(const AxisChar* prefix);
void setUri(const AxisChar* uri);
1.74 +6 -1 ws-axis/c/src/soap/SoapSerializer.cpp
Index: SoapSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- SoapSerializer.cpp 10 Nov 2004 17:05:52 -0000 1.73
+++ SoapSerializer.cpp 11 Nov 2004 10:51:35 -0000 1.74
@@ -599,9 +599,11 @@
break;
//FJP ^ Added
case XSD_INTEGER:
- case XSD_DURATION:
pParam->m_Value.lValue = *((long*)(pValue));
break;
+ case XSD_DURATION:
+ pParam->m_Value.lDuration = *((long*)(pValue));
+ break;
case XSD_UNSIGNEDLONG:
pParam->m_Value.ulValue = *((unsigned long*)(pValue));
break;
@@ -612,6 +614,9 @@
case XSD_DECIMAL:
pParam->m_Value.dValue = *((double*)(pValue));
break;
+ case XSD_ANYURI:
+ case XSD_QNAME:
+ case XSD_NOTATION:
case XSD_STRING:
pParam->m_Value.pStrValue = *((char**)(pValue));
break;
1.4 +15 -6 ws-axis/c/tools/trace/org/apache/axis/tracetool/AddEntryAndExitTrace.java
Index: AddEntryAndExitTrace.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/trace/org/apache/axis/tracetool/AddEntryAndExitTrace.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AddEntryAndExitTrace.java 9 Nov 2004 15:55:26 -0000 1.3
+++ AddEntryAndExitTrace.java 11 Nov 2004 10:51:35 -0000 1.4
@@ -137,14 +137,23 @@
outputFile.write(mp.getOriginalSignature() + "{");
outputFile.traceEntry(mp.getSignature());
BodyPart[] bps = mp.getBodyParts();
+
+ int returnCount = 0, catchCount = 0, returnIndex = 0, catchIndex = 0;
+ for (int i = 0; i < bps.length-1; i++) if (bps[i].isReturn()) returnCount++;
+ for (int i = 0; i < bps.length-1; i++) if (bps[i].isCatch()) catchCount++;
+
for (int i = 0; i < bps.length; i++) {
outputFile.write(bps[i].getCodeFragment());
- if (bps[i].isReturn())
- outputFile.traceExit(bps[i].getReturnValue());
- else if (bps[i].isCatch())
- outputFile.traceCatch(bps[i].getCaughtValue());
- else if (i < bps.length - 1)
- outputFile.traceExit();
+ if (bps[i].isReturn()) {
+ if (returnCount>1) returnIndex++;
+ outputFile.traceExit(bps[i].getReturnValue(), returnIndex);
+ } else if (bps[i].isCatch()) {
+ if (catchCount>1) catchIndex++;
+ outputFile.traceCatch(bps[i].getCaughtValue(), catchIndex);
+ } else if (i < bps.length - 1) {
+ if (returnCount>1) returnIndex++;
+ outputFile.traceExit(returnIndex);
+ }
}
} else {
outputFile.write(fp.toString());
1.8 +3 -1 ws-axis/c/tools/trace/org/apache/axis/tracetool/Exclusions.java
Index: Exclusions.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/trace/org/apache/axis/tracetool/Exclusions.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Exclusions.java 9 Nov 2004 15:55:26 -0000 1.7
+++ Exclusions.java 11 Nov 2004 10:51:35 -0000 1.8
@@ -44,7 +44,9 @@
"Channel.hpp",
"Channel.h",
"Channel.cpp",
- "SoapSerializer.cpp",
+ "Param.h",
+ "Array.hpp",
+ "Buffer.hpp",
// Axis.cpp contains a copyright sign (circle with a "C" in it) which
// makes readline throw a MalformedInputException on linux possibly due to
// locale/charset problems.
1.5 +1 -1 ws-axis/c/tools/trace/org/apache/axis/tracetool/Signature.java
Index: Signature.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/trace/org/apache/axis/tracetool/Signature.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Signature.java 9 Nov 2004 15:55:26 -0000 1.4
+++ Signature.java 11 Nov 2004 10:51:35 -0000 1.5
@@ -24,7 +24,7 @@
/**
* A C or C++ method signature with the ability to parse it.
- * TODO: support variable length argument lists using "..."
+ * TODO: properly support variable length argument lists using "..."
* TODO: passing or returning function pointers (hopefully not needed)
* TODO: Cope with ~<space>Classname()
*/
1.7 +14 -9 ws-axis/c/tools/trace/org/apache/axis/tracetool/Tracer.java
Index: Tracer.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/trace/org/apache/axis/tracetool/Tracer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Tracer.java 9 Nov 2004 15:55:26 -0000 1.6
+++ Tracer.java 11 Nov 2004 10:51:35 -0000 1.7
@@ -22,7 +22,6 @@
/**
* A Buffered write that also contains the methods to add in in trace
* TODO: Add in &this and threadid into each trace record
- * TODO: Sort out indentation
*/
class Tracer extends BufferedWriter {
private Signature signature = null;
@@ -84,8 +83,10 @@
Parameter[] parms = signature.getParameters();
int len = 0;
- if (null != parms)
- len = parms.length;
+ if (null != parms) {
+ if (parms[parms.length-1].isDotDotDot()) len = parms.length - 1;
+ else len = parms.length;
+ }
String line =
"\n"
+ "\t#ifdef ENABLE_AXISTRACE\n"
@@ -104,7 +105,7 @@
flush();
}
- void traceExit() throws Exception {
+ void traceExit(int returnIndex) throws Exception {
if (!signature.traceable())
return;
@@ -122,7 +123,9 @@
+ getClassName()
+ ", \""
+ signature.getMethodName()
- + "\");\t"
+ + "\", "
+ + returnIndex
+ + ");\t"
+ SIGNATURE
+ "\n";
line += "\t\t#endif\n";
@@ -139,7 +142,7 @@
* This method prints out the complete return line as well so the user
* does not need to print this out themselves.
*/
- void traceExit(String value) throws Exception {
+ void traceExit(String value, int returnIndex) throws Exception {
if (!signature.traceable())
return;
@@ -169,7 +172,8 @@
+ getClassName()
+ ", \""
+ signature.getMethodName()
- + "\""
+ + "\", "
+ + returnIndex
+ getTypeParms(signature.getReturnType())
+ ");\t"
+ SIGNATURE
@@ -183,7 +187,7 @@
flush();
}
- void traceCatch(Parameter value) throws Exception {
+ void traceCatch(Parameter value, int catchIndex) throws Exception {
if (!signature.traceable())
return;
@@ -195,7 +199,8 @@
+ getClassName()
+ ", \""
+ signature.getMethodName()
- + "\""
+ + "\", "
+ + catchIndex
+ getTypeParms(value);
line += ");\t" + SIGNATURE + "\n";
line += "\t#endif\n";