Package org.apache.axis.encoding

Examples of org.apache.axis.encoding.Deserializer$CallbackTarget


        QName itemType = context.getTypeFromAttributes(namespace,
                                                       localName,
                                                       attributes);

        // Get the deserializer for the type.
        Deserializer dSer = null;
        if (itemType != null && (context.getCurElement().getHref() == null)) {
            dSer = context.getDeserializerForType(itemType);
        }

        if (dSer == null) {
            // No deserializer can be found directly.  Need to look harder
            QName defaultType = defaultItemType;
            Class javaType = null;
            if (arrayClass != null &&
                arrayClass.isArray() &&
                defaultType == null) {
                javaType = arrayClass.getComponentType();
                defaultType = context.getTypeMapping().getTypeQName(javaType);
            }

            // We don't have a deserializer, the safest thing to do
            // is to set up using the DeserializerImpl below. 
            // The DeserializerImpl will take care of href/id and
            // install the appropriate serializer, etc.  The problem
            // is that takes a lot of time and will occur
            // all the time if no xsi:types are sent.  Most of the
            // time an item is a simple schema type (i.e. String)
            // so the following shortcut is used to get a Deserializer
            // for these cases.
            if (itemType == null && dSer == null) {
                if (defaultType != null && SchemaUtils.isSimpleSchemaType(defaultType)) {
                    dSer = context.getDeserializer(javaType, defaultType);
                }
            }
           
            // If no deserializer is
            // found, the deserializer is set to DeserializerImpl().
            // It is possible that the element has an href, thus we
            // won't know the type until the definitition is encountered.
            if (dSer == null) {
                dSer = new DeserializerImpl();
                // Determine a default type for the deserializer
                if (itemType == null) {
                    dSer.setDefaultType(defaultType);
                }
            }
        }


        // Register the callback value target, and
        // keep track of this index so we know when it has been set.
        dSer.registerValueTarget(
            new DeserializerTarget(this, new Integer(curIndex)));
       
        // The framework handles knowing when the value is complete, as
        // long as we tell it about each child we're waiting on...
        addChildDeserializer(dSer);
View Full Code Here


        // Get the deserializer for the type.  If no deserializer is
        // found, the deserializer is set to DeserializerImpl().
        // It is possible that the element has an href, thus we
        // won't know the type until the definitition is encountered.
        Deserializer dSer = null;
        if (itemType != null) {
            dSer = context.getDeserializerForType(itemType);
        }
        if (dSer == null) {
            dSer = new DeserializerImpl();
            // Determine a default type for the deserializer
            if (itemType == null) {
                QName defaultType = defaultItemType;
                // If defaultType is not known, try using the arrayClass info
                if (defaultType == null &&
                    arrayClass != null &&
                    arrayClass.isArray()) {
                    defaultType = context.getTypeMapping().
                        getTypeQName(arrayClass.getComponentType());
                }
                dSer.setDefaultType(defaultType);
            }
        }


        // Register the callback value target, and
        // keep track of this index so we know when it has been set.
        dSer.registerValueTarget(
            new DeserializerTarget(this, new Integer(curIndex)));
        waiting.add(new Integer(curIndex));

        curIndex++;
       
View Full Code Here

        // Get the type
        QName itemType = context.getTypeFromAttributes(namespace,
                                                       localName,
                                                       attributes);
        // Get the deserializer
        Deserializer dSer = null;
        if (itemType != null) {
           dSer = context.getDeserializerForType(itemType);
        }
        if (dSer == null) {
            dSer = new DeserializerImpl();
        }

        // When the value is deserialized, inform us.
        // Need to pass the index because multi-ref stuff may
        // result in the values being deserialized in a different order.
        dSer.registerValueTarget(new DeserializerTarget(this, new Integer(curIndex)));
        curIndex++;

        if (log.isDebugEnabled()) {
            log.debug("Exit: VectorDeserializer::onStartChild()");
        }
View Full Code Here

                }
            }
        }
        // try and see if this is an xsd:any namespace="##any" element before reporting a problem
        QName qn = null;
        Deserializer dSer = null;
        MessageContext messageContext = context.getMessageContext();
        if (propDesc == null && !messageContext.isEncoded()) {
            // try to put unknown elements into an Object property
            propDesc = getObjectPropertyDesc(elemQName, context);
            if (propDesc != null) {
                Boolean deserializeAny =  (Boolean) messageContext.getProperty(DESERIALIZE_ANY);
                if ((deserializeAny != null) && (deserializeAny.booleanValue())) {
                  dSer = context.getDeserializerForType(elemQName);
                }
                if (dSer == null)  {
                    qn = Constants.XSD_ANY;
                    // make sure that the Element Deserializer deserializes the current element and not the child
                    messageContext.setProperty(ElementDeserializer.DESERIALIZE_CURRENT_ELEMENT, Boolean.TRUE);
                } else {
                    qn = elemQName;
                }
            }
        }


        if (propDesc == null) {
            // No such field
            throw new SAXException(
                    JavaUtils.getMessage("badElem00", javaType.getName(),
                                         localName));
        }

        // Determine the QName for this child element.
        // Look at the type attribute specified.  If this fails,
        // use the javaType of the property to get the type qname.
        if (qn == null) {
            qn = context.getTypeFromAttributes(namespace, localName, attributes);
        }
       
        // get the deserializer
        if (dSer == null) {
            dSer = context.getDeserializerForType(qn);
        }
       
        // If no deserializer, use the base DeserializerImpl.
        // There may not be enough information yet to choose the
        // specific deserializer.
        if (dSer == null) {
            dSer = new DeserializerImpl();
            // determine a default type for this child element
            TypeMapping tm = context.getTypeMapping();
            Class type = propDesc.getType();
            dSer.setDefaultType(tm.getTypeQName(type));
        }
               
        if (propDesc.isWriteable()) {
            if (!propDesc.isIndexed()) {
                // Success!  Register the target and deserializer.
                collectionIndex = -1;
                dSer.registerValueTarget(
                                         new BeanPropertyTarget(value, propDesc));
            } else {
                // Success! This is a collection of properties so use the index
                collectionIndex++;
                dSer.registerValueTarget(
                                         new BeanPropertyTarget(value,
                                            propDesc,
                                            collectionIndex));
            }
        }
View Full Code Here

                if (qn == null)
                    throw new SAXException(
                            JavaUtils.getMessage("unregistered00", type.toString()));
               
                // get the deserializer
                Deserializer dSer = context.getDeserializerForType(qn);
                if (dSer == null)
                    throw new SAXException(
                            JavaUtils.getMessage("noDeser00", type.toString()));
                if (! (dSer instanceof SimpleDeserializer))
                    throw new SAXException(
                            JavaUtils.getMessage("AttrNotSimpleType00",
                                                 bpd.getName(),
                                                 type.toString()));
               
                // Success!  Create an object from the string and set
                // it in the bean
                try {
                    dSer.onStartElement(namespace, localName, qName, attributes, context);
                    Object val = ((SimpleDeserializer)dSer).
                        makeValue(attributes.getValue(i));
                    bpd.set(value, val);
                } catch (Exception e) {
                    throw new SAXException(e);
View Full Code Here

        throws SAXException
        {
            QName typeQName = context.getTypeFromAttributes(namespace,
                                                            localName,
                                                            attributes);
            Deserializer dser = context.getDeserializerForType(typeQName);

            // If no deserializer, use the base DeserializerImpl.
            if (dser == null)
                dser = new DeserializerImpl();

            // When the child value is ready, we
            // want our set method to be invoked.
            // To do this register a DeserializeTarget on the
            // new Deserializer.
            DeserializerTarget dt = null;
            if (context.isNil(attributes)) {
                dt = new DeserializerTarget(this, NILHINT);
            } else if (localName.equals("key")) {
                dt = new DeserializerTarget(this, KEYHINT);
            } else if (localName.equals("value")) {
                dt = new DeserializerTarget(this, VALHINT);
            } else {
                // Do nothing
            }
            if (dt != null) {
                dser.registerValueTarget(dt);
            }
            return (SOAPHandler)dser;
        }
View Full Code Here

                if (qn == null)
                    throw new SAXException(
                            JavaUtils.getMessage("unregistered00", type.toString()));

                // get the deserializer
                Deserializer dSer = context.getDeserializerForType(qn);
                if (dSer == null)
                    throw new SAXException(
                            JavaUtils.getMessage("noDeser00", type.toString()));
                if (! (dSer instanceof SimpleDeserializer))
                    throw new SAXException(
View Full Code Here

    public Object getValueAsType(QName type) throws Exception
    {
        if (context == null)
            throw new Exception(JavaUtils.getMessage("noContext00"));

        Deserializer dser = context.getDeserializerForType(type);
        if (dser == null)
            throw new Exception(JavaUtils.getMessage("noDeser00", "" + type));

        context.pushElementHandler(new EnvelopeHandler((SOAPHandler)dser));

        publishToHandler((org.xml.sax.ContentHandler) context);

        return dser.getValue();
    }
View Full Code Here

        QName itemType = context.getTypeFromAttributes(namespace,
                                                       localName,
                                                       attributes);

        // Get the deserializer for the type.
        Deserializer dSer = null;
        if (itemType != null && (context.getCurElement().getHref() == null)) {
            dSer = context.getDeserializerForType(itemType);
        }

        if (dSer == null) {
            // No deserializer can be found directly.  Need to look harder
            QName defaultType = defaultItemType;
            Class javaType = null;
            if (arrayClass != null &&
                arrayClass.isArray() &&
                defaultType == null) {
                javaType = arrayClass.getComponentType();
                defaultType = context.getTypeMapping().getTypeQName(javaType);
            }

            // We don't have a deserializer, the safest thing to do
            // is to set up using the DeserializerImpl below. 
            // The DeserializerImpl will take care of href/id and
            // install the appropriate serializer, etc.  The problem
            // is that takes a lot of time and will occur
            // all the time if no xsi:types are sent.  Most of the
            // time an item is a simple schema type (i.e. String)
            // so the following shortcut is used to get a Deserializer
            // for these cases.
            if (itemType == null && dSer == null) {
                if (defaultType != null && SchemaUtils.isSimpleSchemaType(defaultType)) {
                    dSer = context.getDeserializer(javaType, defaultType);
                }
            }
           
            // If no deserializer is
            // found, the deserializer is set to DeserializerImpl().
            // It is possible that the element has an href, thus we
            // won't know the type until the definitition is encountered.
            if (dSer == null) {
                dSer = new DeserializerImpl();
                // Determine a default type for the deserializer
                if (itemType == null) {
                    dSer.setDefaultType(defaultType);
                }
            }
        }


        // Register the callback value target, and
        // keep track of this index so we know when it has been set.
        dSer.registerValueTarget(
            new DeserializerTarget(this, new Integer(curIndex)));
       
        // The framework handles knowing when the value is complete, as
        // long as we tell it about each child we're waiting on...
        addChildDeserializer(dSer);
View Full Code Here

        throws SAXException
        {
            QName typeQName = context.getTypeFromAttributes(namespace,
                                                            localName,
                                                            attributes);
            Deserializer dser = context.getDeserializerForType(typeQName);

            // If no deserializer, use the base DeserializerImpl.
            if (dser == null)
                dser = new DeserializerImpl();

            // When the child value is ready, we
            // want our set method to be invoked.
            // To do this register a DeserializeTarget on the
            // new Deserializer.
            DeserializerTarget dt = null;
            if (context.isNil(attributes)) {
                dt = new DeserializerTarget(this, NILHINT);
            } else if (localName.equals("key")) {
                dt = new DeserializerTarget(this, KEYHINT);
            } else if (localName.equals("value")) {
                dt = new DeserializerTarget(this, VALHINT);
            } else {
                // Do nothing
            }
            if (dt != null) {
                dser.registerValueTarget(dt);
            }
           
            // We need this guy to complete for us to complete.
            addChildDeserializer(dser);
           
View Full Code Here

TOP

Related Classes of org.apache.axis.encoding.Deserializer$CallbackTarget

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.