Package org.apache.axis.encoding

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


        //  </method>
        // so that a list of 3 items is created.
        // Failure to register the target would result in the last
        // item not being added to the list
        if (context.isNil(attributes)) {
          Deserializer nilDSer =  new DeserializerImpl();
          nilDSer.registerValueTarget(
             new MethodTarget(currentParam,
                              RPCParam.getValueSetMethod()));
          return (SOAPHandler) nilDSer;
        }
       
        Deserializer dser = null;
        if ((type == null) && (namespace != null) && (!namespace.equals(""))) {
            dser = context.getDeserializerForType(qname);
        } else {
            dser = context.getDeserializer(destClass, type);
        }
       
        if (dser == null) {
          if (type != null) {
              dser = context.getDeserializerForType(type);
              if(null != destClass && dser == null && destClass.isAssignableFrom( org.w3c.dom.Element.class )){
                //If a DOM element is expected, as last resort always allow direct mapping
                // of parameter's SOAP xml to a DOM element.  Support of literal  parms by default.
                dser = context.getDeserializer(destClass, Constants.SOAP_ELEMENT);

              }
              if (dser == null) {
                  throw new SAXException(Messages.getMessage(
                          "noDeser01", localName,"" + type));
              }
              if (paramDesc != null && paramDesc.getJavaType() != null) {
                  // If we have an xsi:type, make sure it makes sense
                  // with the current paramDesc type
                  Class xsiClass =
                          context.getTypeMapping().getClassForQName(type);
                  if (null != xsiClass  && !JavaUtils.isConvertable(xsiClass, destClass)) {
                      throw new SAXException("Bad types (" +
                                             xsiClass + " -> " + destClass + ")"); // FIXME!
                  }
              }
          } else {
              dser = new DeserializerImpl();
              if (dser == null) {
                  throw new SAXException(Messages.getMessage(
                          "noDeser01", localName,"" + type));
              }
          }
        }

        dser.setDefaultType(type);

        dser.registerValueTarget(
             new MethodTarget(currentParam,
                 RPCParam.getValueSetMethod()));

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


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

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

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

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

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

                                    String prefix,
                                    Attributes attributes,
                                    DeserializationContext context)
        throws SAXException
    {
        Deserializer currentDeser = null;
       
        QName qName = (QName)fields.get(name);
       
        if (qName != null) {
            currentDeser = context.getDeserializerForType(qName);
            if (currentDeser != null) {
                currentDeser.registerValueTarget(new CallbackTarget(this, name));
            }
        }
       
        return (SOAPHandler)currentDeser;
    }
View Full Code Here

        //  </method>
        // so that a list of 3 items is created.
        // Failure to register the target would result in the last
        // item not being added to the list
        if (context.isNil(attributes)) {
          Deserializer nilDSer =  new DeserializerImpl();
          nilDSer.registerValueTarget(
             new MethodTarget(currentParam,
                              RPCParam.getValueSetMethod()));
          return (SOAPHandler) nilDSer;
        }
       
        Deserializer dser = null;
        if ((type == null) && (namespace != null) && (!namespace.equals(""))) {
            dser = context.getDeserializerForType(qname);
        } else {
            dser = context.getDeserializer(destClass, type);
        }
       
        if (dser == null) {
          if (type != null) {
              dser = context.getDeserializerForType(type);
              if (dser == null) {
                  throw new SAXException(JavaUtils.getMessage(
                          "noDeser01", localName,"" + type));
              }
              if (paramDesc != null && paramDesc.getJavaType() != null) {
                  // If we have an xsi:type, make sure it makes sense
                  // with the current paramDesc type
                  Class xsiClass =
                          context.getTypeMapping().getClassForQName(type);
                  if (!JavaUtils.isConvertable(xsiClass, destClass)) {
                      throw new SAXException("Bad types (" +
                                             xsiClass + " -> " + destClass + ")"); // FIXME!
                  }
              }
          } else {
              dser = new DeserializerImpl();
              if (dser == null) {
                  throw new SAXException(JavaUtils.getMessage(
                          "noDeser01", localName,"" + type));
              }
          }
        }

        dser.setDefaultType(type);

        dser.registerValueTarget(
             new MethodTarget(currentParam,
                 RPCParam.getValueSetMethod()));

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

        //  </method>
        // so that a list of 3 items is created.
        // Failure to register the target would result in the last
        // item not being added to the list
        if (context.isNil(attributes)) {
          Deserializer nilDSer =  new DeserializerImpl();
          nilDSer.registerValueTarget(
             new MethodTarget(currentParam,
                              RPCParam.getValueSetMethod()));
          return (SOAPHandler) nilDSer;
        }
       
        Deserializer dser = null;
        if ((type == null) && (namespace != null) && (!namespace.equals(""))) {
            dser = context.getDeserializerForType(qname);
        } else {
            dser = context.getDeserializer(destClass, type);
        }
       
        if (dser == null) {
          if (type != null) {
              dser = context.getDeserializerForType(type);
              if (dser == null) {
                  throw new SAXException(JavaUtils.getMessage(
                          "noDeser01", localName,"" + type));
              }
              if (paramDesc != null && paramDesc.getJavaType() != null) {
                  // If we have an xsi:type, make sure it makes sense
                  // with the current paramDesc type
                  Class xsiClass =
                          context.getTypeMapping().getClassForQName(type);
                  if (!JavaUtils.isConvertable(xsiClass, destClass)) {
                      throw new SAXException("Bad types (" +
                                             xsiClass + " -> " + destClass + ")"); // FIXME!
                  }
              }
          } else {
              dser = new DeserializerImpl();
              if (dser == null) {
                  throw new SAXException(JavaUtils.getMessage(
                          "noDeser01", localName,"" + type));
              }
          }
        }

        dser.setDefaultType(type);

        dser.registerValueTarget(
             new MethodTarget(currentParam,
                 RPCParam.getValueSetMethod()));

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

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

        // Get the deserializer for the type.
        Deserializer dSer = null;
        if (itemType != 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)));
        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

        QName childXMLType = context.getTypeFromXSITypeAttr(namespace,
                                                            localName,
                                                            attributes);
       
        // Get Deserializer for child, default to using DeserializerImpl
        Deserializer dSer = getDeserializer(childXMLType, propDesc.getType(),
                                            attributes.getValue("href"),
                                            context);
        // It is an error if the dSer is not found, the base
        // deserializer impl is returned so that it can generate the correct message.
        if (dSer == null) {
            dSer = new DeserializerImpl();
            return (SOAPHandler)dSer;
        }

        // Register value target
        if (propDesc.isWriteable()) {
            // If this is an indexed property, and the deserializer we found
            // was NOT the ArrayDeserializer, this is a non-SOAP array:
            // <bean>
            //   <field>value1</field>
            //   <field>value2</field>
            // ...
            // In this case, we want to use the collectionIndex and make sure
            // the deserialized value for the child element goes into the
            // right place in the collection.
            if (propDesc.isIndexed() && !(dSer instanceof ArrayDeserializer)) {
                    collectionIndex++;
                    dSer.registerValueTarget(new BeanPropertyTarget(value,
                                                    propDesc, collectionIndex));
            } else {
                // If we're here, the element maps to a single field value,
                // whether that be a "basic" type or an array, so use the
                // normal (non-indexed) BeanPropertyTarget form.
                collectionIndex = -1;
                dSer.registerValueTarget(new BeanPropertyTarget(value,
                                                                propDesc));
            }
        }
        return (SOAPHandler)dSer;
    }
View Full Code Here

                    (BeanPropertyDescriptor) propertyMap.get(fieldName);
            if (bpd != null) {
                if (!bpd.isWriteable() || bpd.isIndexed() ) continue ;
               
                // Get the Deserializer for the attribute
                Deserializer dSer = getDeserializer(null, bpd.getType(),
                                                    null, context);

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

                cacheStringDSer.reset();
                return cacheStringDSer;
            }
        }
       
        Deserializer dSer = null;

        if (xmlType != null) {
            // Use the xmlType to get the deserializer.
            dSer = context.getDeserializerForType(xmlType);
        } else {
            // If the xmlType is not set, get a default xmlType
            TypeMapping tm = context.getTypeMapping();
            QName defaultXMLType = tm.getTypeQName(javaType);
            // If there is not href, then get the deserializer
            // using the javaType and default XMLType,
            // If there is an href, the create the generic
            // DeserializerImpl and set its default type (the
            // default type is used if the href'd element does
            // not have an xsi:type.
            if (href == null) {
                dSer = context.getDeserializer(javaType, defaultXMLType);
            } else {
                dSer = new DeserializerImpl();
                dSer.setDefaultType(defaultXMLType);
            }
        }
        if (javaType.equals(String.class) &&
            dSer instanceof SimpleDeserializer) {
            cacheStringDSer = (SimpleDeserializer) 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.