tomj 2002/10/03 11:58:07 Modified: java/src/org/apache/axis/description Tag: interop4 ServiceDesc.java OperationDesc.java FaultDesc.java java/src/org/apache/axis/utils Tag: interop4 BeanUtils.java Log: Add some code to generate fault data Schema (almost) correctly. Set up the OperationDesc/FaultDesc for the JavaBeanFaultWriter to use to get the serialization information it will need. Code to use it will come later. Revision Changes Path No revision No revision 1.64.2.1 +10 -3 xml-axis/java/src/org/apache/axis/description/ServiceDesc.java Index: ServiceDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v retrieving revision 1.64 retrieving revision 1.64.2.1 diff -u -r1.64 -r1.64.2.1 --- ServiceDesc.java 29 Sep 2002 19:35:52 -0000 1.64 +++ ServiceDesc.java 3 Oct 2002 18:58:07 -0000 1.64.2.1 @@ -646,6 +646,9 @@ oper.setReturnClass(method.getReturnType()); + // Do the faults + createFaultMetadata(method, oper); + // At some point we might want to check here to see if this // Method is already associated with another Operation, but // this doesn't seem critital. @@ -1080,6 +1083,13 @@ } } + createFaultMetadata(method, operation); + + addOperationDesc(operation); + method2OperationMap.put(method, operation); + } + + private void createFaultMetadata(Method method, OperationDesc operation) { // Create Exception Types Class[] exceptionTypes = new Class[method.getExceptionTypes().length]; exceptionTypes = method.getExceptionTypes(); @@ -1147,9 +1157,6 @@ operation.addFault(fault); } } - - addOperationDesc(operation); - method2OperationMap.put(method, operation); } private String[] getParamNames(Method method) { 1.23.2.1 +14 -0 xml-axis/java/src/org/apache/axis/description/OperationDesc.java Index: OperationDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/OperationDesc.java,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -u -r1.23 -r1.23.2.1 --- OperationDesc.java 26 Sep 2002 04:35:05 -0000 1.23 +++ OperationDesc.java 3 Oct 2002 18:58:07 -0000 1.23.2.1 @@ -355,6 +355,20 @@ { return faults; } + + /** + * Returns the FaultDesc for the fault class given. + * Returns null if not found. + */ + public FaultDesc getFaultByClass(Class cls) { + for (Iterator iterator = faults.iterator(); iterator.hasNext();) { + FaultDesc desc = (FaultDesc) iterator.next(); + if (desc.getClassName().equals(cls.getName())) { + return desc; + } + } + return null; + } public ParameterDesc getReturnParamDesc() { return returnDesc; 1.3.4.1 +9 -0 xml-axis/java/src/org/apache/axis/description/FaultDesc.java Index: FaultDesc.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/FaultDesc.java,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -r1.3 -r1.3.4.1 --- FaultDesc.java 23 Jul 2002 22:11:28 -0000 1.3 +++ FaultDesc.java 3 Oct 2002 18:58:07 -0000 1.3.4.1 @@ -65,6 +65,7 @@ public class FaultDesc { private QName qname; private ArrayList parameters; + private String className; public QName getQName() { return qname; @@ -94,6 +95,13 @@ this.parameters = parameters; } + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } public String toString() { return toString(""); @@ -101,6 +109,7 @@ public String toString(String indent) { String text =""; text+= indent + "qname: " + getQName() + "\n"; + text+= indent + "Class: " + getClassName() + "\n"; for (int i=0; i<parameters.size(); i++) { text+= indent +" ParameterDesc[" + i + "]:\n"; text+= indent + ((ParameterDesc)parameters.get(i)).toString(" ") + "\n"; No revision No revision 1.15.2.1 +12 -0 xml-axis/java/src/org/apache/axis/utils/BeanUtils.java Index: BeanUtils.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/BeanUtils.java,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -r1.15 -r1.15.2.1 --- BeanUtils.java 18 Sep 2002 16:10:41 -0000 1.15 +++ BeanUtils.java 3 Oct 2002 18:58:07 -0000 1.15.2.1 @@ -56,6 +56,7 @@ import org.apache.axis.InternalException; import org.apache.axis.Constants; +import org.apache.axis.AxisFault; import org.apache.axis.description.TypeDesc; import org.apache.axis.description.FieldDesc; @@ -121,6 +122,11 @@ result = Introspector. getBeanInfo(secJavaType,Exception.class). getPropertyDescriptors(); + } else if (superClass == AxisFault.class) { + // Don't include AxisFault data + result = Introspector. + getBeanInfo(secJavaType,AxisFault.class). + getPropertyDescriptors(); } else { // privileged code goes here result = Introspector. @@ -212,6 +218,12 @@ // add it if not. for (int i=0; i < fields.length; i++) { Field f = fields[i]; + // skip if field come from a java.* or javax.* package + // WARNING: Is this going to make bad things happen for + // users JavaBeans? Do they WANT these fields serialzed? + if (f.getDeclaringClass().getName().startsWith("java")) { + continue; + } // skip field if it is final, transient, or static if (!(Modifier.isStatic(f.getModifiers()) || Modifier.isFinal(f.getModifiers()) ||