FileDocCategorySizeDatePackage
JavaBeanFaultWriter.javaAPI DocApache Axis 1.45314Sat Apr 22 18:57:28 BST 2006org.apache.axis.wsdl.toJava

JavaBeanFaultWriter

public class JavaBeanFaultWriter extends JavaBeanWriter
This is Wsdl2java's Complex Fault Writer. It generates bean-like class for complexTypes used in an operation fault message.

Fields Summary
public static final Set
RESERVED_PROPERTY_NAMES
All server specific exception classes have {@link Throwable} as an indirect superclass. Throwable defines a set of properties that may potentially conflict with those that would be generated by this class for an XSD complex type used as a fault. The following immutable object contains all property names that must be excluded when generating a service specific exception. Note: {@link org.apache.axis.encoding.ser.BeanSerializer} always excludes Throwable's and AxisFault's properties when marshalling a service Java exception.
Constructors Summary
protected JavaBeanFaultWriter(Emitter emitter, org.apache.axis.wsdl.symbolTable.TypeEntry type, Vector elements, org.apache.axis.wsdl.symbolTable.TypeEntry extendType, Vector attributes, JavaWriter helper)
Constructor.

param
emitter
param
type The type representing this class
param
elements Vector containing the Type and name of each property
param
extendType The type representing the extended class (or null)
param
attributes Vector containing the attribute types and names
param
helper Helper class writer

        Set   temp = new HashSet();
        // Throwable's properties.
        temp.add("cause");
        temp.add("message");
        temp.add("localizedMessage");
        temp.add("stackTrace");
        // AxisFault's properties.
        temp.add("faultActor");
        temp.add("faultCode");
        temp.add("faultDetails");
        temp.add("faultNode");
        temp.add("faultReason");
        temp.add("faultRole");
        temp.add("faultString");
        temp.add("faultSubCodes");
        temp.add("headers");
        RESERVED_PROPERTY_NAMES = Collections.unmodifiableSet(temp);
    

        super(emitter, type, elements, extendType, attributes, helper);

        // The Default Constructor is not JSR 101 v1.0 compliant, but
        // is the only way that Axis can get something back over the wire.
        // This will need to be changed when fault contents are supported
        // over the wire.
        enableDefaultConstructor = true;

        // JSR 101 v1.0 requires a full constructor
        enableFullConstructor = true;

        // JSR 101 v1.0 does not support write access methods
        enableSetters = true;
    
Methods Summary
protected java.lang.StringgetExtendsText()
Returns the appropriate extends text

return
"" or " extends "


        // See if this class extends another class
        String extendsText = super.getExtendsText();

        if (extendsText.equals("")) {

            // JSR 101 compliant code should extend java.lang.Exception!
            // extendsText = " extends java.lang.Exception ";
            extendsText = " extends org.apache.axis.AxisFault ";
        }

        return extendsText;
    
protected voidwriteFileFooter(java.io.PrintWriter pw)
Write the Exception serialization code

NOTE: This function is written in JavaFaultWriter.java also.

param
pw
throws
IOException


        // We need to have the Exception class serialize itself
        // with the correct namespace, which can change depending on which
        // operation the exception is thrown from.  We therefore have the
        // framework call this generated routine with the correct QName,
        // and allow it to serialize itself.
        // method that serializes this exception (writeDetail)
        pw.println();
        pw.println("    /**");
        pw.println("     * Writes the exception data to the faultDetails");
        pw.println("     */");
        pw.println(
                "    public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context) throws java.io.IOException {");
        pw.println("        context.serialize(qname, null, this);");
        pw.println("    }");
        super.writeFileFooter(pw);