whitlock 2002/06/27 03:44:49
Modified: java/src/org/apache/wsif/providers/ejb
WSIFDynamicProvider_EJB.java WSIFOperation_EJB.java
WSIFPort_EJB.java
java/src/org/apache/wsif/logging Tr.java
Log:
Improve trace
Revision Changes Path
1.2 +2 -0
xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFDynamicProvider_EJB.java
Index: WSIFDynamicProvider_EJB.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFDynamicProvider_EJB.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WSIFDynamicProvider_EJB.java 6 Jun 2002 08:28:51 -0000 1.1
+++ WSIFDynamicProvider_EJB.java 27 Jun 2002 10:44:48 -0000 1.2
@@ -134,6 +134,7 @@
Tr.exit(bindings);
return bindings;
} catch (ClassNotFoundException e) {
+ Tr.exception(e);
Tr.exit(new String[0]);
return new String[0];
}
@@ -154,6 +155,7 @@
Tr.exit(addresses);
return addresses;
} catch (ClassNotFoundException e) {
+ Tr.exception(e);
Tr.exit(new String[0]);
return new String[0];
}
1.6 +66 -13
xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFOperation_EJB.java
Index: WSIFOperation_EJB.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFOperation_EJB.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WSIFOperation_EJB.java 25 Jun 2002 10:46:22 -0000 1.5
+++ WSIFOperation_EJB.java 27 Jun 2002 10:44:48 -0000 1.6
@@ -154,6 +154,7 @@
.get(
0);
} catch (Exception e) {
+ Tr.exception(e);
throw new WSIFException(
"Unable to resolve EJB binding for operation '"
+ bindingOperationModel.getName()
@@ -198,8 +199,9 @@
return woe;
}
- protected static Class getClassForName(String classname)
+ private static Class getClassForName(String classname)
throws WSIFException {
+ Tr.entry(null, classname);
Class cls = null;
if (classname == null) {
@@ -240,20 +242,24 @@
Thread.currentThread().getContextClassLoader());
}
} catch (ClassNotFoundException ex) {
+ Tr.exception(ex);
throw new WSIFException(
"Could not instantiate class '" + classname + "'",
ex);
}
+ Tr.exit(cls);
return cls;
}
protected Map getFaultMessageInfos() throws WSIFException {
+ Tr.entry(this);
// Get the current operation
Operation operation = null;
try {
operation = getOperation();
} catch (Exception e) {
+ Tr.exception(e);
throw new WSIFException("Failed to get Operation", e);
}
@@ -305,10 +311,12 @@
}
}
+ Tr.exit(fieldFaultMessageInfos);
return fieldFaultMessageInfos;
}
protected String getInputMessageName() throws WSIFException {
+ Tr.entry(this);
if (fieldInputMessageName == null) {
BindingInput bindingInputModel =
fieldBindingOperationModel.getBindingInput();
@@ -316,10 +324,12 @@
fieldInputMessageName = bindingInputModel.getName();
}
}
+ Tr.exit(fieldInputMessageName);
return fieldInputMessageName;
}
protected Method[] getMethods() throws WSIFException {
+ Tr.entry(this);
Method[] candidates;
try {
// Get the possible methods with the argument classes we've found.
@@ -390,10 +400,13 @@
for (int k = 0; k < candidates.length; k++) {
candidates[k] = (Method) possibles.get(k);
}
+ Tr.exit(candidates);
return candidates;
} catch (WSIFException ex) {
+ Tr.exception(ex);
throw ex;
} catch (Exception ex) {
+ Tr.exception(ex);
throw new WSIFException(
"Error while resolving meta information of method "
+ fieldEJBOperationModel.getMethodName()
@@ -403,9 +416,12 @@
}
private void buildTypeMap() throws WSIFException {
+ Tr.entry(this);
// Only build once!
- if (fieldTypeMapBuilt)
+ if (fieldTypeMapBuilt) {
+ Tr.exit();
return;
+ }
TypeMapping typeMapping = null;
@@ -422,6 +438,7 @@
if (typeMapping.getEncoding().equals("Java"))
break;
} catch (ClassCastException exn) {
+ Tr.exception(exn);
}
}
@@ -451,9 +468,11 @@
}
}
fieldTypeMapBuilt = true;
+ Tr.exit();
}
private Operation getOperation() throws Exception {
+ Tr.entry(this);
Operation operation = null;
buildTypeMap();
@@ -464,6 +483,7 @@
inputName =
this.fieldBindingOperationModel.getBindingInput().getName();
} catch (NullPointerException e) {
+ Tr.exception(e);
inputName = null;
}
@@ -472,22 +492,23 @@
outputName =
this.fieldBindingOperationModel.getBindingOutput().getName();
} catch (NullPointerException e) {
+ Tr.exception(e);
outputName = null;
}
// Build the parts list
operation =
- this
- .fieldPortModel
- .getBinding()
- .getPortType()
- .getOperation(this.fieldBindingOperationModel.getName(),
- //this.fieldBindingOperationModel.getBindingInput().getName(),
- inputName, outputName);
+ this.fieldPortModel.getBinding().getPortType().getOperation(
+ this.fieldBindingOperationModel.getName(),
+ inputName,
+ outputName);
+ //this.fieldBindingOperationModel.getBindingInput().getName(),
+ Tr.exit(operation);
return operation;
}
protected Object getMethodReturnClass() throws WSIFException {
+ Tr.entry(this);
Object methodReturnClass = null;
try {
String returnPartString = fieldEJBOperationModel.getReturnPart();
@@ -520,7 +541,7 @@
} else {
// If we get here then the return part specified on the java
operation was not
// in the output message
- throw new Exception(
+ throw new WSIFException(
"returnPart '"
+ returnPartString
+ "' was not in the output message");
@@ -528,6 +549,7 @@
}
// returnPart attribute was not present so return methodReturnClass as
default null
} catch (Exception ex) {
+ Tr.exception(ex);
throw new WSIFException(
"Error while determining return class of method "
+ fieldEJBOperationModel.getMethodName()
@@ -535,10 +557,12 @@
ex);
}
+ Tr.exit(methodReturnClass);
return methodReturnClass;
}
protected Object[] getMethodArgumentClasses() throws WSIFException {
+ Tr.entry(this);
Object[] methodArgClasses = null;
try {
@@ -613,7 +637,7 @@
param);
}
if (part == null)
- throw new Exception(
+ throw new WSIFException(
"Part '"
+ param
+ "' from parameterOrder not found in input or output
message");
@@ -677,6 +701,7 @@
}
}
} catch (Exception ex) {
+ Tr.exception(ex);
throw new WSIFException(
"Error while determining signature of method "
+ fieldEJBOperationModel.getMethodName()
@@ -684,6 +709,7 @@
ex);
}
+ Tr.exit(methodArgClasses);
return methodArgClasses;
}
@@ -693,6 +719,7 @@
protected Object[] getCompatibleArguments(
Class[] parmTypes,
Object[] args) {
+ Tr.entry(this,parmTypes,args);
// Go through each argument checking it's compatability with the method arg
// creating a compatible set along the way.
// In essence this just converts from String to Character when necessary
@@ -700,6 +727,7 @@
// on the object value, PUT THEM HERE :-)
if (args == null || parmTypes == null) {
Object[] compatibleArgs = new Object[0];
+ Tr.exit(compatibleArgs);
return compatibleArgs;
}
@@ -714,21 +742,27 @@
Object convertedArg = getCompatibleObject(parmTypes[i], args[i]);
if (convertedArg == null) {
// can't convert one of the arguments so return null
+ Tr.exit(null);
return null;
} else {
compatibleArgs[i] = convertedArg;
}
}
+ Tr.exit(compatibleArgs);
return compatibleArgs;
}
protected Object getCompatibleReturn(Method method, Object returnObj) {
+ Tr.entry(this,method,returnObj);
+ Object o = null;
if (method.getReturnType().equals(java.lang.Character.class)) {
- return getCompatibleObject(java.lang.String.class, returnObj);
+ o = getCompatibleObject(java.lang.String.class, returnObj);
} else {
- return returnObj;
+ o = returnObj;
}
+ Tr.exit(o);
+ return o;
}
// Usually cls1.isAssignableFrom(cls2) returning false means you can't cast
@@ -741,22 +775,27 @@
// Note: if you are adding other cases ensure you add both directions since the
// this conversion may be needed on method args AND returns
protected Object getCompatibleObject(Class cls, Object obj) {
+ Tr.entry(this,cls,obj);
// String -> Character
if (cls.equals(java.lang.Character.class)
&& obj.getClass().equals(java.lang.String.class)) {
Character charArg = stringToCharacter((String) obj);
if (charArg == null) {
// Can't convert this string to character so return null
+ Tr.exit(null);
return null;
}
+ Tr.exit(charArg);
return charArg;
}
if (cls.equals(java.lang.String.class)
&& obj.getClass().equals(java.lang.Character.class)) {
+ Tr.exit(obj.toString());
return (obj.toString());
}
+ Tr.exit(obj);
return obj;
}
@@ -767,6 +806,7 @@
}
protected String getOutputMessageName() throws WSIFException {
+ Tr.entry(this);
if (fieldOutputMessageName == null) {
BindingOutput bindingOutputModel =
fieldBindingOperationModel.getBindingOutput();
@@ -774,6 +814,7 @@
fieldOutputMessageName = bindingOutputModel.getName();
}
}
+ Tr.exit(fieldOutputMessageName);
return fieldOutputMessageName;
}
@@ -812,6 +853,7 @@
arguments[i] = part;
foundInputParameter = true;
} catch (WSIFException e) {
+ Tr.exception(e);
if (fieldOutParameterNames.length > 0) {
String outParameterName = null;
for (int j = 0;
@@ -865,6 +907,7 @@
invokedOK = true;
break;
} catch (IllegalArgumentException ia) {
+ Tr.exception(ia);
// Ingore and try next method
}
// Side effect: Initialize port's object reference
@@ -936,6 +979,7 @@
}
}
} catch (WSIFException e) {
+ Tr.exception(e);
//ignore
}
}
@@ -944,6 +988,7 @@
}
break;
} catch (IllegalArgumentException ia) {
+ Tr.exception(ia);
// Ingore and try next method
}
}
@@ -954,6 +999,7 @@
+ fieldEJBOperationModel.getMethodName()
+ "'");
} catch (InvocationTargetException ex) {
+ Tr.exception(ex);
Throwable invocationFault = ex.getTargetException();
String className = invocationFault.getClass().getName();
Map faultMessageInfos = getFaultMessageInfos();
@@ -993,6 +1039,7 @@
operationSucceeded = false;
}
} catch (Exception exc) {
+ Tr.exception(exc);
// Nothing to do - just try the next one...
}
}
@@ -1017,6 +1064,7 @@
}
} catch (Exception ex) {
+ Tr.exception(ex);
// Log message
MessageLogger messageLog =
MessageLogger.newMessageLogger(
@@ -1071,6 +1119,7 @@
arguments[i] = part;
foundInputParameter = true;
} catch (WSIFException e) {
+ Tr.exception(e);
}
if (!foundInputParameter) {
@@ -1108,6 +1157,7 @@
invokedOK = true;
break;
} catch (IllegalArgumentException ia) {
+ Tr.exception(ia);
// Ingore and try next method
}
// Side effect: Initialize port's object reference
@@ -1130,6 +1180,7 @@
invokedOK = true;
break;
} catch (IllegalArgumentException ia) {
+ Tr.exception(ia);
// Ingore and try next method
}
}
@@ -1140,6 +1191,7 @@
+ fieldEJBOperationModel.getMethodName()
+ "'");
} catch (InvocationTargetException ex) {
+ Tr.exception(ex);
// Log message
MessageLogger messageLog =
MessageLogger.newMessageLogger(
@@ -1159,6 +1211,7 @@
+ "' failed.",
ex);
} catch (Exception ex) {
+ Tr.exception(ex);
// Log message
MessageLogger messageLog =
MessageLogger.newMessageLogger(
1.4 +4 -0
xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFPort_EJB.java
Index: WSIFPort_EJB.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFPort_EJB.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WSIFPort_EJB.java 19 Jun 2002 15:33:40 -0000 1.3
+++ WSIFPort_EJB.java 27 Jun 2002 10:44:48 -0000 1.4
@@ -179,6 +179,7 @@
initContext = new InitialContext(hash);
fieldEjbHome = (EJBHome)
initContext.lookup(address.getJndiName());
} catch (NoInitialContextException e) {
+ Tr.exception(e);
// Attempt to use Websphere default settings
try {
Class testClass =
@@ -194,6 +195,7 @@
initContext = new InitialContext(hash);
fieldEjbHome = (EJBHome)
initContext.lookup(address.getJndiName());
} catch (Exception ex) {
+ Tr.exception(ex);
// throw the original exception
throw e;
}
@@ -201,6 +203,7 @@
//fieldEjbHome = (EJBHome)
initContext.lookup(address.getJndiName());
} catch (Exception ex) {
+ Tr.exception(ex);
throw new WSIFException(
"Could not find EJB home '" + address.getJndiName() + "'",
ex);
@@ -219,6 +222,7 @@
Method createMethod =
ejbHome.getClass().getDeclaredMethod("create", null);
fieldEjbObject = (EJBObject) createMethod.invoke(ejbHome, null);
} catch (Exception ex) {
+ Tr.exception(ex);
throw new WSIFException(
"Could not create instance for home '" + ejbHome + "'",
ex);
1.3 +10 -0 xml-axis-wsif/java/src/org/apache/wsif/logging/Tr.java
Index: Tr.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/logging/Tr.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Tr.java 18 Jun 2002 13:58:26 -0000 1.2
+++ Tr.java 27 Jun 2002 10:44:49 -0000 1.3
@@ -339,6 +339,16 @@
}
}
+ public static void exception(Exception exception) {
+ try {
+ if (!ON)
+ return;
+ Tr.exception(0,exception);
+ } catch (Exception e) {
+ exceptionInTrace(e);
+ }
+ }
+
public static void exception(long type, Exception exception) {
try {
if (!ON)