Package org.apache.axis.wsdl.symbolTable

Examples of org.apache.axis.wsdl.symbolTable.MessageEntry


            generatedFaults.add(name);

            // Generate the 'Simple' Faults.
            // The complexType Faults are automatically handled
            // by JavaTypeWriter.
            MessageEntry me = symbolTable.getMessageEntry(message.getQName());
            boolean emitSimpleFault = true;
            if (me != null) {
                Boolean complexTypeFault = (Boolean)
                    me.getDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT);
                if (complexTypeFault != null &&
                    complexTypeFault.booleanValue()) {
                    emitSimpleFault = false;
                }
            }
View Full Code Here


     * @param symbolTable
     * @return
     */
    public Generator getGenerator(Message message, SymbolTable symbolTable) {
        if (include(message.getQName())) {
            MessageEntry mEntry = symbolTable.getMessageEntry(message.getQName());
            messageWriters.addStuff(new NoopGenerator(), mEntry, symbolTable);
            return messageWriters;
        }
        else {
            return new NoopGenerator();
View Full Code Here

            exceptionClassName = excName;
        }

        // Set the name of the exception and
        // whether the exception is a complex type
        MessageEntry me =
                symbolTable.getMessageEntry(fault.getMessage().getQName());

        if (me != null) {
            me.setDynamicVar(JavaGeneratorFactory.EXCEPTION_DATA_TYPE,
                    faultXmlType);

            if (exceptionClassName != null) {
                me.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT,
                        Boolean.TRUE);
                me.setDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME,
                        exceptionClassName);
            } else {
                me.setDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME,
                        emitter.getJavaName(me.getQName()));
            }
        }
    }
View Full Code Here

            int index = 0;

            while (index < v.size()) {
                if (v.elementAt(index) instanceof MessageEntry) {
                    // Need to resolve a Exception message.
                    MessageEntry msgEntry = (MessageEntry) v.elementAt(index);                   
                    if (msgEntry.getDynamicVar(EXCEPTION_CLASS_NAME) == null) {
                        v.removeElementAt(index);
                    } else {                       
                        index++;
                    }
                } else {
                    index++;
                }
            }

            if (v.size() > 1) {
                boolean resolve = true;

                // Common Special Case:
                // If a Type and Element have the same QName, and the Element
                // references the Type, then they are the same class so
                // don't bother mangling.
                if (v.size() == 2 &&
                    ((v.elementAt(0) instanceof Element &&
                      v.elementAt(1) instanceof Type) ||
                     (v.elementAt(1) instanceof Element &&
                      v.elementAt(0) instanceof Type))) {
                    Element e;
                    if (v.elementAt(0) instanceof Element) {
                        e = (Element) v.elementAt(0);
                    } else {
                        e = (Element) v.elementAt(1);
                    }

                    BooleanHolder forElement = new BooleanHolder();
                    QName eType = Utils.getTypeQName(e.getNode(),
                            forElement, false);

                    if ((eType != null) && eType.equals(e.getQName())
                            && !forElement.value) {
                        resolve = false;
                    }
                }

                // Other Special Case:
                // If the names are already different, no mangling is needed.
                if (resolve) {
                    resolve = false;           // Assume false

                    String name = null;

                    for (int i = 0; (i < v.size()) && !resolve; ++i) {
                        SymTabEntry entry = (SymTabEntry) v.elementAt(i);

                        if ((entry instanceof MessageEntry)
                                || (entry instanceof BindingEntry)) {                           
                            // Need to resolve a exception class name                           
                            String exceptionClassName = (String) entry.getDynamicVar(EXCEPTION_CLASS_NAME);
                            if (exceptionClassName != null) {                               
                                if (name == null) {
                                    name = exceptionClassName;
                                } else if (name.equals(exceptionClassName)) {
                                    resolve = true;
                                }
                            }
                        } else if (name == null) {
                            name = entry.getName();
                        } else if (name.equals(entry.getName())) {
                            resolve = true;    // Need to do resolution
                        }
                    }
                }

                // Full Mangle if resolution is necessary.
                if (resolve) {
                    boolean firstType = true;

                    for (int i = 0; i < v.size(); ++i) {
                        SymTabEntry entry = (SymTabEntry) v.elementAt(i);

                        if (entry instanceof Element) {
                            entry.setName(mangleName(entry.getName(), ELEMENT_SUFFIX));

                            // If this global element was defined using
                            // an anonymous type, then need to change the
                            // java name of the anonymous type to match.
                            QName anonQName =
                                    new QName(entry.getQName().getNamespaceURI(),
                                            SymbolTable.ANON_TOKEN
                                    + entry.getQName().getLocalPart());
                           
                            TypeEntry anonType =
                                    symbolTable.getType(anonQName);

                            if (anonType != null) {
                                anonType.setName(entry.getName());
                                anonTypes.add(anonType);
                            }                           
                        } else if (entry instanceof TypeEntry) {

                            // Search all other types for java names that match this one.
                            // The sameJavaClass method returns true if the java names are
                            // the same (ignores [] ).
                            if (firstType) {
                                firstType = false;

                                Iterator types =
                                        symbolTable.getTypeIndex().values().iterator();

                                while (types.hasNext()) {
                                    TypeEntry type = (TypeEntry) types.next();

                                    if ((type != entry)
                                            && (type.getBaseType() == null)
                                            && sameJavaClass(entry.getName(),
                                                    type.getName())) {
                                        v.add(type);
                                    }
                                }
                            }

                            // If this is an anonymous type, it's name was resolved in
                            // the previous if block.  Don't reresolve it.
                            if (!anonTypes.contains(entry)) {
                                // In case that other entry in name collision among
                                // PortTypeEntry, ServiceEntry and BindingEntry
                               
                                boolean needResolve = false;
                               
                                // check collision of TypeEntry with PortTypeEntry, ServiceEtnry and/or BindingEntry
                                for (int j = 0; j < v.size(); j++) {
                                    SymTabEntry e = (SymTabEntry) v.elementAt(j);
                                    if ((e instanceof PortTypeEntry
                                            || e instanceof ServiceEntry
                                            || e instanceof BindingEntry)) {
                                        needResolve = true;
                                        break;
                                    }
                                }
                               
                                if (!needResolve) {
                                    continue;
                                }                                                               
                               
                                // Appended Suffix for avoiding name collisions (JAX-RPC 1.1)
                                Boolean isComplexTypeFault = (Boolean)entry.getDynamicVar(COMPLEX_TYPE_FAULT);
                                if ((isComplexTypeFault != null) && isComplexTypeFault.booleanValue()) {
                                    entry.setName(mangleName(entry.getName(), EXCEPTION_SUFFIX));
                                }
                                else {
                                    entry.setName(mangleName(entry.getName(), TYPE_SUFFIX));
                                }
                               
                                // should update the class name of ElementEntry which references this type entry
                                Map elementIndex = symbolTable.getElementIndex();
                                List elements = new ArrayList(elementIndex.values());
                                for (int j = 0; j < elementIndex.size(); j++) {
                                    TypeEntry te = (TypeEntry) elements.get(j);
                                    TypeEntry ref = te.getRefType();
                                    if (ref != null && entry.getQName().equals(ref.getQName())) {
                                        te.setName(entry.getName());
                                    }
                                }          
                               
                                // Need to resolve a complex-type exception message.
                                if ((isComplexTypeFault != null) && isComplexTypeFault.booleanValue()) {
                                    // SHOULD update the exception class name of a referencing message entry.
                                    List messageEntries = symbolTable.getMessageEntries();
                                    for (int j = 0; j < messageEntries.size(); j++) {
                                        MessageEntry messageEntry = (MessageEntry)messageEntries.get(j);
                                        Boolean isComplexTypeFaultMsg = (Boolean)messageEntry.getDynamicVar(COMPLEX_TYPE_FAULT);
                                        if ((isComplexTypeFaultMsg != null) && (isComplexTypeFaultMsg.booleanValue())) {
                                            QName exceptionDataType = (QName)messageEntry.getDynamicVar(EXCEPTION_DATA_TYPE);
                                            if (((TypeEntry)entry).getQName().equals(exceptionDataType)) {
                                                String className = (String)messageEntry.getDynamicVar(EXCEPTION_CLASS_NAME);
                                                messageEntry.setDynamicVar(EXCEPTION_CLASS_NAME, className + EXCEPTION_SUFFIX);
                                            }
                                        }
                                    }
                                }
                            }
View Full Code Here

     * Since Wsdl2java doesn't emit anything for Messages, return the No-op generator.
     */
    private Writers messageWriters = new Writers();

    public Generator getGenerator(Message message, SymbolTable symbolTable) {
        MessageEntry mEntry = symbolTable.getMessageEntry(message.getQName());
        messageWriters.addStuff(new NoopGenerator(), mEntry, symbolTable);
        return messageWriters;
    } // getGenerator
View Full Code Here

                exceptionClassName = emitter.getJavaName(te.getQName());
            }
        }
        // Set the name of the exception and
        // whether the exception is a complex type
        MessageEntry me = symbolTable.getMessageEntry(
            fault.getMessage().getQName());
        if (me != null) {
            if (exceptionClassName != null) {
                me.setDynamicVar(
                                 JavaGeneratorFactory.COMPLEX_TYPE_FAULT,
                                 new Boolean(true));
                me.setDynamicVar(
                                 JavaGeneratorFactory.EXCEPTION_CLASS_NAME,
                                 exceptionClassName);
            } else {
                me.setDynamicVar(
                                 JavaGeneratorFactory.EXCEPTION_CLASS_NAME,
                                 emitter.getJavaName(me.getQName()));
            }
           
        }
    }
View Full Code Here

     * @param symbolTable the current symbol table
     * @return A Java class name for the fault
     */
    public static String getFullExceptionName(Message faultMessage,
                                              SymbolTable symbolTable) {
        MessageEntry me = symbolTable.getMessageEntry(faultMessage.getQName());
        return (String) me.getDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME);
    } // getFullExceptionName
View Full Code Here

     * @param symbolTable the current symbol table
     * @return A QName for the XML type of the data
     */
    public static QName getFaultDataType(Message faultMessage,
                                         SymbolTable symbolTable) {
        MessageEntry me = symbolTable.getMessageEntry(faultMessage.getQName());
        return (QName) me.getDynamicVar(JavaGeneratorFactory.EXCEPTION_DATA_TYPE);
    } // getFaultDataType
View Full Code Here

     * @param symbolTable the current symbol table
     * @return A Java class name for the fault
     */
    public static boolean isFaultComplex(Message faultMessage,
                                         SymbolTable symbolTable) {
        MessageEntry me = symbolTable.getMessageEntry(faultMessage.getQName());
        Boolean ret = (Boolean) me.getDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT);
        if (ret != null) {
            return ret.booleanValue();
        } else {
            return false;
        }
View Full Code Here

            generatedFaults.add(name);

            // Generate the 'Simple' Faults.
            // The complexType Faults are automatically handled
            // by JavaTypeWriter.
            MessageEntry me = symbolTable.getMessageEntry(message.getQName());
            boolean emitSimpleFault = true;
            if (me != null) {
                Boolean complexTypeFault = (Boolean)
                    me.getDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT);
                if (complexTypeFault != null &&
                    complexTypeFault.booleanValue()) {
                    emitSimpleFault = false;
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.axis.wsdl.symbolTable.MessageEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.