Package org.jibx.runtime

Examples of org.jibx.runtime.QName


            }
           
        } else {
           
            // format name supplied, look it up and check compatibility
            QName qname = QName.deserialize(format, ctx);
            convert = defc.getNamedConversion(qname);
            if (convert == null) {
                ctx.throwStartTagException
                    ("Unknown format \"" + format + "\"");
            }
View Full Code Here


        }
       
        // build the actual component to be returned
        String type = (prop == null) ? null : prop.getTypeName();
        String text = ctx.attributeText(URI_ATTRIBUTES, STRUCTURE_MAPAS, type);
        QName qname = QName.deserialize(text, ctx);
        boolean nillable = ctx.attributeBoolean(URI_ATTRIBUTES,
            COMMON_NILLABLE, false);
        if (nillable) {
            parent.getBindingRoot().setSchemaInstanceUsed();
        }
        return new MappingReference(parent, prop, type, text, qname.toString(),
            objc, name, false, nillable);
    }
View Full Code Here

            // handle based on presence or absence of name attribute
            String text = ctx.attributeText(URI_ATTRIBUTES, FORMAT_NAME, null);
            if (text == null) {
                defc.setConversion(format);
            } else {
                QName qname = QName.deserialize(text, ctx);
                defc.setNamedConversion(qname, format);
            }
           
            // scan past end of definition
            ctx.parsePastEndTag(URI_ELEMENTS, FORMAT_ELEMENT);
View Full Code Here

     *
     * @param type primitive type name, or fully qualified class name
     * @return schema type
     */
    public static QName schemaType(String type) {
        QName stype = (QName)s_primitiveTypeMap.get(type);
        if (stype == null) {
            stype = (QName)s_objectTypeMap.get(type);
        }
        return stype;
    }
View Full Code Here

        boolean repeat = false;
       
        // check type or reference for element
        boolean isref = false;
        String ptype = parm.getBoundType();
        QName tname = (QName)typemap.get(ptype);
        if (tname == null) {
           
            // no mapped handling, so check first for object type parameter with corresponding schema type (byte[])
            tname = Types.schemaType(type);
            if (tname == null && (tname = Types.schemaType(ptype)) == null) {
               
                // must be either an array collection, or a reference
                repeat = parm.isCollection();
                String usetype = ptype.endsWith(">") ? type : ptype;
                BindingMappingDetail detail = m_bindingGenerator.getMappingDetail(usetype);
                if (detail == null) {
                    throw new IllegalStateException("No mapping found for type " + usetype);
                } else if (detail.isExtended()) {
                    elem.setRef(detail.getElementQName());
                    isref = true;
                } else {
                    MappingElement mapping = detail.getAbstractMapping();
                    tname = mapping.getTypeQName();
                    if (tname == null) {
                        tname = getMappingQName(usetype, mapping);
                    }
                }
               
            }
        }
        if (isref) {
            addSchemaReference(elem.getRef(), namemap, hold);
        } else {
           
            // set element type and name
            m_schemaGenerator.setElementType(tname, elem, hold);
            String ename = parm.getXmlName();
            if (ename == null) {
                ename = tname.getName();
            }
            elem.setName(ename);
            addSchemaReference(tname, namemap, hold);
        }
       
View Full Code Here

           
            // generate input message information
            Message rqmsg = new Message(odef.getRequestMessageName(), wns);
            op.addInputMessage(rqmsg);
            def.addMessage(rqmsg);
            QName rqelem = null;
            if (m_generationParameters.isDocLit()) {
               
                // check if input parameter defined for method
                ArrayList parms = odef.getParameters();
                if (parms.size() > 0) {
                   
                    // check for existing element definition matching the parameter type
                    ValueCustom parm = (ValueCustom)parms.get(0);
                    rqelem = (QName)classelems.get(parm.getWorkingType());
                    if (rqelem == null) {
                       
                        // create new element for parameter
                        ElementElement pelem = buildValueElement(parm, ptypemap, typeschemas, holder);
                        schema.getTopLevelChildren().add(pelem);
                        rqelem = pelem.getQName();
                       
                    } else {
                       
                        // import and use existing element definition
                        imports.add(elemschemas.get(rqelem));
                        addSchemaReference(rqelem, elemschemas, holder);
                       
                    }
                }
               
            } else {
               
                // construct a sequence for wrapped method parameters
                SequenceElement seq = new SequenceElement();
                ArrayList parms = odef.getParameters();
                for (int j = 0; j < parms.size(); j++) {
                    ValueCustom parm = (ValueCustom)parms.get(j);
                    String type = parm.getWorkingType();
                    ElementElement pelem;
                    if (!typemap.containsKey(type)) {
                       
                        // add predefined mapping type to known types and require schema import
                        QName tname = (QName)classtypes.get(type);
                        if (tname != null) {
                            typemap.put(type, tname);
                            imports.add(typeschemas.get(tname));
                        }
                       
                    }
                    pelem = buildValueElement(parm, ptypemap, typeschemas, holder);
                    seq.getParticleList().add(pelem);
                }
               
                // add corresponding schema definition to schema
                ComplexTypeElement tdef = new ComplexTypeElement();
                tdef.setContentDefinition(seq);
                ElementElement elem = new ElementElement();
                String wname = odef.getRequestWrapperName();
                elem.setName(wname);
                elem.setTypeDefinition(tdef);
                schema.getTopLevelChildren().add(elem);
                rqelem = new QName(sns, wname);
               
            }
           
            // add part definition to message (if present)
            if (rqelem != null) {
                MessagePart part = new MessagePart("part", rqelem);
                rqmsg.getParts().add(part);
                def.addNamespace(rqelem.getUri());
            }
           
            // generate output message information
            Message rsmsg = new Message(odef.getResponseMessageName(), wns);
            op.addOutputMessage(rsmsg);
            def.addMessage(rsmsg);
            ValueCustom rtrn = odef.getReturn();
            QName rselem = null;
            if (m_generationParameters.isDocLit()) {
               
                // check if return value defined for method
                if (!"void".equals(rtrn.getWorkingType())) {
                   
                    // check for existing element definition matching the return type
                    rselem = (QName)classelems.get(rtrn.getWorkingType());
                    if (rselem == null) {
                       
                        // create new element for return
                        ElementElement relem = buildValueElement(rtrn, ptypemap, typeschemas, holder);
                        schema.getTopLevelChildren().add(relem);
                        rselem = relem.getQName();
                       
                    } else {
                       
                        // import and use existing element definition
                        imports.add(elemschemas.get(rselem));
                        addSchemaReference(rqelem, elemschemas, holder);
                       
                    }
                }
               
            } else {
               
                // add corresponding schema definition to schema
                SequenceElement seq = new SequenceElement();
                if (!"void".equals(rtrn.getWorkingType())) {
                    ElementElement relem = buildValueElement(rtrn, ptypemap, typeschemas, holder);
                    seq.getParticleList().add(relem);
                }
                ComplexTypeElement tdef = new ComplexTypeElement();
                tdef.setContentDefinition(seq);
                ElementElement elem = new ElementElement();
                String wname = odef.getResponseWrapperName();
                elem.setName(wname);
                elem.setTypeDefinition(tdef);
                schema.getTopLevelChildren().add(elem);
                rselem = new QName(sns, wname);
               
            }
           
            // add part definition to message (if present)
            if (rselem != null) {
                MessagePart part = new MessagePart("part", rselem);
                rsmsg.getParts().add(part);
                def.addNamespace(rselem.getUri());
            }
           
            // process fault message(s) for operation
            ArrayList thrws = odef.getThrows();
            WsdlCustom wsdlcustom = m_generationParameters.getWsdlCustom();
            for (int j = 0; j < thrws.size(); j++) {
                ThrowsCustom thrw = (ThrowsCustom)thrws.get(j);
                String type = thrw.getType();
                Message fmsg = (Message)fltmap.get(type);
                if (fmsg == null) {
                   
                    // first time for this throwable, create the message
                    FaultCustom fault = wsdlcustom.forceFaultCustomization(type);
                    QName fqname = new QName(sns, fault.getElementName());
                    MessagePart part = new MessagePart("fault", fqname);
                    fmsg = new Message(fault.getFaultName(), wns);
                    fmsg.getParts().add(part);
                    def.addMessage(fmsg);
                    def.addNamespace(sns);
View Full Code Here

     */
    public QName addCollectionBinding(boolean doclit, ValueCustom value, Map typemap, BindingHolder bind) {
       
        // check for existing mapping
        String ptype = value.getBoundType();
        QName qname = (QName)typemap.get(ptype);
        if (qname == null) {
           
            // check for either not an array, or plain doc/lit
            String type = value.getWorkingType();
            if (doclit || !type.endsWith("[]")) {
               
                // create abstract mapping for collection class type
                MappingElementBase mapping = new MappingElement();
                mapping.setClassName(type);
                mapping.setAbstract(true);
                mapping.setCreateType(value.getCreateType());
                mapping.setFactoryName(value.getFactoryMethod());
               
                // generate the mapping type name from item class name and suffix
                String suffix;
                GlobalCustom global = m_generationParameters.getGlobal();
                IClass clas = global.getClassInfo(type);
                if (clas.isImplements("Ljava/util/List;")) {
                    suffix = "List";
                } else if (clas.isImplements("Ljava/util/Set;")) {
                    suffix = "Set";
                } else {
                    suffix = "Collection";
                }
                String itype = value.getItemType();
                ClassCustom cust = global.addClassCustomization(itype);
               
                // register the type name for mapping
                String name = cust.getSimpleName() + suffix;
                String uri = bind.getNamespace();
                qname = new QName(uri, CustomBase.convertName(name, CustomBase.CAMEL_CASE_NAMES));
                mapping.setTypeQName(qname);
                bind.addTypeNameReference(uri, uri);
                typemap.put(ptype, qname);
               
                // add collection definition details
View Full Code Here

                    // add concrete mapping for data type, if used
                    ThrowsCustom thrw = (ThrowsCustom)thrws.get(i);
                    FaultCustom fault = wsdlcustom.forceFaultCustomization(thrw.getType());
                    if (!concrs.contains(fault.getDataType())) {
                        concrs.add(fault.getDataType());
                        qnames.add(new QName(service.getNamespace(), fault.getElementName()));
                    }
                }
            }
        }
       
View Full Code Here

               
                // handle mapping as type if abstract with type name, or as element if concrete
                MappingElementBase mapping = (MappingElementBase)element;
                String cname = mapping.getClassName();
                if (mapping.isAbstract()) {
                    QName qname = mapping.getTypeQName();
                    if (qname != null) {
                        typemap.put(cname, qname);
                        if (s_logger.isDebugEnabled()) {
                            s_logger.debug("Added class " + cname + " with type " + qname);
                        }
                    }
                } else {
                    QName qname = new QName(mapping.getNamespace().getUri(), mapping.getName());
                    elemmap.put(cname, qname);
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Added class " + cname + " with element " + qname);
                    }
                }
View Full Code Here

           
            // make sure name is supplied
            if (getName() == null) {
                vctx.addError("The 'name' attribute is required for a global definition", this);
            } else {
                m_qname = new QName(ens, getName());
            }
           
            // make sure prohibited attributes are not present
            if (getRef() != null || getForm() != -1 || m_useType != -1) {
                vctx.addError("The 'ref', 'form', and 'use' attributes are prohibited for a global attribute definition", this);
            }
           
        } else {
           
            // make sure name or reference is supplied
            if (getName() == null && getRef() == null) {
                vctx.addError("Either a 'name' attribute or a 'ref' attribute is required for a local attribute definition", this);
            }
           
            // generate qname if name supplied
            if (getName() != null) {
                boolean def = schema.isAttributeQualifiedDefault();
                String uri = null;
                if (m_formChoice.isQualified(def)) {
                    uri = ens;
                }
                m_qname = new QName(uri, getName());
            }
        }
       
        // continue with parent class prevalidation
        super.prevalidate(vctx);
View Full Code Here

TOP

Related Classes of org.jibx.runtime.QName

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.